diff --git a/api/src/models/examples/bubble.ts b/api/src/models/examples/bubble.ts index 0246333c..7ea2399c 100644 --- a/api/src/models/examples/bubble.ts +++ b/api/src/models/examples/bubble.ts @@ -9,6 +9,7 @@ export const bubbleVideo: Video = { part: null, version: 1, createdAt: "2024-11-23T15:01:24.968Z", + updatedAt: "2024-11-23T15:01:24.968Z", }; export const bubble: SeedMovie = { @@ -60,6 +61,7 @@ export const bubble: SeedMovie = { }, }, videos: [bubbleVideo.id], + studios: [], }; export const bubbleImages = { diff --git a/api/src/models/examples/dune-1984.ts b/api/src/models/examples/dune-1984.ts index 6567d8c9..d12b94e1 100644 --- a/api/src/models/examples/dune-1984.ts +++ b/api/src/models/examples/dune-1984.ts @@ -9,6 +9,7 @@ export const dune1984Video: Video = { part: null, version: 1, createdAt: "2024-12-02T11:45:12.968Z", + updatedAt: "2024-12-02T11:45:12.968Z", }; export const dune1984: SeedMovie = { @@ -47,6 +48,7 @@ export const dune1984: SeedMovie = { }, }, videos: [dune1984Video.id], + studios: [], }; export const dune1984Images = { diff --git a/api/src/models/examples/dune-2021.ts b/api/src/models/examples/dune-2021.ts index fa2b017f..d3b7b59f 100644 --- a/api/src/models/examples/dune-2021.ts +++ b/api/src/models/examples/dune-2021.ts @@ -9,6 +9,7 @@ export const duneVideo: Video = { part: null, version: 1, createdAt: "2024-12-02T10:10:24.968Z", + updatedAt: "2024-12-02T10:10:24.968Z", }; export const dune: SeedMovie = { @@ -47,6 +48,7 @@ export const dune: SeedMovie = { }, }, videos: [duneVideo.id], + studios: [], }; export const duneImages = { diff --git a/api/src/models/examples/made-in-abyss.ts b/api/src/models/examples/made-in-abyss.ts index 58be76c4..8ab55617 100644 --- a/api/src/models/examples/made-in-abyss.ts +++ b/api/src/models/examples/made-in-abyss.ts @@ -16,6 +16,7 @@ export const madeInAbyssVideo: Video = { from: "guessit", }, createdAt: "2024-11-23T15:01:24.968Z", + updatedAt: "2024-11-23T15:01:24.968Z", }; export const madeInAbyss = { @@ -242,4 +243,21 @@ export const madeInAbyss = { video: "3cd436ee-01ff-4f45-ba98-654282531234", }, ], + studios: [ + { + slug: "kinema-citrus", + translations: { + en: { + name: "Kinema Citrus", + logo: "https://image.tmdb.org/t/p/original/Lf0udeB7OwHoFJ0XIxVwfyGOqE.png", + }, + }, + externalId: { + themoviedatabase: { + dataId: "16738", + link: "https://www.themoviedb.org/company/16738/movie", + }, + }, + }, + ], } satisfies SeedSerie; diff --git a/api/src/models/movie.ts b/api/src/models/movie.ts index aaae338f..a2d06708 100644 --- a/api/src/models/movie.ts +++ b/api/src/models/movie.ts @@ -3,6 +3,7 @@ import type { Prettify } from "~/utils"; import { SeedCollection } from "./collections"; import { bubble, registerExamples } from "./examples"; import { bubbleImages } from "./examples/bubble"; +import { SeedStudio } from "./studio"; import { ExternalId, Genre, @@ -88,6 +89,7 @@ export const SeedMovie = t.Intersect([ ), videos: t.Optional(t.Array(t.String({ format: "uuid" }))), collection: t.Optional(SeedCollection), + studios: t.Array(SeedStudio), }), ]); export type SeedMovie = Prettify; diff --git a/api/src/models/serie.ts b/api/src/models/serie.ts index cc8ff78e..60d3fd01 100644 --- a/api/src/models/serie.ts +++ b/api/src/models/serie.ts @@ -4,6 +4,7 @@ import { SeedCollection } from "./collections"; import { SeedEntry, SeedExtra } from "./entry"; import { bubbleImages, madeInAbyss, registerExamples } from "./examples"; import { SeedSeason } from "./season"; +import { SeedStudio } from "./studio"; import { ExternalId } from "./utils/external-id"; import { Genre } from "./utils/genres"; import { Image, SeedImage } from "./utils/image"; @@ -18,7 +19,7 @@ export const SerieStatus = t.UnionEnum([ ]); export type SerieStatus = typeof SerieStatus.static; -export const BaseSerie = t.Object({ +const BaseSerie = t.Object({ kind: t.Literal("serie"), genres: t.Array(Genre), rating: t.Nullable(t.Integer({ minimum: 0, maximum: 100 })), @@ -89,6 +90,7 @@ export const SeedSerie = t.Intersect([ entries: t.Array(SeedEntry), extras: t.Optional(t.Array(SeedExtra)), collection: t.Optional(SeedCollection), + studios: t.Array(SeedStudio), }), ]); export type SeedSerie = typeof SeedSerie.static; diff --git a/api/src/models/studio.ts b/api/src/models/studio.ts new file mode 100644 index 00000000..63577817 --- /dev/null +++ b/api/src/models/studio.ts @@ -0,0 +1,35 @@ +import { t } from "elysia"; +import type { Prettify } from "elysia/dist/types"; +import { madeInAbyss, registerExamples } from "./examples"; +import { ExternalId, Resource, TranslationRecord } from "./utils"; +import { Image, SeedImage } from "./utils/image"; + +const BaseStudio = t.Object({ + createdAt: t.String({ format: "date-time" }), + + externalId: ExternalId, +}); + +export const StudioTranslation = t.Object({ + name: t.String(), + logo: t.Nullable(Image), +}); + +export const Studio = t.Intersect([Resource(), StudioTranslation, BaseStudio]); +export type Studio = Prettify; + +export const SeedStudio = t.Intersect([ + t.Omit(BaseStudio, ["createdAt"]), + t.Object({ + slug: t.String({ format: "slug" }), + translations: TranslationRecord( + t.Object({ + name: t.String(), + logo: t.Nullable(SeedImage), + }), + ), + }), +]); +export type SeedStudio = Prettify; + +registerExamples(Studio, madeInAbyss.studios[0]); diff --git a/api/src/models/video.ts b/api/src/models/video.ts index 3fa52afb..fbc2509f 100644 --- a/api/src/models/video.ts +++ b/api/src/models/video.ts @@ -1,4 +1,4 @@ -import { type TSchema, t } from "elysia"; +import { t } from "elysia"; import { comment } from "../utils"; import { bubbleVideo, registerExamples } from "./examples";