парсер

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

@@ -42,6 +42,13 @@ async def create_placement(
raise domain.ChannelNotFound(project.channel.id)
invite_link = await self.telegram_bot.create_chat_invite_link(project.channel.telegram_id, requires_approval)
log.info(
'Created invite link for project=%s channel_telegram_id=%s requires_approval=%s invite_link=%s',
project.id,
project.channel.telegram_id,
requires_approval,
invite_link,
)
placement = domain.Placement(
project_id=input.project_id,

View File

@@ -64,4 +64,4 @@ async def fetch_placement_post_cycle(self: 'Usecase', interval_seconds: int) ->
post.id,
)
log.info('Fetch placement post cycle completed. Created %s placements', created_count)
log.debug('Fetch placement post cycle completed. Created %s placements', created_count)

View File

@@ -121,6 +121,7 @@ async def tg_add_project(self: 'Usecase', input: dto.ConnectProjectInput) -> dto
title=channel.title,
username=channel.username,
status=project.status,
purchase_invite_type_default=project.purchase_invite_type_default,
)
# Если >1 workspace - создаем/обновляем канал и отправляем уведомление

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(