empty-body-fix
All checks were successful
Deploy on push / deploy (push) Successful in 45s

This commit is contained in:
Untone 2025-04-26 16:19:33 +03:00
parent dfbdfba2f0
commit 0939e91700

View File

@ -343,6 +343,10 @@ async def publish_draft(_, info, draft_id: int):
if not draft: if not draft:
return {"error": "Draft not found"} return {"error": "Draft not found"}
# Проверка на пустой body
if not draft.body or not draft.body.strip():
return {"error": "Draft body is empty, cannot publish."}
# Ищем существующий shout для этого черновика # Ищем существующий shout для этого черновика
shout = session.query(Shout).filter(Shout.draft == draft_id).first() shout = session.query(Shout).filter(Shout.draft == draft_id).first()
was_published = shout.published_at if shout else None was_published = shout.published_at if shout else None