Skip to content

Commit

Permalink
feat: Add RemoveMatchDecision method
Browse files Browse the repository at this point in the history
  • Loading branch information
bgins committed Dec 7, 2024
1 parent 55c4d9b commit e466482
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/solver/store/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,5 +583,25 @@ func (store *SolverStoreDatabase) RemoveResult(id string) error {
}

func (store *SolverStoreDatabase) RemoveMatchDecision(resourceOffer string, jobOffer string) error {
if resourceOffer == "" && jobOffer == "" {
return fmt.Errorf("resource offer or job offer must be set")
}

// Build the query based on which parameters are provided
query := store.db.Where([]MatchDecision{})

if resourceOffer != "" {
query = query.Where("resource_offer = ?", resourceOffer)
}
if jobOffer != "" {
query = query.Where("job_offer = ?", jobOffer)
}

// Execute the delete
result := query.Delete(&MatchDecision{})
if result.Error != nil {
return result.Error
}

return nil
}

0 comments on commit e466482

Please sign in to comment.