Skip to content

Commit ca87b6b

Browse files
committed
Corrected database interaction when deleting
1 parent d4ba9b9 commit ca87b6b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

backend/app/api/routes/documents.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ def delete_doc(
7474
))
7575
.values(deleted_at=deleted_at)
7676
)
77-
session.exec(statement)
77+
result = session.exec(statement)
78+
if not result.rowcount:
79+
detail = f'Item "{doc_id}" not found'
80+
raise HTTPException(status_code=404, detail=detail)
81+
session.commit()
7882

7983
# TODO: perform delete on the collection
8084

0 commit comments

Comments
 (0)