Test & fix entry video join

This commit is contained in:
Zoe Roux
2025-03-04 10:59:51 +01:00
parent 477fb24036
commit 70d0d480f6
13 changed files with 77 additions and 35 deletions
+6 -1
View File
@@ -8,6 +8,7 @@ import {
SeedImage,
TranslationRecord,
} from "../utils";
import { Video } from "../video";
import { BaseEntry, EntryTranslation } from "./base-entry";
export const BaseEpisode = t.Intersect([
@@ -25,6 +26,9 @@ export const Episode = t.Intersect([
Resource(),
EntryTranslation(),
BaseEpisode,
t.Object({
videos: t.Optional(t.Array(Video)),
}),
DbMetadata,
]);
export type Episode = Prettify<typeof Episode.static>;
@@ -34,7 +38,7 @@ export const SeedEpisode = t.Intersect([
t.Object({
thumbnail: t.Nullable(SeedImage),
translations: TranslationRecord(EntryTranslation()),
videos: t.Optional(t.Array(t.String({ format: "uuid" }))),
videos: t.Optional(t.Array(t.String({ format: "uuid" }), { default: [] })),
}),
]);
export type SeedEpisode = Prettify<typeof SeedEpisode.static>;
@@ -45,4 +49,5 @@ registerExamples(Episode, {
...ep.translations.en,
...bubbleImages,
slug: `${madeInAbyss.slug}-s${ep.seasonNumber}-e${ep.episodeNumber}`,
videos: [],
});
+10 -2
View File
@@ -3,6 +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 { BaseEntry } from "./base-entry";
export const ExtraType = t.UnionEnum([
@@ -31,7 +32,14 @@ export const BaseExtra = t.Intersect(
},
);
export const Extra = t.Intersect([Resource(), BaseExtra, DbMetadata]);
export const Extra = t.Intersect([
Resource(),
BaseExtra,
t.Object({
video: t.Optional(Video),
}),
DbMetadata,
]);
export type Extra = Prettify<typeof Extra.static>;
export const SeedExtra = t.Intersect([
@@ -44,4 +52,4 @@ export const SeedExtra = t.Intersect([
]);
export type SeedExtra = Prettify<typeof SeedExtra.static>;
registerExamples(Extra, madeInAbyss.extras[0]);
registerExamples(Extra, { ...madeInAbyss.extras[0], video: undefined });
+5 -1
View File
@@ -9,6 +9,7 @@ import {
SeedImage,
TranslationRecord,
} from "../utils";
import { Video } from "../video";
import { BaseEntry, EntryTranslation } from "./base-entry";
export const BaseMovieEntry = t.Intersect(
@@ -43,6 +44,9 @@ export const MovieEntry = t.Intersect([
Resource(),
MovieEntryTranslation,
BaseMovieEntry,
t.Object({
videos: t.Optional(t.Array(Video)),
}),
DbMetadata,
]);
export type MovieEntry = Prettify<typeof MovieEntry.static>;
@@ -58,7 +62,7 @@ export const SeedMovieEntry = t.Intersect([
t.Object({ poster: t.Nullable(SeedImage) }),
]),
),
videos: t.Optional(t.Array(t.String({ format: "uuid" }))),
videos: t.Optional(t.Array(t.String({ format: "uuid" }), { default: [] })),
}),
]);
export type SeedMovieEntry = Prettify<typeof SeedMovieEntry.static>;
+5 -1
View File
@@ -8,6 +8,7 @@ import {
SeedImage,
TranslationRecord,
} from "../utils";
import { Video } from "../video";
import { BaseEntry, EntryTranslation } from "./base-entry";
export const BaseSpecial = t.Intersect(
@@ -35,6 +36,9 @@ export const Special = t.Intersect([
Resource(),
EntryTranslation(),
BaseSpecial,
t.Object({
videos: t.Optional(t.Array(Video)),
}),
DbMetadata,
]);
export type Special = Prettify<typeof Special.static>;
@@ -44,7 +48,7 @@ export const SeedSpecial = t.Intersect([
t.Object({
thumbnail: t.Nullable(SeedImage),
translations: TranslationRecord(EntryTranslation()),
videos: t.Optional(t.Array(t.String({ format: "uuid" }))),
videos: t.Optional(t.Array(t.String({ format: "uuid" }), { default: [] })),
}),
]);
export type SeedSpecial = Prettify<typeof SeedSpecial.static>;
+5 -4
View File
@@ -3,15 +3,15 @@ import type { Video } from "~/models/video";
export const madeInAbyssVideo: Video = {
id: "3cd436ee-01ff-4f45-ba98-654282531234",
slug: "made-in-abyss-s1e1",
path: "/video/Made in abyss S01E01.mkv",
slug: "made-in-abyss-s1e13",
path: "/video/Made in abyss S01E13.mkv",
rendering: "459429fa062adeebedcc2bb04b9965de0262bfa453369783132d261be79021bd",
part: null,
version: 1,
guess: {
title: "Made in abyss",
season: [1],
episode: [1],
episode: [13],
type: "episode",
from: "guessit",
},
@@ -156,6 +156,7 @@ export const madeInAbyss = {
link: "https://www.themoviedb.org/tv/72636/season/1/episode/13",
},
},
videos: [madeInAbyssVideo.id],
},
{
kind: "special",
@@ -240,7 +241,7 @@ export const madeInAbyss = {
name: "The Making of MADE IN ABYSS 01",
runtime: 17,
thumbnail: null,
video: "3cd436ee-01ff-4f45-ba98-654282531234",
video: madeInAbyssVideo.id,
},
],
studios: [
+2 -2
View File
@@ -88,9 +88,9 @@ export const SeedMovie = t.Intersect([
}),
]),
),
videos: t.Optional(t.Array(t.String({ format: "uuid" }))),
videos: t.Optional(t.Array(t.String({ format: "uuid" }), { default: [] })),
collection: t.Optional(SeedCollection),
studios: t.Array(SeedStudio),
studios: t.Optional(t.Array(SeedStudio, { default: [] })),
}),
]);
export type SeedMovie = Prettify<typeof SeedMovie.static>;
+2 -2
View File
@@ -98,9 +98,9 @@ export const SeedSerie = t.Intersect([
),
seasons: t.Array(SeedSeason),
entries: t.Array(SeedEntry),
extras: t.Optional(t.Array(SeedExtra)),
extras: t.Optional(t.Array(SeedExtra, { default: [] })),
collection: t.Optional(SeedCollection),
studios: t.Array(SeedStudio),
studios: t.Optional(t.Array(SeedStudio, { default: [] })),
}),
]);
export type SeedSerie = typeof SeedSerie.static;