Fix Endpoint to Properly Delete Messages from Database (#2436)

This PR addresses an issue with the endpoint that was failing to delete
messages from the database. The necessary corrections have been made to
ensure that messages are now properly removed when the endpoint is
called.
This commit is contained in:
anovazzi1 2024-06-28 19:39:18 +00:00 committed by GitHub
commit 975dc8876b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -80,7 +80,8 @@ async def delete_messages(
current_user: User = Depends(get_current_active_user),
):
try:
session.exec(select(MessageTable).where(MessageTable.id.in_(message_ids))) # type: ignore
session.exec(delete(MessageTable).where(MessageTable.id.in_(message_ids))) # type: ignore
session.commit()
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))