fmt
Some checks failed
Deploy on push / deploy (push) Failing after 36s

This commit is contained in:
2025-08-23 10:47:52 +03:00
parent d33e53933f
commit b4f683a7cc
12 changed files with 406 additions and 810 deletions

View File

@@ -429,7 +429,7 @@ async def publish_draft(_: None, info: GraphQLResolveInfo, draft_id: int) -> dic
return {"error": f"Cannot publish draft: {error}"}
# Проверяем, есть ли уже публикация для этого черновика
shout = None
shout: Any = None
if draft.shout:
shout = session.query(Shout).where(Shout.id == draft.shout).first()
if shout:
@@ -463,6 +463,10 @@ async def publish_draft(_: None, info: GraphQLResolveInfo, draft_id: int) -> dic
session.add(shout)
session.flush() # Получаем ID нового шаута
# Ensure shout is not None before proceeding
if not shout:
return {"error": "Failed to create or update shout"}
# Очищаем существующие связи
session.query(ShoutAuthor).where(ShoutAuthor.shout == shout.id).delete()
session.query(ShoutTopic).where(ShoutTopic.shout == shout.id).delete()
@@ -493,7 +497,7 @@ async def publish_draft(_: None, info: GraphQLResolveInfo, draft_id: int) -> dic
await notify_shout(shout.dict(), "published")
# Обновляем поисковый индекс
await search_service.perform_index(shout)
search_service.index(shout)
logger.info(f"Successfully published shout #{shout.id} from draft #{draft_id}")
logger.debug(f"Shout data: {shout.dict()}")