Make risk delete prove document mapping cleanup
Removing junction rows before deleteRisk hid missing soft-delete cleanup in e2e. Assert deleteRisk succeeds only after deleteDocument clears mappings, and document links must be removed first. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
This commit is contained in:
committed by
Bryan Frimin
parent
24d137e536
commit
255bea4738
@@ -612,15 +612,10 @@ func (s RiskService) Delete(
|
||||
riskID gid.GID,
|
||||
) error {
|
||||
risk := &coredata.Risk{}
|
||||
riskDocument := &coredata.RiskDocument{}
|
||||
|
||||
return s.svc.pg.WithTx(
|
||||
ctx,
|
||||
func(ctx context.Context, tx pg.Tx) error {
|
||||
if err := riskDocument.DeleteByRiskID(ctx, tx, scope, riskID); err != nil {
|
||||
return fmt.Errorf("cannot delete risk document mappings: %w", err)
|
||||
}
|
||||
|
||||
return risk.Delete(ctx, tx, scope, riskID)
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user