diff --git a/api/src/controllers/shows/logic.ts b/api/src/controllers/shows/logic.ts index 376b7b53..b3ae221b 100644 --- a/api/src/controllers/shows/logic.ts +++ b/api/src/controllers/shows/logic.ts @@ -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"); diff --git a/api/src/models/entry/episode.ts b/api/src/models/entry/episode.ts index 6012f126..aea7264a 100644 --- a/api/src/models/entry/episode.ts +++ b/api/src/models/entry/episode.ts @@ -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({ diff --git a/api/src/models/entry/extra.ts b/api/src/models/entry/extra.ts index d6ce8758..5fe5312a 100644 --- a/api/src/models/entry/extra.ts +++ b/api/src/models/entry/extra.ts @@ -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", diff --git a/api/src/models/entry/movie-entry.ts b/api/src/models/entry/movie-entry.ts index a8215db2..ab5e863c 100644 --- a/api/src/models/entry/movie-entry.ts +++ b/api/src/models/entry/movie-entry.ts @@ -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( [ diff --git a/api/src/models/entry/special.ts b/api/src/models/entry/special.ts index 70a6191c..d34f5c76 100644 --- a/api/src/models/entry/special.ts +++ b/api/src/models/entry/special.ts @@ -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( [ diff --git a/api/src/models/serie.ts b/api/src/models/serie.ts index a24fcec9..22e894ce 100644 --- a/api/src/models/serie.ts +++ b/api/src/models/serie.ts @@ -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; diff --git a/api/src/models/watchlist.ts b/api/src/models/watchlist.ts index daf4ca49..0d5037b9 100644 --- a/api/src/models/watchlist.ts +++ b/api/src/models/watchlist.ts @@ -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, + }), });