mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 01:06:23 +02:00
feat: add conflict handling for document deletion and selection based on processing state
This commit is contained in:
parent
aef59d04eb
commit
6cd3f5c1f6
4 changed files with 51 additions and 14 deletions
|
|
@ -230,6 +230,14 @@ async def delete_note(
|
|||
if not document:
|
||||
raise HTTPException(status_code=404, detail="Note not found")
|
||||
|
||||
# Check if note is pending or currently being processed
|
||||
doc_state = document.status.get("state") if document.status else None
|
||||
if doc_state in ("pending", "processing"):
|
||||
raise HTTPException(
|
||||
status_code=409,
|
||||
detail="Cannot delete note while it is pending or being processed. Please wait for processing to complete.",
|
||||
)
|
||||
|
||||
# Delete document (chunks will be cascade deleted)
|
||||
await session.delete(document)
|
||||
await session.commit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue