Chore: Deprecate FolderID in LibraryElementDTO (#77471)

* Chore: Deprecate FolderID in LibraryElementDTO

* chore: fix formatting of deprecation comment

* chore: revert deprecation comment formatting

* chore: regen specs
This commit is contained in:
Kat Yang
2023-11-06 11:30:32 -05:00
committed by GitHub
parent 8aa5d470ca
commit dd5314c6a8
5 changed files with 9 additions and 4 deletions

View File

@ -81,6 +81,7 @@ func (l *LibraryElementService) createHandler(c *contextmodel.ReqContext) respon
return toLibraryElementError(err, "Failed to create library element")
}
// nolint:staticcheck
if element.FolderID != 0 {
folder, err := l.folderService.Get(c.Req.Context(), &folder.GetFolderQuery{OrgID: c.SignedInUser.GetOrgID(), ID: &element.FolderID, SignedInUser: c.SignedInUser})
if err != nil {
@ -223,6 +224,7 @@ func (l *LibraryElementService) patchHandler(c *contextmodel.ReqContext) respons
return toLibraryElementError(err, "Failed to update library element")
}
// nolint:staticcheck
if element.FolderID != 0 {
folder, err := l.folderService.Get(c.Req.Context(), &folder.GetFolderQuery{OrgID: c.SignedInUser.GetOrgID(), ID: &element.FolderID, SignedInUser: c.SignedInUser})
if err != nil {

View File

@ -69,8 +69,9 @@ type LibraryElementWithMeta struct {
// LibraryElementDTO is the frontend DTO for entities.
type LibraryElementDTO struct {
ID int64 `json:"id"`
OrgID int64 `json:"orgId"`
ID int64 `json:"id"`
OrgID int64 `json:"orgId"`
// Deprecated: use FolderUID instead
FolderID int64 `json:"folderId"`
FolderUID string `json:"folderUid"`
UID string `json:"uid"`

View File

@ -638,7 +638,7 @@ func toLibraryElement(t *testing.T, res model.LibraryElementDTO) libraryElement
return libraryElement{
ID: res.ID,
OrgID: res.OrgID,
FolderID: res.FolderID,
FolderID: res.FolderID, // nolint:staticcheck
UID: res.UID,
Name: res.Name,
Type: res.Type,
@ -785,7 +785,7 @@ func scenarioWithLibraryPanel(t *testing.T, desc string, fn func(t *testing.T, s
Result: libraryPanel{
ID: resp.ID,
OrgID: resp.OrgID,
FolderID: resp.FolderID,
FolderID: resp.FolderID, // nolint:staticcheck
UID: resp.UID,
Name: resp.Name,
Type: resp.Type,

View File

@ -15761,6 +15761,7 @@
"type": "string"
},
"folderId": {
"description": "Deprecated: use FolderUID instead",
"type": "integer",
"format": "int64"
},

View File

@ -6673,6 +6673,7 @@
"type": "string"
},
"folderId": {
"description": "Deprecated: use FolderUID instead",
"format": "int64",
"type": "integer"
},