Block delete for in-progress access review campaigns
Reject deletion while a campaign is fetching sources so workers are not racing a removed record. All other statuses remain deletable. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
This commit is contained in:
@@ -205,6 +205,10 @@ func (s *Service) DeleteCampaign(
|
||||
return fmt.Errorf("cannot load campaign: %w", err)
|
||||
}
|
||||
|
||||
if campaign.Status == coredata.AccessReviewCampaignStatusInProgress {
|
||||
return NewCampaignNotDeletableError(campaign.ID)
|
||||
}
|
||||
|
||||
if err := campaign.Delete(ctx, conn, scope); err != nil {
|
||||
return fmt.Errorf("cannot delete campaign: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user