Fix with=nextEntry

This commit is contained in:
Zoe Roux 2025-04-08 23:37:22 +02:00
parent d6d3540b16
commit 144e08a99c
No known key found for this signature in database
3 changed files with 5 additions and 7 deletions

View File

@ -39,7 +39,7 @@ const nextupSort = Sort(
lastPlayed: watchlist.lastPlayedAt, lastPlayed: watchlist.lastPlayedAt,
}, },
{ {
default: ["lastPlayed"], default: ["-lastPlayed"],
tablePk: entries.pk, tablePk: entries.pk,
}, },
); );
@ -85,7 +85,6 @@ export const nextup = new Elysia({ tags: ["profiles"] })
const { pk, name, ...transCol } = getColumns(transQ); const { pk, name, ...transCol } = getColumns(transQ);
const { const {
kind,
externalId, externalId,
order, order,
seasonNumber, seasonNumber,
@ -100,6 +99,8 @@ export const nextup = new Elysia({ tags: ["profiles"] })
...transCol, ...transCol,
videos: entryVideosQ.videos, videos: entryVideosQ.videos,
progress: mapProgress({ aliased: true }), progress: mapProgress({ aliased: true }),
// specials don't have an `episodeNumber` but a `number` field.
number: episodeNumber,
// assign more restrained types to make typescript happy. // assign more restrained types to make typescript happy.
externalId: sql<any>`${externalId}`, externalId: sql<any>`${externalId}`,

View File

@ -196,11 +196,7 @@ const showRelations = {
.limit(1) .limit(1)
.as("firstEntry"); .as("firstEntry");
}, },
nextEntry: ({ nextEntry: ({ languages }: { languages: string[] }) => {
languages,
}: {
languages: string[];
}) => {
const transQ = db const transQ = db
.selectDistinctOn([entryTranslations.pk]) .selectDistinctOn([entryTranslations.pk])
.from(entryTranslations) .from(entryTranslations)

View File

@ -82,6 +82,7 @@ export const FullSerie = t.Intersect([
translations: t.Optional(TranslationRecord(SerieTranslation)), translations: t.Optional(TranslationRecord(SerieTranslation)),
studios: t.Optional(t.Array(Studio)), studios: t.Optional(t.Array(Studio)),
firstEntry: t.Optional(Entry), firstEntry: t.Optional(Entry),
nextEntry: t.Optional(t.Nullable(Entry)),
}), }),
]); ]);
export type FullSerie = Prettify<typeof FullSerie.static>; export type FullSerie = Prettify<typeof FullSerie.static>;