Kyoo/api/src/models/history.ts
2025-04-07 19:07:05 +02:00

41 lines
1.0 KiB
TypeScript

import { t } from "elysia";
import { comment } from "~/utils";
export const Progress = t.Object({
percent: t.Integer({ minimum: 0, maximum: 100 }),
time: t.Nullable(
t.Integer({
minimum: 0,
description: comment`
When this episode was stopped (in seconds since the start).
This value is null if the entry was never watched or is finished.
`,
}),
),
playedDate: t.Nullable(t.String({ format: "date-time" })),
videoId: t.Nullable(
t.String({
format: "uuid",
description: comment`
Id of the video the user watched.
This can be used to resume playback in the correct video file
without asking the user what video to play.
This will be null if the user did not watch the entry or
if the video was deleted since.
`,
}),
),
});
export type Progress = typeof Progress.static;
export const SeedHistory = t.Intersect([
t.Object({
entry: t.String({
description: "Id or slug of the entry/movie you watched",
}),
}),
Progress,
]);
export type SeedHistory = typeof SeedHistory.static;