90% сеньоров плачат на таких коммитах
This commit is contained in:
26
src/domain/post.py
Normal file
26
src/domain/post.py
Normal 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'),)
|
||||
Reference in New Issue
Block a user