Chore: Deprecate ID in GetFolderQuery (#77647)
This commit is contained in:
@@ -123,6 +123,7 @@ func (s *Service) Get(ctx context.Context, cmd *folder.GetFolderQuery) (*folder.
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// nolint:staticcheck
|
||||
case cmd.ID != nil:
|
||||
dashFolder, err = s.getFolderByID(ctx, *cmd.ID, cmd.OrgID)
|
||||
if err != nil {
|
||||
@@ -160,6 +161,7 @@ func (s *Service) Get(ctx context.Context, cmd *folder.GetFolderQuery) (*folder.
|
||||
return dashFolder, nil
|
||||
}
|
||||
|
||||
// nolint:staticcheck
|
||||
if cmd.ID != nil {
|
||||
cmd.ID = nil
|
||||
cmd.UID = &dashFolder.UID
|
||||
|
||||
@@ -102,7 +102,7 @@ func TestIntegrationFolderService(t *testing.T) {
|
||||
|
||||
t.Run("When get folder by id should return access denied error", func(t *testing.T) {
|
||||
_, err := service.Get(context.Background(), &folder.GetFolderQuery{
|
||||
ID: &folderId,
|
||||
ID: &folderId, // nolint:staticcheck
|
||||
OrgID: orgID,
|
||||
SignedInUser: usr,
|
||||
})
|
||||
@@ -112,7 +112,7 @@ func TestIntegrationFolderService(t *testing.T) {
|
||||
var zeroInt int64 = 0
|
||||
t.Run("When get folder by id, with id = 0 should return default folder", func(t *testing.T) {
|
||||
foldr, err := service.Get(context.Background(), &folder.GetFolderQuery{
|
||||
ID: &zeroInt,
|
||||
ID: &zeroInt, // nolint:staticcheck
|
||||
OrgID: orgID,
|
||||
SignedInUser: usr,
|
||||
})
|
||||
@@ -1179,7 +1179,7 @@ func TestNestedFolderService(t *testing.T) {
|
||||
}, dbtest.NewFakeDB())
|
||||
_, err := folderSvc.Get(context.Background(), &folder.GetFolderQuery{
|
||||
OrgID: orgID,
|
||||
ID: &folder.GeneralFolder.ID,
|
||||
ID: &folder.GeneralFolder.ID, // nolint:staticcheck
|
||||
SignedInUser: usr,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -67,7 +67,7 @@ func (ss *sqlStore) Create(ctx context.Context, cmd folder.CreateFolderCommand)
|
||||
}
|
||||
|
||||
foldr, err = ss.Get(ctx, folder.GetFolderQuery{
|
||||
ID: &lastInsertedID,
|
||||
ID: &lastInsertedID, // nolint:staticcheck
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -164,6 +164,7 @@ func (ss *sqlStore) Get(ctx context.Context, q folder.GetFolderQuery) (*folder.F
|
||||
switch {
|
||||
case q.UID != nil:
|
||||
exists, err = sess.SQL("SELECT * FROM folder WHERE uid = ? AND org_id = ?", q.UID, q.OrgID).Get(foldr)
|
||||
// nolint:staticcheck
|
||||
case q.ID != nil:
|
||||
exists, err = sess.SQL("SELECT * FROM folder WHERE id = ?", q.ID).Get(foldr)
|
||||
case q.Title != nil:
|
||||
|
||||
@@ -431,7 +431,7 @@ func TestIntegrationGet(t *testing.T) {
|
||||
|
||||
t.Run("get folder by title should succeed", func(t *testing.T) {
|
||||
ff, err := folderStore.Get(context.Background(), folder.GetFolderQuery{
|
||||
ID: &f.ID,
|
||||
ID: &f.ID, // nolint:staticcheck
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, f.ID, ff.ID)
|
||||
|
||||
Reference in New Issue
Block a user