Only specify kind in movie/serie/collection in /shows

This commit is contained in:
Zoe Roux 2025-03-08 15:47:18 +01:00
parent 74f2229dcd
commit 3f188e27a1
No known key found for this signature in database
4 changed files with 6 additions and 5 deletions

View File

@ -13,7 +13,6 @@ import {
} from "./utils";
const BaseCollection = t.Object({
kind: t.Literal("collection"),
genres: t.Array(Genre),
rating: t.Nullable(t.Integer({ minimum: 0, maximum: 100 })),
startAir: t.Nullable(

View File

@ -1,5 +1,5 @@
import { t } from "elysia";
import { type Prettify, comment } from "~/utils";
import type { Prettify } from "~/utils";
import { SeedCollection } from "./collections";
import { bubble, bubbleImages, registerExamples } from "./examples";
import { SeedStudio, Studio } from "./studio";
@ -20,7 +20,6 @@ export const MovieStatus = t.UnionEnum(["unknown", "finished", "planned"]);
export type MovieStatus = typeof MovieStatus.static;
const BaseMovie = t.Object({
kind: t.Literal("movie"),
genres: t.Array(Genre),
rating: t.Nullable(t.Integer({ minimum: 0, maximum: 100 })),
status: MovieStatus,

View File

@ -26,7 +26,6 @@ export const SerieStatus = t.UnionEnum([
export type SerieStatus = typeof SerieStatus.static;
const BaseSerie = t.Object({
kind: t.Literal("serie"),
genres: t.Array(Genre),
rating: t.Nullable(t.Integer({ minimum: 0, maximum: 100 })),
status: SerieStatus,

View File

@ -3,4 +3,8 @@ import { Collection } from "./collections";
import { Movie } from "./movie";
import { Serie } from "./serie";
export const Show = t.Union([Movie, Serie, Collection]);
export const Show = t.Union([
t.Intersect([Movie, t.Object({ kind: t.Literal("movie") })]),
t.Intersect([Serie, t.Object({ kind: t.Literal("serie") })]),
t.Intersect([Collection, t.Object({ kind: t.Literal("collection") })]),
]);