mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Type videos's for
to map to entries
This commit is contained in:
parent
0aa2c9c086
commit
c504cbbff5
@ -1,7 +1,8 @@
|
|||||||
import { t } from "elysia";
|
import { t } from "elysia";
|
||||||
import { type Prettify, comment } from "~/utils";
|
import { type Prettify, comment } from "~/utils";
|
||||||
|
import { ExtraType } from "./entry/extra";
|
||||||
import { bubbleVideo, registerExamples } from "./examples";
|
import { bubbleVideo, registerExamples } from "./examples";
|
||||||
import { DbMetadata, Resource } from "./utils";
|
import { DbMetadata, EpisodeId, ExternalId, Resource } from "./utils";
|
||||||
|
|
||||||
export const Guess = t.Recursive((Self) =>
|
export const Guess = t.Recursive((Self) =>
|
||||||
t.Object(
|
t.Object(
|
||||||
@ -10,8 +11,8 @@ export const Guess = t.Recursive((Self) =>
|
|||||||
year: t.Optional(t.Array(t.Integer(), { default: [] })),
|
year: t.Optional(t.Array(t.Integer(), { default: [] })),
|
||||||
season: t.Optional(t.Array(t.Integer(), { default: [] })),
|
season: t.Optional(t.Array(t.Integer(), { default: [] })),
|
||||||
episode: t.Optional(t.Array(t.Integer(), { default: [] })),
|
episode: t.Optional(t.Array(t.Integer(), { default: [] })),
|
||||||
// TODO: maybe replace "extra" with the `extraKind` value (aka behind-the-scene, trailer, etc)
|
|
||||||
kind: t.Optional(t.UnionEnum(["episode", "movie", "extra"])),
|
kind: t.Optional(t.UnionEnum(["episode", "movie", "extra"])),
|
||||||
|
extraKind: t.Optional(ExtraType),
|
||||||
|
|
||||||
from: t.String({
|
from: t.String({
|
||||||
description: "Name of the tool that made the guess",
|
description: "Name of the tool that made the guess",
|
||||||
@ -66,10 +67,56 @@ export const SeedVideo = t.Object({
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
guess: Guess,
|
guess: Guess,
|
||||||
});
|
|
||||||
export type SeedVideo = typeof SeedVideo.static;
|
|
||||||
|
|
||||||
export const Video = t.Intersect([Resource(), SeedVideo, DbMetadata]);
|
for: t.Array(
|
||||||
|
t.Union([
|
||||||
|
t.Object({
|
||||||
|
movie: t.Union([
|
||||||
|
t.String({ format: "uuid" }),
|
||||||
|
t.String({ format: "slug", examples: ["bubble"] }),
|
||||||
|
]),
|
||||||
|
externalId: t.Optional(ExternalId()),
|
||||||
|
}),
|
||||||
|
t.Intersect([
|
||||||
|
t.Object({
|
||||||
|
serie: t.Union([
|
||||||
|
t.String({ format: "uuid" }),
|
||||||
|
t.String({ format: "slug", examples: ["made-in-abyss"] }),
|
||||||
|
]),
|
||||||
|
}),
|
||||||
|
t.Union([
|
||||||
|
t.Object({
|
||||||
|
season: t.Integer({ minimum: 1 }),
|
||||||
|
episode: t.Integer(),
|
||||||
|
externalId: t.Optional(EpisodeId),
|
||||||
|
}),
|
||||||
|
t.Object({
|
||||||
|
absolute: t.Integer(),
|
||||||
|
externalId: t.Optional(t.Union([EpisodeId, ExternalId()])),
|
||||||
|
}),
|
||||||
|
t.Object({
|
||||||
|
special: t.Integer(),
|
||||||
|
externalId: t.Optional(EpisodeId),
|
||||||
|
}),
|
||||||
|
t.Object({
|
||||||
|
slug: t.String({
|
||||||
|
format: "slug",
|
||||||
|
examples: ["made-in-abyss-dawn-of-the-deep-soul"],
|
||||||
|
}),
|
||||||
|
externalId: t.Optional(t.Union([EpisodeId, ExternalId()])),
|
||||||
|
}),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
});
|
||||||
|
export type SeedVideo = Prettify<typeof SeedVideo.static>;
|
||||||
|
|
||||||
|
export const Video = t.Intersect([
|
||||||
|
Resource(),
|
||||||
|
t.Omit(SeedVideo, ["for"]),
|
||||||
|
DbMetadata,
|
||||||
|
]);
|
||||||
export type Video = Prettify<typeof Video.static>;
|
export type Video = Prettify<typeof Video.static>;
|
||||||
|
|
||||||
// type used in entry responses
|
// type used in entry responses
|
||||||
|
Loading…
x
Reference in New Issue
Block a user