mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-05-21 14:46:29 -04:00
Fix entries test with videos
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
||||
SeedImage,
|
||||
TranslationRecord,
|
||||
} from "../utils";
|
||||
import { Video } from "../video";
|
||||
import { EmbeddedVideo } from "../video";
|
||||
import { BaseEntry, EntryTranslation } from "./base-entry";
|
||||
|
||||
export const BaseEpisode = t.Intersect([
|
||||
@@ -27,7 +27,7 @@ export const Episode = t.Intersect([
|
||||
EntryTranslation(),
|
||||
BaseEpisode,
|
||||
t.Object({
|
||||
videos: t.Optional(t.Array(Video)),
|
||||
videos: t.Optional(t.Array(EmbeddedVideo)),
|
||||
}),
|
||||
DbMetadata,
|
||||
]);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { type Prettify, comment } from "~/utils";
|
||||
import { madeInAbyss, registerExamples } from "../examples";
|
||||
import { DbMetadata, SeedImage } from "../utils";
|
||||
import { Resource } from "../utils/resource";
|
||||
import { Video } from "../video";
|
||||
import { EmbeddedVideo } from "../video";
|
||||
import { BaseEntry } from "./base-entry";
|
||||
|
||||
export const ExtraType = t.UnionEnum([
|
||||
@@ -36,7 +36,7 @@ export const Extra = t.Intersect([
|
||||
Resource(),
|
||||
BaseExtra,
|
||||
t.Object({
|
||||
video: t.Optional(Video),
|
||||
video: t.Optional(EmbeddedVideo),
|
||||
}),
|
||||
DbMetadata,
|
||||
]);
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
SeedImage,
|
||||
TranslationRecord,
|
||||
} from "../utils";
|
||||
import { Video } from "../video";
|
||||
import { EmbeddedVideo } from "../video";
|
||||
import { BaseEntry, EntryTranslation } from "./base-entry";
|
||||
|
||||
export const BaseMovieEntry = t.Intersect(
|
||||
@@ -45,7 +45,7 @@ export const MovieEntry = t.Intersect([
|
||||
MovieEntryTranslation,
|
||||
BaseMovieEntry,
|
||||
t.Object({
|
||||
videos: t.Optional(t.Array(Video)),
|
||||
videos: t.Optional(t.Array(EmbeddedVideo)),
|
||||
}),
|
||||
DbMetadata,
|
||||
]);
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
SeedImage,
|
||||
TranslationRecord,
|
||||
} from "../utils";
|
||||
import { Video } from "../video";
|
||||
import { EmbeddedVideo } from "../video";
|
||||
import { BaseEntry, EntryTranslation } from "./base-entry";
|
||||
|
||||
export const BaseSpecial = t.Intersect(
|
||||
@@ -37,7 +37,7 @@ export const Special = t.Intersect([
|
||||
EntryTranslation(),
|
||||
BaseSpecial,
|
||||
t.Object({
|
||||
videos: t.Optional(t.Array(Video)),
|
||||
videos: t.Optional(t.Array(EmbeddedVideo)),
|
||||
}),
|
||||
DbMetadata,
|
||||
]);
|
||||
|
||||
@@ -2,6 +2,7 @@ import { t } from "elysia";
|
||||
import { type Prettify, comment } from "~/utils";
|
||||
import { bubbleImages, registerExamples, youtubeExample } from "../examples";
|
||||
import { DbMetadata, Resource } from "../utils";
|
||||
import { EmbeddedVideo } from "../video";
|
||||
import { BaseEntry, EntryTranslation } from "./base-entry";
|
||||
|
||||
export const BaseUnknownEntry = t.Intersect(
|
||||
@@ -27,6 +28,9 @@ export const UnknownEntry = t.Intersect([
|
||||
Resource(),
|
||||
UnknownEntryTranslation,
|
||||
BaseUnknownEntry,
|
||||
t.Object({
|
||||
video: t.Optional(EmbeddedVideo),
|
||||
}),
|
||||
DbMetadata,
|
||||
]);
|
||||
export type UnknownEntry = Prettify<typeof UnknownEntry.static>;
|
||||
|
||||
@@ -38,7 +38,7 @@ export const SeedVideo = t.Object({
|
||||
season: 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)
|
||||
type: t.Optional(t.UnionEnum(["episode", "movie", "extra"])),
|
||||
kind: t.Optional(t.UnionEnum(["episode", "movie", "extra"])),
|
||||
|
||||
from: t.String({
|
||||
description: "Name of the tool that made the guess",
|
||||
@@ -71,4 +71,8 @@ export type SeedVideo = typeof SeedVideo.static;
|
||||
export const Video = t.Intersect([Resource(), SeedVideo, DbMetadata]);
|
||||
export type Video = Prettify<typeof Video.static>;
|
||||
|
||||
// type used in entry responses
|
||||
export const EmbeddedVideo = t.Omit(Video, ["createdAt", "updatedAt"]);
|
||||
export type EmbeddedVideo = Prettify<typeof EmbeddedVideo.static>;
|
||||
|
||||
registerExamples(Video, bubbleVideo);
|
||||
|
||||
Reference in New Issue
Block a user