fix: make deletion of single file commit to DB, create tests for file deletion (#8953)
* Added commit to db session * Changed order * Deleted flush * Added test to files
This commit is contained in:
parent
eb69cddc1c
commit
1362aa1172
2 changed files with 50 additions and 3 deletions
|
|
@ -275,7 +275,6 @@ async def delete_files_batch(
|
|||
await session.delete(file)
|
||||
|
||||
# Delete all files from the database
|
||||
await session.flush() # Ensures delete is staged
|
||||
await session.commit() # Commit deletion
|
||||
|
||||
except Exception as e:
|
||||
|
|
@ -474,7 +473,7 @@ async def delete_file(
|
|||
|
||||
# Delete from the database
|
||||
await session.delete(file_to_delete)
|
||||
await session.flush() # Ensures delete is staged
|
||||
await session.commit()
|
||||
|
||||
except HTTPException:
|
||||
# Re-raise HTTPException to avoid being caught by the generic exception handler
|
||||
|
|
@ -506,7 +505,6 @@ async def delete_all_files(
|
|||
await session.delete(file)
|
||||
|
||||
# Delete all files from the database
|
||||
await session.flush() # Ensures delete is staged
|
||||
await session.commit() # Commit deletion
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue