Alerting NG: update API to expect UIDs instead of IDs (#29896)
* Change API to expect UIDs instead of ID * Remove unnecessary transactions When only one query is executed * Modify API responses * Cleanup tests * Use globally orgID and UID for identifying alert definitions
This commit is contained in:
@@ -5,10 +5,10 @@ import (
|
||||
)
|
||||
|
||||
func (ng *AlertNG) validateOrgAlertDefinition(c *models.ReqContext) {
|
||||
id := c.ParamsInt64(":alertDefinitionId")
|
||||
query := getAlertDefinitionByIDQuery{ID: id}
|
||||
uid := c.ParamsEscape(":alertDefinitionUID")
|
||||
query := getAlertDefinitionByUIDQuery{UID: uid, OrgID: c.SignedInUser.OrgId}
|
||||
|
||||
if err := ng.getAlertDefinitionByID(&query); err != nil {
|
||||
if err := ng.getAlertDefinitionByUID(&query); err != nil {
|
||||
c.JsonApiErr(404, "Alert definition not found", nil)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user