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{
|
2019-02-14 22:53:32 +00:00
|
|
|
Count: total,
|
2019-02-09 12:30:49 +00:00
|
|
|
Galleries: galleries,
|
|
|
|
}, nil
|
2019-02-14 22:53:32 +00:00
|
|
|
}
|