Chore: Deprecate FolderID in Hit (#77623)

* Chore: Deprecate FolderID in Hit

* chore: regen specs

* chore: remove accidental deprecation comment
This commit is contained in:
Kat Yang 2023-11-07 09:51:54 -05:00 committed by GitHub
parent a5044fe6db
commit 71dd335bf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 17 deletions

View File

@ -452,6 +452,7 @@ func TestIntegrationDashboardDataAccess(t *testing.T) {
hit := hits[0]
require.Equal(t, hit.ID, savedDash.ID)
require.Equal(t, hit.URL, fmt.Sprintf("/d/%s/%s", savedDash.UID, savedDash.Slug))
// nolint:staticcheck
require.Equal(t, hit.FolderID, savedFolder.ID)
require.Equal(t, hit.FolderUID, savedFolder.UID)
require.Equal(t, hit.FolderTitle, savedFolder.Title)
@ -479,6 +480,7 @@ func TestIntegrationDashboardDataAccess(t *testing.T) {
hit := hits[0]
require.Equal(t, hit.ID, savedDash.ID)
require.Equal(t, hit.URL, fmt.Sprintf("/d/%s/%s", savedDash.UID, savedDash.Slug))
// nolint:staticcheck
require.Equal(t, hit.FolderID, savedFolder.ID)
require.Equal(t, hit.FolderUID, savedFolder.UID)
require.Equal(t, hit.FolderTitle, savedFolder.Title)
@ -1231,7 +1233,7 @@ func makeQueryResult(query *dashboards.FindPersistedDashboardsQuery, res []dashb
URI: "db/" + item.Slug,
URL: dashboards.GetDashboardFolderURL(item.IsFolder, item.UID, item.Slug),
Type: hitType,
FolderID: item.FolderID,
FolderID: item.FolderID, // nolint:staticcheck
FolderUID: item.FolderUID,
FolderTitle: item.FolderTitle,
Tags: []string{},

View File

@ -558,7 +558,7 @@ func makeQueryResult(query *dashboards.FindPersistedDashboardsQuery, res []dashb
URI: "db/" + item.Slug,
URL: dashboards.GetDashboardFolderURL(item.IsFolder, item.UID, item.Slug),
Type: getHitType(item),
FolderID: item.FolderID,
FolderID: item.FolderID, // nolint:staticcheck
FolderUID: item.FolderUID,
FolderTitle: item.FolderTitle,
Tags: []string{},

View File

@ -62,21 +62,22 @@ const (
)
type Hit struct {
ID int64 `json:"id"`
UID string `json:"uid"`
Title string `json:"title"`
URI string `json:"uri"`
URL string `json:"url"`
Slug string `json:"slug"`
Type HitType `json:"type"`
Tags []string `json:"tags"`
IsStarred bool `json:"isStarred"`
FolderID int64 `json:"folderId,omitempty"`
FolderUID string `json:"folderUid,omitempty"`
FolderTitle string `json:"folderTitle,omitempty"`
FolderURL string `json:"folderUrl,omitempty"`
SortMeta int64 `json:"sortMeta"`
SortMetaName string `json:"sortMetaName,omitempty"`
ID int64 `json:"id"`
UID string `json:"uid"`
Title string `json:"title"`
URI string `json:"uri"`
URL string `json:"url"`
Slug string `json:"slug"`
Type HitType `json:"type"`
Tags []string `json:"tags"`
IsStarred bool `json:"isStarred"`
// Deprecated: use FolderUID instead
FolderID int64 `json:"folderId,omitempty"`
FolderUID string `json:"folderUid,omitempty"`
FolderTitle string `json:"folderTitle,omitempty"`
FolderURL string `json:"folderUrl,omitempty"`
SortMeta int64 `json:"sortMeta"`
SortMetaName string `json:"sortMetaName,omitempty"`
}
type HitList []*Hit

View File

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

View File

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