27 lines
716 B
Python
27 lines
716 B
Python
from typing import TYPE_CHECKING
|
|
from uuid import UUID
|
|
|
|
from tortoise import fields
|
|
|
|
from .base import TimestampedModel
|
|
|
|
if TYPE_CHECKING:
|
|
from .placement import Placement
|
|
|
|
|
|
class PlacementViewsHistory(TimestampedModel):
|
|
id = fields.UUIDField(pk=True)
|
|
|
|
views_count = fields.IntField() # Количество просмотров на момент снимка
|
|
fetched_at = fields.DatetimeField(index=True)
|
|
|
|
placement: fields.ForeignKeyRelation['Placement'] = fields.ForeignKeyField(
|
|
'models.Placement', related_name='views_histories', on_delete=fields.CASCADE, index=True
|
|
)
|
|
|
|
if TYPE_CHECKING:
|
|
placement_id: UUID
|
|
|
|
class Meta:
|
|
table = 'placement_views_history'
|