feat: убираем денормализацию (антипреждевременная оптимизация)

This commit is contained in:
Artem Tsyrulnikov
2025-12-16 10:04:20 +03:00
parent 2339471956
commit 18b30eaf7f
26 changed files with 295 additions and 232 deletions

View File

@@ -39,8 +39,6 @@ async def create_placement(
if project.channel.telegram_id is None:
raise domain.ChannelNotFound(project.channel.id)
print(f'Телега id: {project.channel.telegram_id}')
invite_link = await self.telegram_bot.create_chat_invite_link(project.channel.telegram_id, requires_approval)
placement = domain.Placement(
@@ -56,11 +54,7 @@ async def create_placement(
status=domain.PlacementStatus.ACTIVE,
)
async with self.database.transaction():
await self.database.create_placement(placement)
creative.placements_count += 1
await self.database.update_creative(creative)
await self.database.create_placement(placement)
return dto.PlacementOutput(
id=placement.id,
@@ -77,6 +71,6 @@ async def create_placement(
invite_link_type=placement.invite_link_type,
invite_link=placement.invite_link,
status=placement.status,
subscriptions_count=placement.subscriptions_count,
subscriptions_count=0,
created_at=placement.created_at,
)