Rename Id to ID for annotation models (#62886)

* Rename Id to ID for annotation models

* Add xorm tags

* Rename Id to ID for API key models

* Add xorm tags
This commit is contained in:
idafurjes
2023-02-03 17:23:09 +01:00
committed by GitHub
parent a0602a2a78
commit 982939111b
34 changed files with 367 additions and 367 deletions

View File

@@ -22,12 +22,12 @@ func (repo *fakeAnnotationsRepo) Delete(_ context.Context, params *annotations.D
repo.mtx.Lock()
defer repo.mtx.Unlock()
if params.Id != 0 {
delete(repo.annotations, params.Id)
if params.ID != 0 {
delete(repo.annotations, params.ID)
} else {
for _, v := range repo.annotations {
if params.DashboardId == v.DashboardId && params.PanelId == v.PanelId {
delete(repo.annotations, v.Id)
if params.DashboardID == v.DashboardID && params.PanelID == v.PanelID {
delete(repo.annotations, v.ID)
}
}
}
@@ -39,10 +39,10 @@ func (repo *fakeAnnotationsRepo) Save(ctx context.Context, item *annotations.Ite
repo.mtx.Lock()
defer repo.mtx.Unlock()
if item.Id == 0 {
item.Id = int64(len(repo.annotations) + 1)
if item.ID == 0 {
item.ID = int64(len(repo.annotations) + 1)
}
repo.annotations[item.Id] = *item
repo.annotations[item.ID] = *item
return nil
}
@@ -52,10 +52,10 @@ func (repo *fakeAnnotationsRepo) SaveMany(ctx context.Context, items []annotatio
defer repo.mtx.Unlock()
for _, i := range items {
if i.Id == 0 {
i.Id = int64(len(repo.annotations) + 1)
if i.ID == 0 {
i.ID = int64(len(repo.annotations) + 1)
}
repo.annotations[i.Id] = i
repo.annotations[i.ID] = i
}
return nil
@@ -69,10 +69,10 @@ func (repo *fakeAnnotationsRepo) Find(_ context.Context, query *annotations.Item
repo.mtx.Lock()
defer repo.mtx.Unlock()
if annotation, has := repo.annotations[query.AnnotationId]; has {
return []*annotations.ItemDTO{{Id: annotation.Id, DashboardId: annotation.DashboardId}}, nil
if annotation, has := repo.annotations[query.AnnotationID]; has {
return []*annotations.ItemDTO{{ID: annotation.ID, DashboardID: annotation.DashboardID}}, nil
}
annotations := []*annotations.ItemDTO{{Id: 1, DashboardId: 0}}
annotations := []*annotations.ItemDTO{{ID: 1, DashboardID: 0}}
return annotations, nil
}