feat: аналитика

This commit is contained in:
Artem Tsyrulnikov
2025-11-21 00:54:11 +03:00
parent 969ac2c93c
commit a60daddcf1
14 changed files with 566 additions and 21 deletions

View File

@@ -132,6 +132,11 @@ class Postgres(DatabaseBase):
result = await self.session.execute(q)
return list(result.scalars().all())
async def get_user_external_channels(self, user_id: uuid.UUID) -> list[domain.ExternalChannel]:
q = select(domain.ExternalChannel).where(domain.ExternalChannel.user_id == user_id)
result = await self.session.execute(q)
return list(result.scalars().all())
async def add_external_channel_to_targets(
self, external_channel_id: uuid.UUID, target_channel_ids: list[uuid.UUID]
) -> None:
@@ -204,7 +209,7 @@ class Postgres(DatabaseBase):
return creative
async def get_user_creatives(
self, user_id: uuid.UUID, *, target_channel_id: uuid.UUID | None = None, include_archived: bool = False
self, user_id: uuid.UUID, target_channel_id: uuid.UUID | None = None, include_archived: bool = False
) -> list[domain.Creative]:
q = (
select(domain.Creative)
@@ -261,7 +266,6 @@ class Postgres(DatabaseBase):
async def get_user_placements(
self,
user_id: uuid.UUID,
*,
target_channel_id: uuid.UUID | None = None,
external_channel_id: uuid.UUID | None = None,
creative_id: uuid.UUID | None = None,