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)
|
|
|
|
}
|
|
|
|
|
2019-03-26 15:35:06 +00:00
|
|
|
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)
|
2019-03-26 15:35:06 +00:00
|
|
|
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
|
|
|
}
|