stash/pkg/api/resolver_query_find_gallery.go

23 lines
582 B
Go
Raw Normal View History

2019-02-09 12:30:49 +00:00
package api
import (
"context"
2019-02-14 23:42:52 +00:00
"github.com/stashapp/stash/pkg/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) {
2019-02-09 12:30:49 +00:00
qb := models.NewGalleryQueryBuilder()
galleries, total := qb.Query(filter)
return &models.FindGalleriesResultType{
Count: total,
2019-02-09 12:30:49 +00:00
Galleries: galleries,
}, nil
}