This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user