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