Annotations: Adds tags endpoint (#36199)

* Annotations: Adds tags endpoint

* Chore: fixes sql  statement

* Refactor: adds count to the api

* Chore: changes after PR comments

* Refactor: changes after PR comments
This commit is contained in:
Hugo Häggmark
2021-06-30 13:42:54 +02:00
committed by GitHub
parent 1490c255f1
commit 63f9231de1
6 changed files with 137 additions and 0 deletions

View File

@@ -288,3 +288,19 @@ func canSave(c *models.ReqContext, repo annotations.Repository, annotationID int
return nil
}
func GetAnnotationTags(c *models.ReqContext) response.Response {
query := &annotations.TagsQuery{
OrgID: c.OrgId,
Tag: c.Query("tag"),
Limit: c.QueryInt64("limit"),
}
repo := annotations.GetRepository()
result, err := repo.FindTags(query)
if err != nil {
return response.Error(500, "Failed to find annotation tags", err)
}
return response.JSON(200, util.DynMap{"result": result})
}