From 0f31286058ecdc2398b84a9f5ff0666ab095cee4 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sun, 29 Mar 2026 12:16:50 +0200 Subject: [PATCH] Add `studios` and `staff` filters for shows --- api/src/controllers/shows/logic.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/api/src/controllers/shows/logic.ts b/api/src/controllers/shows/logic.ts index 40627702..b7e1b1ea 100644 --- a/api/src/controllers/shows/logic.ts +++ b/api/src/controllers/shows/logic.ts @@ -5,9 +5,11 @@ import { entries, entryVideoJoin, profiles, + roles, showStudioJoin, shows, showTranslations, + staff, studios, studioTranslations, videos, @@ -92,6 +94,24 @@ export const showFilters: FilterDef = { type: "int", }, nextRefresh: { column: shows.nextRefresh, type: "date" }, + studios: { + column: db + .select({ slug: studios.slug }) + .from(showStudioJoin) + .innerJoin(studios, eq(studios.pk, showStudioJoin.studioPk)) + .where(eq(showStudioJoin.showPk, shows.pk)), + type: "string", + isArray: true, + }, + staff: { + column: db + .select({ slug: staff.slug }) + .from(roles) + .innerJoin(staff, eq(staff.pk, roles.staffPk)) + .where(eq(roles.showPk, shows.pk)), + type: "string", + isArray: true, + }, }; export const showSort = Sort( {