diff --git a/front/src/models/index.ts b/front/src/models/index.ts index 3b6e3bd5..ce3582d3 100644 --- a/front/src/models/index.ts +++ b/front/src/models/index.ts @@ -4,6 +4,7 @@ export * from "./kyoo-error"; export * from "./movie"; export * from "./serie"; export * from "./collection"; +export * from "./show"; export * from "./entry"; export * from "./studio"; export * from "./video"; diff --git a/front/src/models/resources/library-item.ts b/front/src/models/resources/library-item.ts deleted file mode 100644 index bafd669a..00000000 --- a/front/src/models/resources/library-item.ts +++ /dev/null @@ -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; diff --git a/front/src/models/show.ts b/front/src/models/show.ts new file mode 100644 index 00000000..8ccf11b5 --- /dev/null +++ b/front/src/models/show.ts @@ -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") })), +]);