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 { db } from "~/db";
import { import {
entries, entries,
@ -6,10 +6,10 @@ import {
entryVideoJoin, entryVideoJoin,
profiles, profiles,
showStudioJoin, showStudioJoin,
showTranslations,
shows, shows,
studioTranslations, showTranslations,
studios, studios,
studioTranslations,
videos, videos,
} from "~/db/schema"; } from "~/db/schema";
import { watchlist } from "~/db/schema/watchlist"; import { watchlist } from "~/db/schema/watchlist";
@ -26,12 +26,12 @@ import type { MovieStatus } from "~/models/movie";
import { SerieStatus, type SerieTranslation } from "~/models/serie"; import { SerieStatus, type SerieTranslation } from "~/models/serie";
import type { Studio } from "~/models/studio"; import type { Studio } from "~/models/studio";
import { import {
buildRelations,
type FilterDef, type FilterDef,
Genre, Genre,
type Image, type Image,
Sort,
buildRelations,
keysetPaginate, keysetPaginate,
Sort,
sortToSql, sortToSql,
} from "~/models/utils"; } from "~/models/utils";
import type { EmbeddedVideo } from "~/models/video"; import type { EmbeddedVideo } from "~/models/video";
@ -49,6 +49,11 @@ export const watchStatusQ = db
.as("watchstatus"); .as("watchstatus");
export const showFilters: FilterDef = { export const showFilters: FilterDef = {
kind: {
column: shows.kind,
type: "enum",
values: ["serie", "movie", "collection"],
},
genres: { genres: {
column: shows.genres, column: shows.genres,
type: "enum", type: "enum",