Include subsidiary studios/tags in tab badge counters (#3816)

* Add '_all' counts
* Use '_all' counts in UI
* Make other counts non-nullable
* Hide tab counts if zero
* Add resolver parameter
This commit is contained in:
DingDongSoLong4
2023-06-16 02:46:14 +02:00
committed by GitHub
parent 47c3e855c8
commit f65e87773c
32 changed files with 453 additions and 193 deletions

28
pkg/movie/query.go Normal file
View File

@@ -0,0 +1,28 @@
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)
}