mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-02 21:24:20 -04:00
Splt translations for seasons & series + seed setup
This commit is contained in:
parent
887431a335
commit
0edf216618
@ -1,15 +1,6 @@
|
|||||||
import type { Entry, Extra } from "../entry";
|
import type { SeedSerie } from "../seed";
|
||||||
import type { Season } from "../season";
|
|
||||||
import type { Serie } from "../serie";
|
|
||||||
import type { Video } from "../video";
|
|
||||||
|
|
||||||
type CompleteSerie = Serie & {
|
export const madeInAbyss: SeedSerie = {
|
||||||
seasons: Season[];
|
|
||||||
entries: (Entry & { videos: Video[] })[];
|
|
||||||
extras: (Extra & { video: Video })[];
|
|
||||||
};
|
|
||||||
|
|
||||||
export const madeInAbyss: CompleteSerie = {
|
|
||||||
id: "04bcf2ac-3c09-42f6-8357-b003798f9562",
|
id: "04bcf2ac-3c09-42f6-8357-b003798f9562",
|
||||||
slug: "made-in-abyss",
|
slug: "made-in-abyss",
|
||||||
name: "Made in Abyss",
|
name: "Made in Abyss",
|
||||||
|
@ -1,27 +1,36 @@
|
|||||||
import { t } from "elysia";
|
import { t } from "elysia";
|
||||||
import { Image } from "./utils/image";
|
import { Image } from "./utils/image";
|
||||||
import { SeasonId } from "./utils/external-id";
|
import { SeasonId } from "./utils/external-id";
|
||||||
import { madeInAbyss, registerExamples } from "./examples";
|
import { Resource } from "./utils/resource";
|
||||||
|
import { Language } from "./utils/language";
|
||||||
|
|
||||||
export const Season = t.Object({
|
export const BaseSeason = t.Object({
|
||||||
id: t.String({ format: "uuid" }),
|
|
||||||
slug: t.String(),
|
|
||||||
seasonNumber: t.Number({ minimum: 1 }),
|
seasonNumber: t.Number({ minimum: 1 }),
|
||||||
name: t.Nullable(t.String()),
|
|
||||||
description: t.Nullable(t.String()),
|
|
||||||
|
|
||||||
startAir: t.Nullable(t.String({ format: "date" })),
|
startAir: t.Nullable(t.String({ format: "date" })),
|
||||||
endAir: t.Nullable(t.String({ format: "date" })),
|
endAir: t.Nullable(t.String({ format: "date" })),
|
||||||
|
|
||||||
poster: t.Nullable(Image),
|
|
||||||
thumbnail: t.Nullable(Image),
|
|
||||||
banner: t.Nullable(Image),
|
|
||||||
|
|
||||||
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: SeasonId,
|
externalId: SeasonId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const SeasonTranslation = t.Object({
|
||||||
|
name: t.Nullable(t.String()),
|
||||||
|
description: t.Nullable(t.String()),
|
||||||
|
|
||||||
|
poster: t.Nullable(Image),
|
||||||
|
thumbnail: t.Nullable(Image),
|
||||||
|
banner: t.Nullable(Image),
|
||||||
|
});
|
||||||
|
export type SeasonTranslation = typeof SeasonTranslation.static;
|
||||||
|
|
||||||
|
export const Season = t.Intersect([Resource, BaseSeason, SeasonTranslation]);
|
||||||
export type Season = typeof Season.static;
|
export type Season = typeof Season.static;
|
||||||
|
|
||||||
registerExamples(Season, ...madeInAbyss.seasons);
|
export const SeedSeason = t.Intersect([
|
||||||
|
BaseSeason,
|
||||||
|
t.Object({
|
||||||
|
translations: t.Record(Language(), SeasonTranslation, { minPropreties: 1 }),
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
@ -2,8 +2,10 @@ import { t } from "elysia";
|
|||||||
import { Genre } from "./utils/genres";
|
import { Genre } from "./utils/genres";
|
||||||
import { Image } from "./utils/image";
|
import { Image } from "./utils/image";
|
||||||
import { ExternalId } from "./utils/external-id";
|
import { ExternalId } from "./utils/external-id";
|
||||||
import { madeInAbyss , registerExamples } from "./examples";
|
import { madeInAbyss, registerExamples } from "./examples";
|
||||||
import { comment } from "../utils";
|
import { Resource } from "./utils/resource";
|
||||||
|
import { Language } from "./utils/language";
|
||||||
|
import { SeedSeason } from "./season";
|
||||||
|
|
||||||
export const SerieStatus = t.UnionEnum([
|
export const SerieStatus = t.UnionEnum([
|
||||||
"unknown",
|
"unknown",
|
||||||
@ -13,15 +15,7 @@ export const SerieStatus = t.UnionEnum([
|
|||||||
]);
|
]);
|
||||||
export type SerieStatus = typeof SerieStatus.static;
|
export type SerieStatus = typeof SerieStatus.static;
|
||||||
|
|
||||||
export const Serie = t.Object({
|
export const BaseSerie = 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: SerieStatus,
|
status: SerieStatus,
|
||||||
@ -35,27 +29,42 @@ export const Serie = t.Object({
|
|||||||
startAir: t.Nullable(t.String({ format: "date" })),
|
startAir: t.Nullable(t.String({ format: "date" })),
|
||||||
endAir: t.Nullable(t.String({ format: "date" })),
|
endAir: t.Nullable(t.String({ format: "date" })),
|
||||||
originalLanguage: t.Nullable(
|
originalLanguage: t.Nullable(
|
||||||
t.String({
|
Language({
|
||||||
description: comment`
|
description: "The language code this serie 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 const SerieTranslation = 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 SerieTranslation = typeof SerieTranslation.static;
|
||||||
|
|
||||||
|
export const Serie = t.Intersect([Resource, BaseSerie, SerieTranslation]);
|
||||||
export type Serie = typeof Serie.static;
|
export type Serie = typeof Serie.static;
|
||||||
|
|
||||||
registerExamples(Serie, madeInAbyss);
|
export const SeedSerie = t.Intersect([
|
||||||
|
BaseSerie,
|
||||||
|
t.Object({
|
||||||
|
translations: t.Record(Language(), SerieTranslation, { minProperties: 1 }),
|
||||||
|
seasons: t.Array(SeedSeason),
|
||||||
|
// entries: t.Array(SeedEntry),
|
||||||
|
// extras: t.Optional(t.Array(SeedExtra)),
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
export type SeedSerie = typeof SeedSerie.static;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user