Add route to batch populate the history

This commit is contained in:
Zoe Roux
2025-04-07 19:03:51 +02:00
parent fef9e844a1
commit e2fa3af1e8
11 changed files with 249 additions and 165 deletions
+1 -1
View File
@@ -1,6 +1,7 @@
import { t } from "elysia";
import type { Prettify } from "~/utils";
import { bubbleImages, madeInAbyss, registerExamples } from "../examples";
import { Progress } from "../history";
import {
DbMetadata,
EpisodeId,
@@ -9,7 +10,6 @@ import {
TranslationRecord,
} from "../utils";
import { EmbeddedVideo } from "../video";
import { Progress } from "../watchlist";
import { BaseEntry, EntryTranslation } from "./base-entry";
export const BaseEpisode = t.Intersect([
+1 -1
View File
@@ -1,9 +1,9 @@
import { t } from "elysia";
import { type Prettify, comment } from "~/utils";
import { madeInAbyss, registerExamples } from "../examples";
import { Progress } from "../history";
import { DbMetadata, SeedImage } from "../utils";
import { Resource } from "../utils/resource";
import { Progress } from "../watchlist";
import { BaseEntry } from "./base-entry";
export const ExtraType = t.UnionEnum([
+1 -1
View File
@@ -1,6 +1,7 @@
import { t } from "elysia";
import { type Prettify, comment } from "~/utils";
import { bubbleImages, madeInAbyss, registerExamples } from "../examples";
import { Progress } from "../history";
import {
DbMetadata,
ExternalId,
@@ -10,7 +11,6 @@ import {
TranslationRecord,
} from "../utils";
import { EmbeddedVideo } from "../video";
import { Progress } from "../watchlist";
import { BaseEntry, EntryTranslation } from "./base-entry";
export const BaseMovieEntry = t.Intersect(
+1 -1
View File
@@ -1,6 +1,7 @@
import { t } from "elysia";
import { type Prettify, comment } from "~/utils";
import { bubbleImages, madeInAbyss, registerExamples } from "../examples";
import { Progress } from "../history";
import {
DbMetadata,
EpisodeId,
@@ -9,7 +10,6 @@ import {
TranslationRecord,
} from "../utils";
import { EmbeddedVideo } from "../video";
import { Progress } from "../watchlist";
import { BaseEntry, EntryTranslation } from "./base-entry";
export const BaseSpecial = t.Intersect(
+1 -1
View File
@@ -1,8 +1,8 @@
import { t } from "elysia";
import { type Prettify, comment } from "~/utils";
import { bubbleImages, registerExamples, youtubeExample } from "../examples";
import { Progress } from "../history";
import { DbMetadata, Resource } from "../utils";
import { Progress } from "../watchlist";
import { BaseEntry, EntryTranslation } from "./base-entry";
export const BaseUnknownEntry = t.Intersect(
+40
View File
@@ -0,0 +1,40 @@
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;
-29
View File
@@ -1,33 +1,4 @@
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 WatchlistStatus = t.UnionEnum([
"completed",