Add studio type

This commit is contained in:
Zoe Roux 2025-03-02 21:32:22 +01:00
parent 73250f2bba
commit e32c83180e
No known key found for this signature in database
8 changed files with 65 additions and 2 deletions

View File

@ -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 = {

View File

@ -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 = {

View File

@ -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 = {

View File

@ -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;

View File

@ -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<typeof SeedMovie.static>;

View File

@ -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;

35
api/src/models/studio.ts Normal file
View File

@ -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<typeof Studio.static>;
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<typeof SeedStudio.static>;
registerExamples(Studio, madeInAbyss.studios[0]);

View File

@ -1,4 +1,4 @@
import { type TSchema, t } from "elysia";
import { t } from "elysia";
import { comment } from "../utils";
import { bubbleVideo, registerExamples } from "./examples";