stash/api/resolver_query_find_perform...

27 lines
799 B
Go
Raw Normal View History

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) FindPerformer(ctx context.Context, id string) (*models.Performer, error) {
qb := models.NewPerformerQueryBuilder()
idInt, _ := strconv.Atoi(id)
return qb.Find(idInt)
}
func (r *queryResolver) FindPerformers(ctx context.Context, performer_filter *models.PerformerFilterType, filter *models.FindFilterType) (models.FindPerformersResultType, error) {
qb := models.NewPerformerQueryBuilder()
performers, total := qb.Query(performer_filter, filter)
return models.FindPerformersResultType{
Count: total,
Performers: performers,
}, nil
}
func (r *queryResolver) AllPerformers(ctx context.Context) ([]models.Performer, error) {
qb := models.NewPerformerQueryBuilder()
return qb.All()
}