Skip to content

Commit

Permalink
Update Library Fixes apache#7704
Browse files Browse the repository at this point in the history
  • Loading branch information
jagan-parthiban committed Aug 8, 2023
1 parent 3893b95 commit da5cfec
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions traffic_ops/traffic_ops_golang/parameter/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,14 +536,14 @@ func DeleteParameter(w http.ResponseWriter, r *http.Request) {
return
}

assignedProfile := 0
if err := inf.Tx.Get(&assignedProfile, "SELECT count(profile) FROM profile_parameter pp WHERE pp.parameter=$1", id); err != nil {
api.HandleErr(w, r, tx, http.StatusInternalServerError, nil, fmt.Errorf("parameter delete error, could not count assigned profiles: %w", err))
return
} else if assignedProfile != 0 {
api.HandleErr(w, r, tx, http.StatusBadRequest, fmt.Errorf("can not delete a parameter with %d assigned profile", assignedProfile), nil)
return
}
//assignedProfile := 0
//if err := inf.Tx.Get(&assignedProfile, "SELECT count(profile) FROM profile_parameter pp WHERE pp.parameter=$1", id); err != nil {
// api.HandleErr(w, r, tx, http.StatusInternalServerError, nil, fmt.Errorf("parameter delete error, could not count assigned profiles: %w", err))
// return
//} else if assignedProfile != 0 {
// api.HandleErr(w, r, tx, http.StatusBadRequest, fmt.Errorf("can not delete a parameter with %d assigned profile", assignedProfile), nil)
// return
//}

res, err := tx.Exec("DELETE FROM parameter AS p WHERE p.id=$1", id)
if err != nil {
Expand Down

0 comments on commit da5cfec

Please sign in to comment.