Add watch status type in movies/series

This commit is contained in:
Zoe Roux
2025-03-11 17:16:56 +01:00
parent e489d0c445
commit 32cc6e7910
5 changed files with 37 additions and 8 deletions
+2
View File
@@ -16,6 +16,7 @@ import {
} from "./utils";
import { Original } from "./utils/original";
import { EmbeddedVideo } from "./video";
import { WatchStatus } from "./watchlist";
export const MovieStatus = t.UnionEnum(["unknown", "finished", "planned"]);
export type MovieStatus = typeof MovieStatus.static;
@@ -55,6 +56,7 @@ export const Movie = t.Intersect([
t.Object({
original: Original,
isAvailable: t.Boolean(),
watchStatus: t.Omit(WatchStatus, ["seenCount"]),
}),
]);
export type Movie = Prettify<typeof Movie.static>;
+2
View File
@@ -17,6 +17,7 @@ import {
TranslationRecord,
} from "./utils";
import { Original } from "./utils/original";
import { WatchStatus } from "./watchlist";
export const SerieStatus = t.UnionEnum([
"unknown",
@@ -70,6 +71,7 @@ export const Serie = t.Intersect([
availableCount: t.Integer({
description: "The number of episodes that can be played right away",
}),
watchStatus: WatchStatus,
}),
]);
export type Serie = Prettify<typeof Serie.static>;
+19
View File
@@ -27,3 +27,22 @@ export const Progress = t.Object({
),
});
export type Progress = typeof Progress.static;
export const WatchlistStatus = t.UnionEnum([
"completed",
"watching",
"rewatching",
"dropped",
"planned",
]);
export const WatchStatus = t.Object({
status: WatchlistStatus,
score: t.Nullable(t.Integer({ minimum: 0, maximum: 100 })),
startedAt: t.Nullable(t.String({ format: "date-time" })),
completedAt: t.Nullable(t.String({ format: "date-time" })),
seenCount: t.Integer({
description: "The number of episodes you watched in this serie.",
minimum: 0,
}),
});