from django.db import models

# Create your models here.

class HistorySync(models.Model):
    """
    Keeps an historic record of the importation of products for a company
    """

    company = models.ForeignKey('companies.Company', on_delete=models.DO_NOTHING, null=True)
    rss_url = models.URLField('URL del feed', null=True, blank=True)
    sync_date = models.DateTimeField('Fecha de lanzamiento', null=True, blank=True)
    result = models.TextField('Resultado', null=True, blank=True)
    quantity = models.PositiveIntegerField('Productos importados', null=True, blank=True)

    # internal
    created = models.DateTimeField('date of creation', auto_now_add=True)
    updated = models.DateTimeField('date last update', auto_now=True)
    creator = models.ForeignKey('core.CustomUser', on_delete=models.DO_NOTHING, null=True, related_name='historysync')
