Allow /api/shows to be filtered by kind

This commit is contained in:
Zoe Roux 2025-06-22 19:28:26 +02:00
parent 16f6399c4f
commit aa5ba7f2a9
No known key found for this signature in database

View File

@ -1,4 +1,4 @@
import { type SQL, and, eq, exists, gt, ne, sql } from "drizzle-orm";
import { and, eq, exists, gt, ne, type SQL, sql } from "drizzle-orm";
import { db } from "~/db";
import {
entries,
@ -6,10 +6,10 @@ import {
entryVideoJoin,
profiles,
showStudioJoin,
showTranslations,
shows,
studioTranslations,
showTranslations,
studios,
studioTranslations,
videos,
} from "~/db/schema";
import { watchlist } from "~/db/schema/watchlist";
@ -26,12 +26,12 @@ import type { MovieStatus } from "~/models/movie";
import { SerieStatus, type SerieTranslation } from "~/models/serie";
import type { Studio } from "~/models/studio";
import {
buildRelations,
type FilterDef,
Genre,
type Image,
Sort,
buildRelations,
keysetPaginate,
Sort,
sortToSql,
} from "~/models/utils";
import type { EmbeddedVideo } from "~/models/video";
@ -49,6 +49,11 @@ export const watchStatusQ = db
.as("watchstatus");
export const showFilters: FilterDef = {
kind: {
column: shows.kind,
type: "enum",
values: ["serie", "movie", "collection"],
},
genres: {
column: shows.genres,
type: "enum",