mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-05-22 15:12:28 -04:00
Properly use nextup in the home
This commit is contained in:
@@ -135,7 +135,7 @@ const newsSort: Sort = {
|
||||
],
|
||||
};
|
||||
|
||||
const entryRelations = {
|
||||
export const entryRelations = {
|
||||
translations: () => {
|
||||
const { pk, language, ...trans } = getColumns(entryTranslations);
|
||||
return db
|
||||
|
||||
@@ -6,6 +6,7 @@ import { entries } from "~/db/schema";
|
||||
import { watchlist } from "~/db/schema/watchlist";
|
||||
import { getColumns } from "~/db/utils";
|
||||
import { Entry } from "~/models/entry";
|
||||
import { Show } from "~/models/show";
|
||||
import {
|
||||
AcceptLanguage,
|
||||
createPage,
|
||||
@@ -21,6 +22,7 @@ import { desc } from "~/models/utils/descriptions";
|
||||
import {
|
||||
entryFilters,
|
||||
entryProgressQ,
|
||||
entryRelations,
|
||||
entryVideosQ,
|
||||
getEntryTransQ,
|
||||
mapProgress,
|
||||
@@ -71,7 +73,7 @@ export const nextup = new Elysia({ tags: ["profiles"] })
|
||||
query: { sort, filter, query, limit, after },
|
||||
headers: { "accept-language": languages, ...headers },
|
||||
request: { url },
|
||||
jwt: { sub },
|
||||
jwt: { sub, settings },
|
||||
}) => {
|
||||
const langs = processLanguages(languages);
|
||||
const transQ = getEntryTransQ(langs);
|
||||
@@ -102,6 +104,11 @@ export const nextup = new Elysia({ tags: ["profiles"] })
|
||||
seasonNumber: sql<number>`${seasonNumber}`,
|
||||
episodeNumber: sql<number>`${episodeNumber}`,
|
||||
name: sql<string>`${transQ.name}`,
|
||||
|
||||
show: sql`${entryRelations.show({
|
||||
languages: langs,
|
||||
preferOriginal: settings.preferOriginal,
|
||||
})}`,
|
||||
})
|
||||
.from(entries)
|
||||
.innerJoin(watchlist, eq(watchlist.nextEntry, entries.pk))
|
||||
@@ -134,7 +141,7 @@ export const nextup = new Elysia({ tags: ["profiles"] })
|
||||
"accept-language": AcceptLanguage({ autoFallback: true }),
|
||||
}),
|
||||
response: {
|
||||
200: Page(Entry),
|
||||
200: Page(t.Intersect([Entry, t.Object({ show: Show })])),
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user