Add percent in movie's watchlist

This commit is contained in:
Zoe Roux 2025-03-12 09:36:48 +01:00
parent 32cc6e7910
commit be35a4f0d9
No known key found for this signature in database
7 changed files with 15 additions and 6 deletions

View File

@ -250,7 +250,10 @@ export async function getShows({
.as("t");
const watchStatusQ = db
.select()
.select({
...getColumns(watchlist),
percent: watchlist.seenCount,
})
.from(watchlist)
.where(eq(watchlist.profilePk, userId))
.as("watchstatus");

View File

@ -9,8 +9,8 @@ import {
TranslationRecord,
} from "../utils";
import { EmbeddedVideo } from "../video";
import { BaseEntry, EntryTranslation } from "./base-entry";
import { Progress } from "../watchlist";
import { BaseEntry, EntryTranslation } from "./base-entry";
export const BaseEpisode = t.Intersect([
t.Object({

View File

@ -3,8 +3,8 @@ import { type Prettify, comment } from "~/utils";
import { madeInAbyss, registerExamples } from "../examples";
import { DbMetadata, SeedImage } from "../utils";
import { Resource } from "../utils/resource";
import { BaseEntry } from "./base-entry";
import { Progress } from "../watchlist";
import { BaseEntry } from "./base-entry";
export const ExtraType = t.UnionEnum([
"other",

View File

@ -10,8 +10,8 @@ import {
TranslationRecord,
} from "../utils";
import { EmbeddedVideo } from "../video";
import { BaseEntry, EntryTranslation } from "./base-entry";
import { Progress } from "../watchlist";
import { BaseEntry, EntryTranslation } from "./base-entry";
export const BaseMovieEntry = t.Intersect(
[

View File

@ -9,8 +9,8 @@ import {
TranslationRecord,
} from "../utils";
import { EmbeddedVideo } from "../video";
import { BaseEntry, EntryTranslation } from "./base-entry";
import { Progress } from "../watchlist";
import { BaseEntry, EntryTranslation } from "./base-entry";
export const BaseSpecial = t.Intersect(
[

View File

@ -71,7 +71,7 @@ export const Serie = t.Intersect([
availableCount: t.Integer({
description: "The number of episodes that can be played right away",
}),
watchStatus: WatchStatus,
watchStatus: t.Omit(WatchStatus, ["percent"]),
}),
]);
export type Serie = Prettify<typeof Serie.static>;

View File

@ -41,8 +41,14 @@ export const WatchStatus = t.Object({
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" })),
// only for series
seenCount: t.Integer({
description: "The number of episodes you watched in this serie.",
minimum: 0,
}),
// only for movies
percent: t.Integer({
minimum: 0,
maximum: 100,
}),
});