mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-02 21:24:20 -04:00
Split translations for movies
This commit is contained in:
parent
b0dac24eea
commit
c5972bd15f
@ -1,22 +1,17 @@
|
|||||||
import { t } from "elysia";
|
import { t } from "elysia";
|
||||||
import { Genre } from "./utils/genres";
|
import {
|
||||||
import { Image } from "./utils/image";
|
ExternalId,
|
||||||
import { ExternalId } from "./utils/external-id";
|
Genre,
|
||||||
import { bubble, registerExamples } from "./examples";
|
Image,
|
||||||
import { comment } from "../utils";
|
Language,
|
||||||
|
Resource,
|
||||||
|
} from "./utils";
|
||||||
|
import { Video } from "./video";
|
||||||
|
|
||||||
export const MovieStatus = t.UnionEnum(["unknown", "finished", "planned"]);
|
export const MovieStatus = t.UnionEnum(["unknown", "finished", "planned"]);
|
||||||
export type MovieStatus = typeof MovieStatus.static;
|
export type MovieStatus = typeof MovieStatus.static;
|
||||||
|
|
||||||
export const Movie = t.Object({
|
export const BaseMovie = t.Object({
|
||||||
id: t.String({ format: "uuid" }),
|
|
||||||
slug: t.String(),
|
|
||||||
name: t.String(),
|
|
||||||
description: t.Nullable(t.String()),
|
|
||||||
tagline: t.Nullable(t.String()),
|
|
||||||
aliases: t.Array(t.String()),
|
|
||||||
tags: t.Array(t.String()),
|
|
||||||
|
|
||||||
genres: t.Array(Genre),
|
genres: t.Array(Genre),
|
||||||
rating: t.Nullable(t.Number({ minimum: 0, maximum: 100 })),
|
rating: t.Nullable(t.Number({ minimum: 0, maximum: 100 })),
|
||||||
status: MovieStatus,
|
status: MovieStatus,
|
||||||
@ -26,27 +21,50 @@ export const Movie = t.Object({
|
|||||||
|
|
||||||
airDate: t.Nullable(t.String({ format: "date" })),
|
airDate: t.Nullable(t.String({ format: "date" })),
|
||||||
originalLanguage: t.Nullable(
|
originalLanguage: t.Nullable(
|
||||||
t.String({
|
Language({
|
||||||
description: comment`
|
description: "The language code this movie was made in.",
|
||||||
The language code this movie was made in.
|
|
||||||
This is a BCP 47 language code (the IETF Best Current Practices on Tags for Identifying Languages).
|
|
||||||
BCP 47 is also known as RFC 5646. It subsumes ISO 639 and is backward compatible with it.
|
|
||||||
`,
|
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|
||||||
poster: t.Nullable(Image),
|
|
||||||
thumbnail: t.Nullable(Image),
|
|
||||||
banner: t.Nullable(Image),
|
|
||||||
logo: t.Nullable(Image),
|
|
||||||
trailerUrl: t.Nullable(t.String()),
|
|
||||||
|
|
||||||
createdAt: t.String({ format: "date-time" }),
|
createdAt: t.String({ format: "date-time" }),
|
||||||
nextRefresh: t.String({ format: "date-time" }),
|
nextRefresh: t.String({ format: "date-time" }),
|
||||||
|
|
||||||
externalId: ExternalId,
|
externalId: ExternalId,
|
||||||
});
|
});
|
||||||
|
export type BaseMovie = typeof BaseMovie.static;
|
||||||
|
|
||||||
|
export const MovieTranslation = t.Object({
|
||||||
|
name: t.String(),
|
||||||
|
description: t.Nullable(t.String()),
|
||||||
|
tagline: t.Nullable(t.String()),
|
||||||
|
aliases: t.Array(t.String()),
|
||||||
|
tags: t.Array(t.String()),
|
||||||
|
|
||||||
|
poster: t.Nullable(Image),
|
||||||
|
thumbnail: t.Nullable(Image),
|
||||||
|
banner: t.Nullable(Image),
|
||||||
|
logo: t.Nullable(Image),
|
||||||
|
trailerUrl: t.Nullable(t.String()),
|
||||||
|
});
|
||||||
|
export type MovieTranslation = typeof MovieTranslation.static;
|
||||||
|
|
||||||
|
export const Movie = t.Intersect([
|
||||||
|
Resource,
|
||||||
|
BaseMovie,
|
||||||
|
t.Ref(MovieTranslation),
|
||||||
|
]);
|
||||||
export type Movie = typeof Movie.static;
|
export type Movie = typeof Movie.static;
|
||||||
|
|
||||||
registerExamples(Movie, bubble);
|
export const SeedMovie = t.Intersect([
|
||||||
|
BaseMovie,
|
||||||
|
t.Object({
|
||||||
|
slug: t.String({ format: "slug" }),
|
||||||
|
image: t.Ref("image"),
|
||||||
|
toto: t.Ref("mt"),
|
||||||
|
translations: t.Record(t.String(), t.Ref("mt"), {
|
||||||
|
minProperties: 1,
|
||||||
|
}),
|
||||||
|
videos: t.Optional(t.Array(t.Ref(Video))),
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
export type SeedMovie = typeof SeedMovie.static;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user