feat: add workspace

This commit is contained in:
Artem Tsyrulnikov
2025-12-13 22:09:55 +03:00
parent 2fdd56c3e0
commit af32e2a507
55 changed files with 677 additions and 227 deletions

View File

@@ -7,7 +7,7 @@ from .base import TimestampedModel
if TYPE_CHECKING:
from .target_channel import TargetChannel
from .user import User
from .workspace import Workspace
class ExternalChannel(TimestampedModel):
@@ -18,14 +18,13 @@ class ExternalChannel(TimestampedModel):
description = fields.TextField(null=True)
subscribers_count = fields.IntField(null=True)
user: fields.ForeignKeyRelation['User'] = fields.ForeignKeyField(
'models.User', related_name='external_channels', on_delete=fields.CASCADE, index=True
workspace: fields.ForeignKeyRelation['Workspace'] = fields.ForeignKeyField(
'models.Workspace', related_name='external_channels', on_delete=fields.CASCADE, index=True
)
if TYPE_CHECKING:
target_channels: fields.ManyToManyRelation['TargetChannel']
user_id: UUID
workspace_id: UUID
class Meta:
table = 'external_channel'
unique_together = (('user_id', 'telegram_id'),)