feat: миграция с булевых переменных на status для target_channel

This commit is contained in:
Artem Tsyrulnikov
2025-12-01 13:34:26 +03:00
parent f7754b707d
commit d117776e65
16 changed files with 56 additions and 67 deletions

View File

@@ -29,8 +29,8 @@ async def update_target_chan_permissions(self: 'Usecase', input: dto.UpdateTarge
raise domain.TargetChannelNotFound()
if not missing_permissions:
if not channel.is_active:
channel.is_active = True
if channel.status != domain.TargetChannelStatus.ACTIVE:
channel.status = domain.TargetChannelStatus.ACTIVE
await self.database.update_target_channel(channel)
await self.telegram_bot.send_message(
@@ -40,8 +40,8 @@ async def update_target_chan_permissions(self: 'Usecase', input: dto.UpdateTarge
log.info(f'Target channel {input.telegram_id} reactivated - all permissions granted')
return
if channel.is_active:
channel.is_active = False
if channel.status == domain.TargetChannelStatus.ACTIVE:
channel.status = domain.TargetChannelStatus.INACTIVE
await self.database.update_target_channel(channel)
missed_permissions = '\n'.join(f'{p}' for p in missing_permissions)