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:
WithoutPants
2021-04-15 10:46:31 +10:00
committed by GitHub
parent e6aaa196f3
commit ea54a67798
27 changed files with 536 additions and 73 deletions

40
pkg/gallery/query.go Normal file
View 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)
}