from typing import TYPE_CHECKING from src import domain, dto if TYPE_CHECKING: from .. import Usecase async def get_project(self: 'Usecase', input: dto.GetProjectInput) -> dto.ProjectOutput: project = await self.database.get_project(input.workspace_id, project_id=input.project_id) if not project: raise domain.ProjectNotFound() await project.fetch_related('channel') return dto.ProjectOutput( id=project.id, telegram_id=project.channel.telegram_id, title=project.channel.title, username=project.channel.username, status=project.status, purchase_invite_type_default=project.purchase_invite_type_default, )