diff --git a/pkg/query-service/app/dashboards/model.go b/pkg/query-service/app/dashboards/model.go index 77b66046c0..0b4dc6847c 100644 --- a/pkg/query-service/app/dashboards/model.go +++ b/pkg/query-service/app/dashboards/model.go @@ -182,9 +182,7 @@ func GetDashboard(uuid string) (*Dashboard, *model.ApiError) { return &dashboard, nil } -func UpdateDashboard(data *map[string]interface{}) (*Dashboard, *model.ApiError) { - - uuid := (*data)["uuid"].(string) +func UpdateDashboard(uuid string, data *map[string]interface{}) (*Dashboard, *model.ApiError) { map_data, err := json.Marshal(data) if err != nil { @@ -224,12 +222,7 @@ func (d *Dashboard) UpdateSlug() { func IsPostDataSane(data *map[string]interface{}) error { - val, ok := (*data)["uuid"] - if !ok || val == nil { - return fmt.Errorf("uuid not found in post data") - } - - val, ok = (*data)["title"] + val, ok := (*data)["title"] if !ok || val == nil { return fmt.Errorf("title not found in post data") } diff --git a/pkg/query-service/app/http_handler.go b/pkg/query-service/app/http_handler.go index 771637935a..f3884127b5 100644 --- a/pkg/query-service/app/http_handler.go +++ b/pkg/query-service/app/http_handler.go @@ -13,10 +13,10 @@ import ( "github.com/prometheus/prometheus/promql" "go.signoz.io/query-service/app/dashboards" "go.signoz.io/query-service/dao/interfaces" + am "go.signoz.io/query-service/integrations/alertManager" "go.signoz.io/query-service/model" "go.signoz.io/query-service/telemetry" "go.signoz.io/query-service/version" - am "go.signoz.io/query-service/integrations/alertManager" "go.uber.org/zap" ) @@ -337,12 +337,7 @@ func (aH *APIHandler) updateDashboard(w http.ResponseWriter, r *http.Request) { return } - if postData["uuid"] != uuid { - aH.respondError(w, &model.ApiError{Typ: model.ErrorBadData, Err: fmt.Errorf("uuid in request param and uuid in request body do not match")}, "Error reading request body") - return - } - - dashboard, apiError := dashboards.UpdateDashboard(&postData) + dashboard, apiError := dashboards.UpdateDashboard(uuid, &postData) if apiError != nil { aH.respondError(w, apiError, nil)