string-enum-fix

This commit is contained in:
2023-11-30 11:40:27 +03:00
parent 1362eaa125
commit 919aaa951f
7 changed files with 21 additions and 19 deletions

View File

@@ -21,9 +21,11 @@ async def accept_invite(_, info, invite_id: int):
# Add the user to the shout authors
shout = session.query(Shout).filter(Shout.id == invite.shout_id).first()
if shout:
shout.authors.append(author)
session.delete(invite)
session.commit()
if author not in shout.authors:
shout.authors.append(author)
session.delete(invite)
session.add(shout)
session.commit()
return {"success": True, "message": "Invite accepted"}
else:
return {"error": "Shout not found"}