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) FindStudio(ctx context.Context, id string) (*models.Studio, error) {
|
|
|
|
qb := models.NewStudioQueryBuilder()
|
|
|
|
idInt, _ := strconv.Atoi(id)
|
|
|
|
return qb.Find(idInt, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *queryResolver) FindStudios(ctx context.Context, filter *models.FindFilterType) (models.FindStudiosResultType, error) {
|
|
|
|
qb := models.NewStudioQueryBuilder()
|
|
|
|
studios, total := qb.Query(filter)
|
|
|
|
return models.FindStudiosResultType{
|
2019-02-14 22:53:32 +00:00
|
|
|
Count: total,
|
2019-02-09 12:30:49 +00:00
|
|
|
Studios: studios,
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *queryResolver) AllStudios(ctx context.Context) ([]models.Studio, error) {
|
|
|
|
qb := models.NewStudioQueryBuilder()
|
|
|
|
return qb.All()
|
2019-02-14 22:53:32 +00:00
|
|
|
}
|