Add history & from in the guess type

This commit is contained in:
Zoe Roux 2025-01-28 12:39:26 +01:00
parent e9c7cfe832
commit 7906374553
No known key found for this signature in database

View File

@ -36,12 +36,26 @@ export const Video = t.Object({
createdAt: t.String({ format: "date-time" }),
guess: t.Optional(
t.Recursive((Self) =>
t.Object(
{
title: t.Optional(t.String()),
title: t.String(),
year: Guess(t.Integer()),
season: Guess(t.Integer()),
episode: Guess(t.Integer()),
// TODO: maybe replace "extra" with the `extraKind` value (aka behind-the-scene, trailer, etc)
type: t.Optional(t.UnionEnum(["episode", "movie", "extra"])),
from: t.String({
description: "Name of the tool that made the guess",
}),
history: t.Array(t.Omit(Self, ["history"]), {
default: [],
description: comment`
When another tool refines the guess or a user manually edit it, the history of the guesses
are kept in this \`history\` value.
`,
}),
},
{
additionalProperties: true,
@ -54,6 +68,7 @@ export const Video = t.Object({
},
),
),
),
});
export type Video = typeof Video.static;
registerExamples(Video, bubbleVideo);