ref: рефакторинг usecases
This commit is contained in:
@@ -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=[
|
||||
|
||||
Reference in New Issue
Block a user