Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func updateCancellationAmount(db *gorm.DB, restaurantID uint) error {
- query := `
- UPDATE Restaurant
- SET CancellationAmount =
- CASE
- WHEN CancellationAmount = 0 THEN GREATEST(DinnerPriceMax, LunchPriceMax)
- ELSE CancellationAmount
- END
- WHERE id = ?;
- `
- if err := db.Exec(query, restaurantID).Error; err != nil {
- logging.Logger.Error("Error updating CancellationAmount", zap.Error(err))
- return err
- }
- return nil
- }
- if err := updateCancellationAmount(dbutil.DB(), body.ID); err != nil {
- return nil, http.StatusInternalServerError, err
- }
Advertisement
Add Comment
Please, Sign In to add comment