90% сеньоров плачат на таких коммитах

This commit is contained in:
Artem Tsyrulnikov
2025-12-15 19:10:41 +03:00
parent fda91cb6d8
commit 71e5a38efc
42 changed files with 403 additions and 302 deletions

26
src/domain/post.py Normal file
View File

@@ -0,0 +1,26 @@
import uuid
from typing import TYPE_CHECKING
from tortoise import fields
from .base import TimestampedModel
if TYPE_CHECKING:
from .channel import Channel
class Post(TimestampedModel):
message_id = fields.IntField()
text = fields.TextField()
deleted_from_channel_at = fields.DatetimeField(null=True)
channel: fields.ForeignKeyRelation['Channel'] = fields.ForeignKeyField(
'models.Channel', related_name='posts', on_delete=fields.CASCADE, index=True
)
if TYPE_CHECKING:
channel_id: uuid.UUID
class Meta:
table = 'post'
unique_together = (('channel_id', 'message_id'),)