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:
Sofia Papagiannaki
2021-01-07 17:45:42 +02:00
committed by GitHub
parent a6aa0024a2
commit 5560be73bf
9 changed files with 213 additions and 212 deletions
+3 -3
View File
@@ -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
}