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

View File

@@ -122,14 +122,11 @@ class Database(typing.Protocol):
async def get_channel(
self,
workspace_id: UUID,
channel_id: UUID | None = None,
telegram_id: int | None = None,
username: str | None = None,
) -> domain.Channel | None: ...
async def get_workspace_channels(self, workspace_id: UUID) -> list[domain.Channel]: ...
async def create_channel(self, channel: domain.Channel) -> None: ...
async def update_channel(self, channel: domain.Channel) -> None: ...
@@ -232,15 +229,27 @@ class Database(typing.Protocol):
self, subscriber_id: UUID, project_id: UUID
) -> domain.Subscription | None: ...
async def create_placement_views_history(self, history: domain.PlacementViewsHistory) -> None: ...
# Post methods
async def create_post(self, post: domain.Post) -> None: ...
async def get_post(self, post_id: UUID) -> domain.Post | None: ...
async def get_post_by_channel_and_message(self, channel_id: UUID, message_id: int) -> domain.Post | None: ...
# Post views history
async def create_post_views_history(self, history: domain.PostViewsHistory) -> None: ...
async def get_views_history(
self,
placement_id: UUID,
post_id: UUID,
*,
from_date: datetime.datetime | None = None,
to_date: datetime.datetime | None = None,
) -> list[domain.PlacementViewsHistory]: ...
) -> list[domain.PostViewsHistory]: ...
async def get_latest_views_data(self, post_id: UUID) -> tuple[int, datetime.datetime] | None: ...
async def get_latest_views_data_batch(self, post_ids: list[UUID]) -> dict[UUID, tuple[int, datetime.datetime]]: ...
async def get_telegram_state(self, telegram_id: int) -> domain.TelegramState | None: ...