diff --git a/api/src/models/examples.ts b/api/src/models/examples.ts new file mode 100644 index 00000000..25f2f765 --- /dev/null +++ b/api/src/models/examples.ts @@ -0,0 +1,58 @@ +import type { CompleteVideo } from "./video"; + +export const bubble: CompleteVideo = { + id: "0934da28-4a49-404e-920b-a150404a3b6d", + path: "/video/Bubble/Bubble (2022).mkv", + rendering: 0, + part: 0, + version: 1, + createdAt: "2023-11-29T11:42:06.030838Z", + movie: { + id: "008f0b42-61b8-4155-857a-cbe5f40dd35d", + slug: "bubble", + name: "Bubble", + tagline: "Is she a calamity or a blessing?", + description: + "In an abandoned Tokyo overrun by bubbles and gravitational abnormalities, one gifted young man has a fateful meeting with a mysterious girl.", + aliases: ["Baburu", "バブル:2022", "Bubble"], + tags: ["adolescence", "disaster", "battle", "gravity", "anime"], + genres: ["animation", "adventure", "science-fiction", "fantasy"], + rating: 74, + status: "finished", + runtime: 101, + airDate: "2022-02-14", + originalLanguage: null, + poster: { + id: "befdc7dd-2a67-0704-92af-90d49eee0315", + source: + "https://image.tmdb.org/t/p/original/65dad96VE8FJPEdrAkhdsuWMWH9.jpg", + blurhash: "LFC@2F;K$%xZ5?W.MwNF0iD~MxR:", + }, + thumbnail: { + id: "b29908f3-a64d-ae98-923b-18bf7995ab04", + source: + "https://image.tmdb.org/t/p/original/a8Q2g0g7XzAF6gcB8qgn37ccb9Y.jpg", + blurhash: "LpH3afE1XAveyGS7t6V[R4xZn+S6", + }, + banner: null, + logo: { + id: "3357fad0-de40-4ca5-15e6-eb065d35be86", + source: + "https://image.tmdb.org/t/p/original/ihIs7fayAmZieMlMQbs6TWM77uf.png", + blurhash: "LMDc5#MwE0,sTKE0R*S~4mxunhb_", + }, + trailerUrl: "https://www.youtube.com/watch?v=vs7zsyIZkMM", + createdAt: "2023-11-29T11:42:06.030838Z", + nextRefresh: "2025-01-07T22:40:59.960952Z", + externalId: { + themoviedatabase: { + dataId: "912598", + link: "https://www.themoviedb.org/movie/912598", + }, + imdb: { + dataId: "tt16360006", + link: "https://www.imdb.com/title/tt16360006", + }, + }, + }, +}; diff --git a/api/src/models/movie.ts b/api/src/models/movie.ts index 765ce890..beed9b03 100644 --- a/api/src/models/movie.ts +++ b/api/src/models/movie.ts @@ -2,6 +2,7 @@ import { t } from "elysia"; import { Genre, ShowStatus } from "./show"; import { Image } from "./image"; import { ExternalId } from "./external-id"; +import { bubble } from "./examples"; export const Movie = t.Object({ id: t.String({ format: "uuid" }), @@ -34,9 +35,4 @@ export const Movie = t.Object({ export type Movie = typeof Movie.static; -// Movie.examples = [{ -// slug: "bubble", -// title: "Bubble", -// tagline: "Is she a calamity or a blessing?", -// description: " In an abandoned Tokyo overrun by bubbles and gravitational abnormalities, one gifted young man has a fateful meeting with a mysterious girl. ", -// }] +Movie.examples = [bubble.movie]; diff --git a/api/src/models/video.ts b/api/src/models/video.ts index b2011c92..248c7266 100644 --- a/api/src/models/video.ts +++ b/api/src/models/video.ts @@ -1,4 +1,6 @@ import { t } from "elysia"; +import { Movie } from "./movie"; +import { bubble } from "./examples"; export const Video = t.Object({ id: t.String({ format: "uuid" }), @@ -11,3 +13,20 @@ export const Video = t.Object({ }); export type Video = typeof Video.static; + +Video.examples = [bubble]; + +export const CompleteVideo = t.Intersect([ + Video, + t.Union([ + t.Object({ + movie: Movie, + }), + t.Object({ + // TODO: implement that + episodes: t.Array(t.Object({})), + }), + ]), +]); + +export type CompleteVideo = typeof CompleteVideo.static;