Dont send videos with extras

This commit is contained in:
Zoe Roux 2025-03-06 14:24:18 +01:00
parent e86ab9c081
commit fd2f3be663
No known key found for this signature in database
3 changed files with 9 additions and 14 deletions

View File

@ -3,7 +3,6 @@ import { type Prettify, comment } from "~/utils";
import { madeInAbyss, registerExamples } from "../examples";
import { DbMetadata, SeedImage } from "../utils";
import { Resource } from "../utils/resource";
import { EmbeddedVideo } from "../video";
import { BaseEntry } from "./base-entry";
export const ExtraType = t.UnionEnum([
@ -32,14 +31,7 @@ export const BaseExtra = t.Intersect(
},
);
export const Extra = t.Intersect([
Resource(),
BaseExtra,
t.Object({
video: t.Optional(EmbeddedVideo),
}),
DbMetadata,
]);
export const Extra = t.Intersect([Resource(), BaseExtra, DbMetadata]);
export type Extra = Prettify<typeof Extra.static>;
export const SeedExtra = t.Intersect([
@ -52,4 +44,4 @@ export const SeedExtra = t.Intersect([
]);
export type SeedExtra = Prettify<typeof SeedExtra.static>;
registerExamples(Extra, { ...madeInAbyss.extras[0], video: undefined });
registerExamples(Extra, madeInAbyss.extras[0]);

View File

@ -2,7 +2,6 @@ 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(
@ -28,9 +27,6 @@ export const UnknownEntry = t.Intersect([
Resource(),
UnknownEntryTranslation,
BaseUnknownEntry,
t.Object({
video: t.Optional(EmbeddedVideo),
}),
DbMetadata,
]);
export type UnknownEntry = Prettify<typeof UnknownEntry.static>;

View File

@ -40,6 +40,13 @@ describe("Get entries", () => {
expectStatus(resp, body).toBe(200);
expect(body.items[0].videos).toBeArrayOfSize(1);
expect(body.items[0].videos[0]).toMatchObject({
path: madeInAbyssVideo.path,
slug: madeInAbyssVideo.slug,
version: madeInAbyssVideo.version,
rendering: madeInAbyssVideo.rendering,
part: madeInAbyssVideo.part,
});
});
});