mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-05-21 22:56:29 -04:00
Use original with collections too
This commit is contained in:
@@ -21,7 +21,7 @@ import {
|
||||
processLanguages,
|
||||
} from "~/models/utils";
|
||||
import { desc } from "~/models/utils/descriptions";
|
||||
import { getShow, getShows, showFilters, showSort } from "./logic";
|
||||
import { getShows, showFilters, showSort } from "./logic";
|
||||
|
||||
export const collections = new Elysia({
|
||||
prefix: "/collections",
|
||||
@@ -41,11 +41,16 @@ export const collections = new Elysia({
|
||||
set,
|
||||
}) => {
|
||||
const langs = processLanguages(languages);
|
||||
const ret = await getShow(id, {
|
||||
const [ret] = await getShows({
|
||||
limit: 1,
|
||||
filter: and(
|
||||
isUuid(id) ? eq(shows.id, id) : eq(shows.slug, id),
|
||||
eq(shows.kind, "collection"),
|
||||
),
|
||||
languages: langs,
|
||||
fallbackLanguage: langs.includes("*"),
|
||||
preferOriginal,
|
||||
relations,
|
||||
filters: eq(shows.kind, "collection"),
|
||||
});
|
||||
if (!ret) {
|
||||
return error(404, {
|
||||
@@ -60,7 +65,7 @@ export const collections = new Elysia({
|
||||
});
|
||||
}
|
||||
set.headers["content-language"] = ret.language;
|
||||
return ret.show;
|
||||
return ret;
|
||||
},
|
||||
{
|
||||
detail: {
|
||||
|
||||
@@ -143,7 +143,7 @@ export async function getShows({
|
||||
languages: string[];
|
||||
fallbackLanguage?: boolean;
|
||||
preferOriginal?: boolean;
|
||||
relations?: ("translations" | "studios" | "videos")[];
|
||||
relations?: (keyof typeof showRelations)[];
|
||||
}) {
|
||||
const transQ = db
|
||||
.selectDistinctOn([showTranslations.pk])
|
||||
@@ -182,7 +182,7 @@ export async function getShows({
|
||||
...buildRelations(relations, showRelations, { languages }),
|
||||
})
|
||||
.from(shows)
|
||||
[fallbackLanguage ? "innerJoin" : "leftJoin"](
|
||||
[fallbackLanguage ? "innerJoin" : ("leftJoin" as "innerJoin")](
|
||||
transQ,
|
||||
eq(shows.pk, transQ.pk),
|
||||
)
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
processLanguages,
|
||||
} from "~/models/utils";
|
||||
import { desc } from "~/models/utils/descriptions";
|
||||
import { getShow, getShows, showFilters, showSort } from "./logic";
|
||||
import { getShows, showFilters, showSort } from "./logic";
|
||||
|
||||
export const series = new Elysia({ prefix: "/series", tags: ["series"] })
|
||||
.model({
|
||||
|
||||
Reference in New Issue
Block a user