1
Fork 0
photoview/api/graphql/resolvers/search.go

20 lines
506 B
Go
Raw Normal View History

2020-03-05 11:53:42 +01:00
package resolvers
import (
"context"
2020-12-19 09:45:43 +01:00
2020-12-18 23:50:29 +01:00
"github.com/photoview/photoview/api/graphql/auth"
2021-09-02 18:09:37 +02:00
"github.com/photoview/photoview/api/graphql/models/actions"
2020-03-05 11:53:42 +01:00
2020-12-17 22:51:43 +01:00
"github.com/photoview/photoview/api/graphql/models"
2020-03-05 11:53:42 +01:00
)
2021-09-02 18:09:37 +02:00
func (r *Resolver) Search(ctx context.Context, query string, limitMedia *int, limitAlbums *int) (*models.SearchResult, error) {
2020-12-18 23:50:29 +01:00
user := auth.UserFromContext(ctx)
if user == nil {
return nil, auth.ErrUnauthorized
}
2020-03-05 11:53:42 +01:00
return actions.Search(r.DB(ctx), query, user.ID, limitMedia, limitAlbums)
2020-03-05 11:53:42 +01:00
}