diff --git a/api/src/models/examples/bubble.ts b/api/src/models/examples/bubble.ts index 3e9c3850..27b469ad 100644 --- a/api/src/models/examples/bubble.ts +++ b/api/src/models/examples/bubble.ts @@ -1,4 +1,15 @@ import type { SeedMovie } from "../movie"; +import type { Video } from "../video"; + +export const bubbleVideo: Video = { + id: "3cd436ee-01ff-4f45-ba98-62aabeb22f25", + slug: "bubble", + path: "/video/Bubble/Bubble (2022).mkv", + rendering: "459429fa062adeebedcc2bb04b9965de0262bfa453369783132d261be79021bd", + part: null, + version: 1, + createdAt: "2024-11-23T15:01:24.968Z", +}; export const bubble: SeedMovie = { slug: "bubble", @@ -35,15 +46,7 @@ export const bubble: SeedMovie = { link: "https://www.imdb.com/title/tt16360006", }, }, - videos: [ - { - path: "/video/Bubble/Bubble (2022).mkv", - rendering: - "459429fa062adeebedcc2bb04b9965de0262bfa453369783132d261be79021bd", - part: null, - version: 1, - }, - ], + videos: [bubbleVideo.id], }; export const bubbleImages = { diff --git a/api/src/models/examples/index.ts b/api/src/models/examples/index.ts index 16bdb874..2d917578 100644 --- a/api/src/models/examples/index.ts +++ b/api/src/models/examples/index.ts @@ -30,5 +30,5 @@ export const registerExamples = ( } }; -export { bubble } from "./bubble"; -export { madeInAbyss } from "./made-in-abyss"; +export * from "./bubble"; +export * from "./made-in-abyss"; diff --git a/api/src/models/movie.ts b/api/src/models/movie.ts index d5036079..984f67c7 100644 --- a/api/src/models/movie.ts +++ b/api/src/models/movie.ts @@ -66,7 +66,7 @@ export const SeedMovie = t.Intersect([ minProperties: 1, }, ), - videos: t.Optional(t.Array(SeedVideo)), + videos: t.Optional(t.Array(t.String({ format: "uuid" }))), }), ]); export type SeedMovie = typeof SeedMovie.static; diff --git a/api/src/models/video.ts b/api/src/models/video.ts index 12346e50..bf3bbde1 100644 --- a/api/src/models/video.ts +++ b/api/src/models/video.ts @@ -1,5 +1,6 @@ import { t } from "elysia"; import { comment } from "../utils"; +import { registerExamples, bubbleVideo } from "./examples"; export const Video = t.Object({ id: t.String({ format: "uuid" }), @@ -31,10 +32,7 @@ export const Video = t.Object({ createdAt: t.String({ format: "date-time" }), }); - export type Video = typeof Video.static; +registerExamples(Video, bubbleVideo); -export const SeedVideo = t.Union([ - t.Omit(Video, ["id", "slug", "createdAt"]), - t.String({ format: "uuid" }), -]); +export const SeedVideo = t.Omit(Video, ["id", "slug", "createdAt"]);