2021-04-15 00:46:31 +00:00
|
|
|
package gallery
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strconv"
|
|
|
|
|
|
|
|
"github.com/stashapp/stash/pkg/models"
|
|
|
|
)
|
|
|
|
|
|
|
|
func CountByPerformerID(r models.GalleryReader, id int) (int, error) {
|
|
|
|
filter := &models.GalleryFilterType{
|
|
|
|
Performers: &models.MultiCriterionInput{
|
|
|
|
Value: []string{strconv.Itoa(id)},
|
|
|
|
Modifier: models.CriterionModifierIncludes,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
return r.QueryCount(filter, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
func CountByStudioID(r models.GalleryReader, id int) (int, error) {
|
|
|
|
filter := &models.GalleryFilterType{
|
2021-06-03 10:52:19 +00:00
|
|
|
Studios: &models.HierarchicalMultiCriterionInput{
|
2021-04-15 00:46:31 +00:00
|
|
|
Value: []string{strconv.Itoa(id)},
|
|
|
|
Modifier: models.CriterionModifierIncludes,
|
2021-06-03 10:52:19 +00:00
|
|
|
Depth: 0,
|
2021-04-15 00:46:31 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
return r.QueryCount(filter, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
func CountByTagID(r models.GalleryReader, id int) (int, error) {
|
|
|
|
filter := &models.GalleryFilterType{
|
|
|
|
Tags: &models.MultiCriterionInput{
|
|
|
|
Value: []string{strconv.Itoa(id)},
|
|
|
|
Modifier: models.CriterionModifierIncludes,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
return r.QueryCount(filter, nil)
|
|
|
|
}
|