new telegram bot
This commit is contained in:
24
src/usecase/project/get_project.py
Normal file
24
src/usecase/project/get_project.py
Normal file
@@ -0,0 +1,24 @@
|
||||
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,
|
||||
invite_link_type=project.invite_link_type,
|
||||
)
|
||||
Reference in New Issue
Block a user