Revert "Nested Folders: Fix fetching a folder by title" (#76469)

Revert "Nested Folders: Fix fetching a folder by title (#74725)"

This reverts commit 0eac9aff7f.
This commit is contained in:
Sofia Papagiannaki
2023-10-12 18:31:49 +03:00
committed by GitHub
parent 29cf60988b
commit bdeb829cf6
4 changed files with 14 additions and 53 deletions
+1 -9
View File
@@ -166,15 +166,7 @@ func (ss *sqlStore) Get(ctx context.Context, q folder.GetFolderQuery) (*folder.F
case q.ID != nil:
exists, err = sess.SQL("SELECT * FROM folder WHERE id = ?", q.ID).Get(foldr)
case q.Title != nil:
args := []any{*q.Title, q.OrgID}
s := "SELECT * FROM folder WHERE title = ? AND org_id = ?"
if q.ParentUID != nil {
s = s + " AND parent_uid = ?"
args = append(args, *q.ParentUID)
} else {
s = s + " AND parent_uid IS NULL"
}
exists, err = sess.SQL(s, args...).Get(foldr)
exists, err = sess.SQL("SELECT * FROM folder WHERE title = ? AND org_id = ?", q.Title, q.OrgID).Get(foldr)
default:
return folder.ErrBadRequest.Errorf("one of ID, UID, or Title must be included in the command")
}