ref: рефакторинг usecases

This commit is contained in:
Artem Tsyrulnikov
2025-12-11 18:02:46 +03:00
parent 38f1b3feba
commit 1f80d9bdfb
47 changed files with 853 additions and 3454 deletions

View File

@@ -10,15 +10,12 @@ log = logging.getLogger(__name__)
async def get_external_channels(self: 'Usecase', input: dto.GetExternalChannelsInput) -> dto.GetExternalChannelsOutput:
async with self.database.transaction():
target_channel = await self.database.get_target_channel(input.user_id, channel_id=input.target_channel_id)
if not target_channel:
log.warning(
'Target channel %s not found or not accessible for user %s', input.target_channel_id, input.user_id
)
raise domain.TargetChannelNotFound(input.target_channel_id)
target_channel = await self.database.get_target_channel(input.user_id, channel_id=input.target_channel_id)
if not target_channel:
log.warning('Target channel %s not found or not accessible for user %s', input.target_channel_id, input.user_id)
raise domain.TargetChannelNotFound(input.target_channel_id)
channels = await self.database.get_external_channels_for_target(input.target_channel_id)
channels = await self.database.get_external_channels_for_target(input.target_channel_id)
return dto.GetExternalChannelsOutput(
external_channels=[