stash/api/resolver_query_find_gallery.go

22 lines
571 B
Go
Raw Normal View History

2019-02-09 12:30:49 +00:00
package api
import (
"context"
2019-02-10 02:53:08 +00:00
"github.com/stashapp/stash/models"
2019-02-09 12:30:49 +00:00
"strconv"
)
func (r *queryResolver) FindGallery(ctx context.Context, id string) (*models.Gallery, error) {
qb := models.NewGalleryQueryBuilder()
idInt, _ := strconv.Atoi(id)
return qb.Find(idInt)
}
func (r *queryResolver) FindGalleries(ctx context.Context, filter *models.FindFilterType) (models.FindGalleriesResultType, error) {
qb := models.NewGalleryQueryBuilder()
galleries, total := qb.Query(filter)
return models.FindGalleriesResultType{
Count: total,
Galleries: galleries,
}, nil
}