mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Properly register examples for seasons
This commit is contained in:
parent
b3b9ec17a7
commit
d4257c1d02
@ -52,7 +52,7 @@ export const MovieTranslation = t.Object({
|
||||
export type MovieTranslation = typeof MovieTranslation.static;
|
||||
|
||||
export const Movie = t.Intersect([
|
||||
Resource,
|
||||
Resource(),
|
||||
MovieTranslation,
|
||||
BaseMovie,
|
||||
t.Object({ isAvailable: t.Boolean() }),
|
||||
|
@ -3,6 +3,7 @@ import { SeasonId } from "./utils/external-id";
|
||||
import { Image, SeedImage } from "./utils/image";
|
||||
import { TranslationRecord } from "./utils/language";
|
||||
import { Resource } from "./utils/resource";
|
||||
import { bubbleImages, madeInAbyss, registerExamples } from "./examples";
|
||||
|
||||
export const BaseSeason = t.Object({
|
||||
seasonNumber: t.Number({ minimum: 1 }),
|
||||
@ -25,13 +26,13 @@ export const SeasonTranslation = t.Object({
|
||||
});
|
||||
export type SeasonTranslation = typeof SeasonTranslation.static;
|
||||
|
||||
export const Season = t.Intersect([Resource, BaseSeason, SeasonTranslation]);
|
||||
export const Season = t.Intersect([Resource(), BaseSeason, SeasonTranslation]);
|
||||
export type Season = typeof Season.static;
|
||||
|
||||
export const SeedSeason = t.Intersect([
|
||||
t.Omit(BaseSeason, ["createdAt", "nextRefresh"]),
|
||||
t.Object({
|
||||
slug: t.String({ format: "slug" }),
|
||||
slug: t.String({ format: "slug", examples: ["made-in-abyss-s1"] }),
|
||||
translations: TranslationRecord(
|
||||
t.Intersect([
|
||||
t.Omit(SeasonTranslation, ["poster", "thumbnail", "banner"]),
|
||||
@ -44,3 +45,9 @@ export const SeedSeason = t.Intersect([
|
||||
),
|
||||
}),
|
||||
]);
|
||||
|
||||
registerExamples(Season, {
|
||||
...madeInAbyss.seasons[0],
|
||||
...madeInAbyss.seasons[0].translations.en,
|
||||
...bubbleImages,
|
||||
});
|
||||
|
@ -6,6 +6,7 @@ import { Genre } from "./utils/genres";
|
||||
import { Image, SeedImage } from "./utils/image";
|
||||
import { Language, TranslationRecord } from "./utils/language";
|
||||
import { Resource } from "./utils/resource";
|
||||
import { SeedEntry } from "./entry";
|
||||
|
||||
export const SerieStatus = t.UnionEnum([
|
||||
"unknown",
|
||||
@ -55,7 +56,7 @@ export const SerieTranslation = t.Object({
|
||||
});
|
||||
export type SerieTranslation = typeof SerieTranslation.static;
|
||||
|
||||
export const Serie = t.Intersect([Resource, SerieTranslation, BaseSerie]);
|
||||
export const Serie = t.Intersect([Resource(), SerieTranslation, BaseSerie]);
|
||||
export type Serie = typeof Serie.static;
|
||||
|
||||
export const SeedSerie = t.Intersect([
|
||||
@ -74,7 +75,7 @@ export const SeedSerie = t.Intersect([
|
||||
]),
|
||||
),
|
||||
seasons: t.Array(SeedSeason),
|
||||
// entries: t.Array(SeedEntry),
|
||||
entries: t.Array(SeedEntry),
|
||||
// extras: t.Optional(t.Array(SeedExtra)),
|
||||
}),
|
||||
]);
|
||||
@ -85,4 +86,3 @@ registerExamples(Serie, {
|
||||
...madeInAbyss.translations.en,
|
||||
...bubbleImages,
|
||||
});
|
||||
registerExamples(SeedSerie, madeInAbyss);
|
||||
|
@ -8,10 +8,11 @@ FormatRegistry.Set("slug", (slug) => {
|
||||
return /^[a-z0-9-]+$/g.test(slug);
|
||||
});
|
||||
|
||||
export const Resource = t.Object({
|
||||
id: t.String({ format: "uuid" }),
|
||||
slug: t.String({ format: "slug" }),
|
||||
});
|
||||
export const Resource = () =>
|
||||
t.Object({
|
||||
id: t.String({ format: "uuid" }),
|
||||
slug: t.String({ format: "slug" }),
|
||||
});
|
||||
|
||||
const checker = TypeCompiler.Compile(t.String({ format: "uuid" }));
|
||||
export const isUuid = (id: string) => checker.Check(id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user