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) FindPerformer(ctx context.Context, id string) (*models.Performer, error) {
|
|
|
|
qb := models.NewPerformerQueryBuilder()
|
|
|
|
idInt, _ := strconv.Atoi(id)
|
|
|
|
return qb.Find(idInt)
|
|
|
|
}
|
|
|
|
|
2019-03-26 15:35:06 +00:00
|
|
|
func (r *queryResolver) FindPerformers(ctx context.Context, performerFilter *models.PerformerFilterType, filter *models.FindFilterType) (*models.FindPerformersResultType, error) {
|
2019-02-09 12:30:49 +00:00
|
|
|
qb := models.NewPerformerQueryBuilder()
|
2019-03-26 15:35:06 +00:00
|
|
|
performers, total := qb.Query(performerFilter, filter)
|
|
|
|
return &models.FindPerformersResultType{
|
2019-02-14 22:53:32 +00:00
|
|
|
Count: total,
|
2019-02-09 12:30:49 +00:00
|
|
|
Performers: performers,
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2019-05-27 19:34:26 +00:00
|
|
|
func (r *queryResolver) AllPerformers(ctx context.Context) ([]*models.Performer, error) {
|
2019-02-09 12:30:49 +00:00
|
|
|
qb := models.NewPerformerQueryBuilder()
|
|
|
|
return qb.All()
|
2019-02-14 22:53:32 +00:00
|
|
|
}
|