From 19134c892e941be67eba8aea7e99b0b75f76a61c Mon Sep 17 00:00:00 2001 From: Gykes <24581046+Gykes@users.noreply.github.com> Date: Sat, 29 Nov 2025 00:38:12 -0800 Subject: [PATCH] Studio ID Count --- graphql/schema/types/filters.graphql | 2 ++ pkg/models/scene.go | 2 ++ pkg/sqlite/scene_filter.go | 12 ++++++++++++ ui/v2.5/src/locales/en-GB.json | 1 + ui/v2.5/src/models/list-filter/scenes.ts | 1 + ui/v2.5/src/models/list-filter/types.ts | 1 + 6 files changed, 19 insertions(+) diff --git a/graphql/schema/types/filters.graphql b/graphql/schema/types/filters.graphql index 4eb91aa77..9b83c6fd5 100644 --- a/graphql/schema/types/filters.graphql +++ b/graphql/schema/types/filters.graphql @@ -292,6 +292,8 @@ input SceneFilterType { performer_count: IntCriterionInput "Filter by StashID" stash_id_endpoint: StashIDCriterionInput + "Filter by StashID count" + stash_id_count: IntCriterionInput "Filter by url" url: StringCriterionInput "Filter by interactive" diff --git a/pkg/models/scene.go b/pkg/models/scene.go index f0a863bf7..a609f7ba3 100644 --- a/pkg/models/scene.go +++ b/pkg/models/scene.go @@ -79,6 +79,8 @@ type SceneFilterType struct { StashID *StringCriterionInput `json:"stash_id"` // Filter by StashID Endpoint StashIDEndpoint *StashIDCriterionInput `json:"stash_id_endpoint"` + // Filter by StashID count + StashIDCount *IntCriterionInput `json:"stash_id_count"` // Filter by url URL *StringCriterionInput `json:"url"` // Filter by interactive diff --git a/pkg/sqlite/scene_filter.go b/pkg/sqlite/scene_filter.go index fad300248..1fca5736c 100644 --- a/pkg/sqlite/scene_filter.go +++ b/pkg/sqlite/scene_filter.go @@ -122,6 +122,8 @@ func (qb *sceneFilterHandler) criterionHandler() criterionHandler { parentIDCol: "scenes.id", }, + qb.stashIDCountCriterionHandler(sceneFilter.StashIDCount), + boolCriterionHandler(sceneFilter.Interactive, "video_files.interactive", qb.addVideoFilesTable), intCriterionHandler(sceneFilter.InteractiveSpeed, "video_files.interactive_speed", qb.addVideoFilesTable), @@ -436,6 +438,16 @@ func (qb *sceneFilterHandler) tagCountCriterionHandler(tagCount *models.IntCrite return h.handler(tagCount) } +func (qb *sceneFilterHandler) stashIDCountCriterionHandler(stashIDCount *models.IntCriterionInput) criterionHandlerFunc { + h := countCriterionHandlerBuilder{ + primaryTable: sceneTable, + joinTable: "scene_stash_ids", + primaryFK: sceneIDColumn, + } + + return h.handler(stashIDCount) +} + func (qb *sceneFilterHandler) performersCriterionHandler(performers *models.MultiCriterionInput) criterionHandlerFunc { h := joinedMultiCriterionHandlerBuilder{ primaryTable: sceneTable, diff --git a/ui/v2.5/src/locales/en-GB.json b/ui/v2.5/src/locales/en-GB.json index 37ef0d12b..73ec20ccb 100644 --- a/ui/v2.5/src/locales/en-GB.json +++ b/ui/v2.5/src/locales/en-GB.json @@ -1453,6 +1453,7 @@ "welcome_to_stash": "Welcome to Stash" }, "stash_id": "Stash ID", + "stash_id_count": "Stash ID Count", "stash_id_endpoint": "Stash ID Endpoint", "stash_ids": "Stash IDs", "stashbox_search": { diff --git a/ui/v2.5/src/models/list-filter/scenes.ts b/ui/v2.5/src/models/list-filter/scenes.ts index cf2791567..aa8000a53 100644 --- a/ui/v2.5/src/models/list-filter/scenes.ts +++ b/ui/v2.5/src/models/list-filter/scenes.ts @@ -132,6 +132,7 @@ const criterionOptions = [ GalleriesCriterionOption, createStringCriterionOption("url"), StashIDCriterionOption, + createMandatoryNumberCriterionOption("stash_id_count"), InteractiveCriterionOption, CaptionsCriterionOption, createMandatoryNumberCriterionOption("interactive_speed"), diff --git a/ui/v2.5/src/models/list-filter/types.ts b/ui/v2.5/src/models/list-filter/types.ts index 83ebaa010..bf5fff4d9 100644 --- a/ui/v2.5/src/models/list-filter/types.ts +++ b/ui/v2.5/src/models/list-filter/types.ts @@ -200,6 +200,7 @@ export type CriterionType = | "ignore_auto_tag" | "file_count" | "stash_id_endpoint" + | "stash_id_count" | "date" | "created_at" | "updated_at"