fix: фиксы после рефакторинга
This commit is contained in:
@@ -13,6 +13,10 @@ log = logging.getLogger(__name__)
|
||||
async def create_external_channel(
|
||||
self: 'Usecase', input: dto.CreateExternalChannelInput, user_id: uuid.UUID
|
||||
) -> dto.ExternalChannelOutput:
|
||||
existing_channel = await self.database.get_external_channel(user_id, telegram_id=input.telegram_id)
|
||||
if existing_channel:
|
||||
raise domain.ExternalChannelAlreadyExists(input.telegram_id)
|
||||
|
||||
for target_id in input.target_channel_ids:
|
||||
target_channel = await self.database.get_target_channel(user_id, channel_id=target_id)
|
||||
|
||||
@@ -32,7 +36,7 @@ async def create_external_channel(
|
||||
await self.database.create_external_channel(channel)
|
||||
|
||||
if input.target_channel_ids:
|
||||
await self.database.add_external_channel_to_targets(channel.id, input.target_channel_ids)
|
||||
await self.database.add_external_channel_to_targets(channel, input.target_channel_ids)
|
||||
|
||||
log.info(
|
||||
'External channel %s created and linked to %s target channels', input.telegram_id, len(input.target_channel_ids)
|
||||
|
||||
Reference in New Issue
Block a user