feat: доменный нейминг изменен

This commit is contained in:
Artem Tsyrulnikov
2025-11-13 01:18:04 +03:00
parent a48d5e67cb
commit bba37fbb21
51 changed files with 1144 additions and 1154 deletions

View File

@@ -9,12 +9,11 @@ from src import domain
if TYPE_CHECKING:
from . import TargetChannel
# M2M association table between TargetChannel and ExternalChannel
target_channel_external_channel = Table(
'target_channel_external_channels',
target_external_channel = Table(
'target_external_channel',
domain.Base.metadata,
Column('target_channel_id', ForeignKey('targetchannels.id', ondelete='CASCADE'), primary_key=True),
Column('external_channel_id', ForeignKey('externalchannels.id', ondelete='CASCADE'), primary_key=True),
Column('target_channel_id', ForeignKey('target_channel.id', ondelete='CASCADE'), primary_key=True),
Column('external_channel_id', ForeignKey('external_channel.id', ondelete='CASCADE'), primary_key=True),
)
@@ -24,10 +23,9 @@ class ExternalChannel(domain.Base):
username: Mapped[str | None] = mapped_column(index=True)
description: Mapped[str | None]
subscribers_count: Mapped[int | None]
user_id: Mapped[uuid.UUID] = mapped_column(ForeignKey('users.id'), index=True)
user_id: Mapped[uuid.UUID] = mapped_column(ForeignKey('user.id'), index=True)
# M2M relationship with target channels
target_channels: Mapped[list['TargetChannel']] = relationship(
secondary=target_channel_external_channel,
secondary=target_external_channel,
back_populates='external_channels',
)