stash/pkg/api/resolver_query_find_gallery.go

24 lines
644 B
Go
Raw Normal View History

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