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"); .as("t");
const watchStatusQ = db const watchStatusQ = db
.select() .select({
...getColumns(watchlist),
percent: watchlist.seenCount,
})
.from(watchlist) .from(watchlist)
.where(eq(watchlist.profilePk, userId)) .where(eq(watchlist.profilePk, userId))
.as("watchstatus"); .as("watchstatus");

View File

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

View File

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

View File

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

View File

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

View File

@ -71,7 +71,7 @@ export const Serie = t.Intersect([
availableCount: t.Integer({ availableCount: t.Integer({
description: "The number of episodes that can be played right away", 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>; 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 })), score: t.Nullable(t.Integer({ minimum: 0, maximum: 100 })),
startedAt: t.Nullable(t.String({ format: "date-time" })), startedAt: t.Nullable(t.String({ format: "date-time" })),
completedAt: t.Nullable(t.String({ format: "date-time" })), completedAt: t.Nullable(t.String({ format: "date-time" })),
// only for series
seenCount: t.Integer({ seenCount: t.Integer({
description: "The number of episodes you watched in this serie.", description: "The number of episodes you watched in this serie.",
minimum: 0, minimum: 0,
}), }),
// only for movies
percent: t.Integer({
minimum: 0,
maximum: 100,
}),
}); });