креативы

This commit is contained in:
Artem Tsyrulnikov
2026-01-03 16:11:05 +03:00
parent 841a8b5aaa
commit c04faf8132
15 changed files with 597 additions and 59 deletions

View File

@@ -22,11 +22,17 @@ async def create_creative(
log.warning('User %s attempted to create creative for unavailable project %s', user_id, project_id)
raise domain.ProjectNotFound(project_id)
domain.validate_media_size(input.media_data)
creative_text = domain.replace_invite_link_with_tag(input.text)
creative = domain.Creative(
name=input.name,
text=creative_text,
media_type=input.media_type,
media_file_id=input.media_file_id,
media_data=input.media_data,
buttons=[button.model_dump() for button in input.buttons],
status=domain.CreativeStatus.ACTIVE,
project_id=project.id,
workspace_id=workspace_id,
@@ -37,6 +43,9 @@ async def create_creative(
id=creative.id,
name=creative.name,
text=creative.text,
media_type=creative.media_type,
media_file_id=creative.media_file_id,
buttons=creative.buttons,
project_id=project.id,
project_channel_title=project.channel.title,
created_at=creative.created_at,