Add show type

This commit is contained in:
Zoe Roux 2025-06-20 17:30:10 +02:00
parent 6823642e33
commit 9498dea3fd
No known key found for this signature in database
3 changed files with 11 additions and 24 deletions

View File

@ -4,6 +4,7 @@ export * from "./kyoo-error";
export * from "./movie"; export * from "./movie";
export * from "./serie"; export * from "./serie";
export * from "./collection"; export * from "./collection";
export * from "./show";
export * from "./entry"; export * from "./entry";
export * from "./studio"; export * from "./studio";
export * from "./video"; export * from "./video";

View File

@ -1,24 +0,0 @@
import { z } from "zod";
import { CollectionP } from "./collection";
import { MovieP } from "./movie";
import { ShowP } from "./show";
export const LibraryItemP = z.union([
/*
* Either a Show
*/
ShowP,
/*
* Or a Movie
*/
MovieP,
/*
* Or a Collection
*/
CollectionP,
]);
/**
* An item that can be contained by a Library (so a Show, a Movie or a Collection).
*/
export type LibraryItem = z.infer<typeof LibraryItemP>;

10
front/src/models/show.ts Normal file
View File

@ -0,0 +1,10 @@
import z from "zod";
import { Collection } from "./collection";
import { Movie } from "./movie";
import { Serie } from "./serie";
export const Show = z.union([
Serie.and(z.object({ kind: z.literal("serie") })),
Movie.and(z.object({ kind: z.literal("movie") })),
Collection.and(z.object({ kind: z.literal("collection") })),
]);