refactor: improve search user collections logic to handle optional keyword

This commit is contained in:
2025-07-31 11:01:49 +08:00
parent 470324221d
commit 40fb3a93b6
3 changed files with 9 additions and 5 deletions

View File

@@ -136,7 +136,7 @@ func ListCollectionResources(collectionID uint, page int) ([]*model.ResourceView
// Search user collections by keyword, limited to 10 results.
// excludedRID: if >0, only return collections not containing this resource.
func SearchUserCollections(username string, keyword string, excludedRID uint) ([]*model.CollectionView, error) {
if username == "" || keyword == "" {
if username == "" {
return nil, errors.New("invalid parameters")
}
user, err := dao.GetUserByUsername(username)