2019-02-09 12:30:49 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"strconv"
|
2020-06-21 11:43:57 +00:00
|
|
|
|
|
|
|
"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)
|
2020-10-12 23:12:46 +00:00
|
|
|
return qb.Find(idInt, nil)
|
2019-02-09 12:30:49 +00:00
|
|
|
}
|
|
|
|
|
2020-06-21 11:43:57 +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()
|
2020-06-21 11:43:57 +00:00
|
|
|
galleries, total := qb.Query(galleryFilter, 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
|
|
|
}
|