feat: переименование доменной области

This commit is contained in:
Artem Tsyrulnikov
2025-12-14 12:21:35 +03:00
parent 3cb3da4dbe
commit f3e09a08eb
75 changed files with 1624 additions and 1417 deletions

View File

@@ -15,24 +15,30 @@ async def create_placement(
) -> dto.PlacementOutput:
await self.ensure_workspace_access(workspace_id, user_id)
target_channel = await self.database.get_target_channel(workspace_id, channel_id=input.target_channel_id)
if not target_channel:
raise domain.TargetChannelNotFound(input.target_channel_id)
project = await self.database.get_project(workspace_id, project_id=input.project_id)
if not project:
raise domain.ProjectNotFound(input.project_id)
external_channel = await self.database.get_external_channel(workspace_id, channel_id=input.external_channel_id)
if not external_channel:
raise domain.ExternalChannelNotFound(input.external_channel_id)
placement_channel = await self.database.get_channel(workspace_id, channel_id=input.placement_channel_id)
if not placement_channel:
raise domain.ChannelNotFound(input.placement_channel_id)
creative = await self.database.get_creative(workspace_id, input.creative_id)
if not creative:
raise domain.CreativeNotFound(input.creative_id)
if creative.project_id != project.id:
raise domain.CreativeNotFound(input.creative_id)
requires_approval = input.invite_link_type == domain.InviteLinkType.APPROVAL
invite_link = await self.telegram_bot.create_chat_invite_link(target_channel.telegram_id, requires_approval)
if project.channel.telegram_id is None:
raise domain.ChannelNotFound(project.channel.id)
invite_link = await self.telegram_bot.create_chat_invite_link(project.channel.telegram_id, requires_approval)
placement = domain.Placement(
target_channel_id=input.target_channel_id,
external_channel_id=input.external_channel_id,
project_id=input.project_id,
placement_channel_id=input.placement_channel_id,
creative_id=input.creative_id,
workspace_id=workspace_id,
placement_date=input.placement_date,
@@ -51,10 +57,10 @@ async def create_placement(
return dto.PlacementOutput(
id=placement.id,
target_channel_id=placement.target_channel_id,
target_channel_title=target_channel.title,
external_channel_id=placement.external_channel_id,
external_channel_title=external_channel.title,
project_id=placement.project_id,
project_channel_title=project.channel.title,
placement_channel_id=placement.placement_channel_id,
placement_channel_title=placement_channel.title,
creative_id=placement.creative_id,
creative_name=creative.name,
placement_date=placement.placement_date,