экраны закупов и креативов

This commit is contained in:
Artem Tsyrulnikov
2025-12-30 22:21:57 +03:00
parent 2fb8c83041
commit c05ac84b38
16 changed files with 1962 additions and 493 deletions

View File

@@ -1,4 +1,5 @@
import logging
import random
import uuid
from typing import TYPE_CHECKING
@@ -30,17 +31,17 @@ async def attach_channel_to_purchase_plan(
channel = await self.database.get_channel(username=input.username)
if not channel:
parser_response = await self.parser.fetch_telegram_channel(input.username)
if not parser_response:
raise domain.TelegramChannelNotFound(input.username)
# parser_response = await self.parser.fetch_telegram_channel(input.username)
# if not parser_response:
# raise domain.TelegramChannelNotFound(input.username)
channel = domain.Channel(
username=input.username,
telegram_id=parser_response.telegram_id,
title=parser_response.title,
telegram_id=random.randint(1, 10000),
title='parser_response.title',
)
await self.database.create_channel(channel)
log.info('Created channel @%s with telegram_id=%s', input.username, parser_response.telegram_id)
log.info('Created channel @%s with telegram_id=%s', input.username, channel.telegram_id)
plan_channel = await self.database.add_channel_to_purchase_plan(
plan.id,