mirror of
https://github.com/stashapp/stash.git
synced 2026-01-13 19:54:09 +01:00
* Add '_all' counts * Use '_all' counts in UI * Make other counts non-nullable * Hide tab counts if zero * Add resolver parameter
28 lines
738 B
Go
28 lines
738 B
Go
package movie
|
|
|
|
import (
|
|
"context"
|
|
"strconv"
|
|
|
|
"github.com/stashapp/stash/pkg/models"
|
|
)
|
|
|
|
type Queryer interface {
|
|
Query(ctx context.Context, movieFilter *models.MovieFilterType, findFilter *models.FindFilterType) ([]*models.Movie, int, error)
|
|
}
|
|
|
|
type CountQueryer interface {
|
|
QueryCount(ctx context.Context, movieFilter *models.MovieFilterType, findFilter *models.FindFilterType) (int, error)
|
|
}
|
|
|
|
func CountByStudioID(ctx context.Context, r CountQueryer, id int, depth *int) (int, error) {
|
|
filter := &models.MovieFilterType{
|
|
Studios: &models.HierarchicalMultiCriterionInput{
|
|
Value: []string{strconv.Itoa(id)},
|
|
Modifier: models.CriterionModifierIncludes,
|
|
Depth: depth,
|
|
},
|
|
}
|
|
|
|
return r.QueryCount(ctx, filter, nil)
|
|
}
|