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

View File

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

View File

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