unpublish,delete-draft-fix
All checks were successful
Deploy on push / deploy (push) Successful in 1m23s

This commit is contained in:
2025-05-03 10:53:40 +03:00
parent 5f3d90fc90
commit 58ec60262b
2 changed files with 22 additions and 19 deletions

View File

@@ -327,7 +327,7 @@ async def delete_draft(_, info, draft_id: int):
draft = session.query(Draft).filter(Draft.id == draft_id).first()
if not draft:
return {"error": "Draft not found"}
if author_id != draft.created_by_id and draft.authors.filter(Author.id == author_id).count() == 0:
if author_id != draft.created_by.id and draft.authors.filter(Author.id == author_id).count() == 0:
return {"error": "You are not allowed to delete this draft"}
session.delete(draft)
session.commit()