mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Add scene/image/gallery popover count buttons for performer/studio/tag cards (#1293)
* Add counts to graphql schema * Add count resolvers and query refactor * Add count popover buttons
This commit is contained in:
40
pkg/gallery/query.go
Normal file
40
pkg/gallery/query.go
Normal file
@@ -0,0 +1,40 @@
|
||||
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{
|
||||
Studios: &models.MultiCriterionInput{
|
||||
Value: []string{strconv.Itoa(id)},
|
||||
Modifier: models.CriterionModifierIncludes,
|
||||
},
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user