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

@@ -17,6 +17,7 @@ type Repository interface {
Update(item *Item) error
Find(query *ItemQuery) ([]*ItemDTO, error)
Delete(params *DeleteParams) error
FindTags(query *TagsQuery) (FindTagsResult, error)
}
// AnnotationCleaner is responsible for cleaning up old annotations
@@ -40,6 +41,28 @@ type ItemQuery struct {
Limit int64 `json:"limit"`
}
type TagsQuery struct {
OrgID int64 `json:"orgId"`
Tag string `json:"tag"`
Limit int64 `json:"limit"`
}
type Tags struct {
Key string
Value string
Count int64
}
type TagsDTO struct {
Tag string `json:"tag"`
Count int64 `json:"count"`
}
type FindTagsResult struct {
Tags []*TagsDTO `json:"tags"`
}
type DeleteParams struct {
OrgId int64
Id int64