парсер

This commit is contained in:
Artem Tsyrulnikov
2026-01-06 22:15:49 +03:00
parent 2c0ae2dfc3
commit a8be39005b
10 changed files with 237 additions and 17 deletions

View File

@@ -97,11 +97,6 @@ async def create_purchase(
if not creative or creative.project_id != project.id:
raise domain.CreativeNotFound(input.creative_id)
existing_purchase = await self.database.get_active_purchase(project.id, creative.id)
if existing_purchase:
channels = await self.database.get_purchase_channels(existing_purchase.id)
return _build_purchase_output(existing_purchase, channels)
details = input.details
purchase = domain.Purchase(
workspace_id=workspace_id,
@@ -143,6 +138,13 @@ async def create_purchase(
log.info('Created channel @%s with telegram_id=%s', channel.username, channel.telegram_id)
invite_link = await self.telegram_bot.create_chat_invite_link(project.channel.telegram_id, requires_approval)
log.info(
'Created invite link for purchase %s channel_telegram_id=%s requires_approval=%s invite_link=%s',
purchase.id,
project.channel.telegram_id,
requires_approval,
invite_link,
)
channel_details = channel_input.details
purchase_channel = await self.database.add_channel_to_purchase(