feat: проверка существования канала при привязке

This commit is contained in:
Artem Tsyrulnikov
2025-12-15 22:09:23 +03:00
parent 68edf11576
commit 83a81f46f7
22 changed files with 270 additions and 125 deletions

View File

@@ -279,11 +279,22 @@ class JWTEncoder(typing.Protocol):
def encode_access_token(self, user_id: UUID, telegram_id: int, username: str | None = None) -> str: ...
class FetchChannelResponse(typing.Protocol):
telegram_id: int
username: str
title: str
class ParserClient(typing.Protocol):
async def fetch_telegram_channel(self, username: str) -> FetchChannelResponse | None: ...
@dataclass
class Usecase:
database: Database
telegram_bot: TelegramBotWriter
jwt_encoder: JWTEncoder
parser_client: ParserClient
async def ensure_workspace_access(self, workspace_id: UUID, user_id: UUID) -> domain.Workspace:
workspace = await self.database.get_workspace_for_user(workspace_id, user_id)