Skip to content

Commit

Permalink
[FIX] Error when deleting a case with notes revisions
Browse files Browse the repository at this point in the history
  • Loading branch information
whikernel committed Sep 30, 2024
1 parent 9b4a680 commit 01ba6a3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion source/app/datamgmt/manage/manage_cases_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from app.datamgmt.manage.manage_case_state_db import get_case_state_by_name
from app.datamgmt.authorization import has_deny_all_access_level
from app.datamgmt.states import delete_case_states
from app.models import CaseAssets
from app.models import CaseAssets, NoteRevisions
from app.models import CaseClassification
from app.models import alert_assets_association
from app.models import CaseStatus
Expand Down Expand Up @@ -369,6 +369,13 @@ def delete_case(case_id):
NotesGroupLink.query.filter(NotesGroupLink.case_id == case_id).delete()
NotesGroup.query.filter(NotesGroup.group_case_id == case_id).delete()

NoteRevisions.query.filter(
and_(
Notes.note_case_id == case_id,
NoteRevisions.note_id == Notes.note_id
)
).delete()

Notes.query.filter(Notes.note_case_id == case_id).delete()
NoteDirectory.query.filter(NoteDirectory.case_id == case_id).delete()

Expand Down

0 comments on commit 01ba6a3

Please sign in to comment.