mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-03-17 15:09:15 -04:00
Add back slugs field in videos
This commit is contained in:
parent
58deb07b9c
commit
11167765e7
@ -29,7 +29,9 @@ import {
|
||||
} from "~/db/schema";
|
||||
import { watchlist } from "~/db/schema/watchlist";
|
||||
import {
|
||||
coalesce,
|
||||
getColumns,
|
||||
jsonbAgg,
|
||||
jsonbBuildObject,
|
||||
jsonbObjectAgg,
|
||||
sqlarr,
|
||||
@ -87,6 +89,18 @@ const videoSort = Sort(
|
||||
);
|
||||
|
||||
const videoRelations = {
|
||||
slugs: () => {
|
||||
return db
|
||||
.select({
|
||||
slugs: coalesce<string[]>(
|
||||
jsonbAgg(entryVideoJoin.slug),
|
||||
sql`'[]'::jsonb`,
|
||||
).as("slugs"),
|
||||
})
|
||||
.from(entryVideoJoin)
|
||||
.where(eq(entryVideoJoin.videoPk, videos.pk))
|
||||
.as("slugs");
|
||||
},
|
||||
progress: () => {
|
||||
const query = db
|
||||
.select({
|
||||
@ -294,7 +308,7 @@ export async function getVideos({
|
||||
.with(...cte)
|
||||
.select({
|
||||
...getColumns(videos),
|
||||
...buildRelations(relations, videoRelations, {
|
||||
...buildRelations(["slugs", ...relations], videoRelations, {
|
||||
languages,
|
||||
preferOriginal,
|
||||
}),
|
||||
|
||||
@ -8,6 +8,9 @@ import { Video } from "./video";
|
||||
export const FullVideo = t.Composite([
|
||||
Video,
|
||||
t.Object({
|
||||
slugs: t.Array(
|
||||
t.String({ format: "slug", examples: ["made-in-abyss-s1e13"] }),
|
||||
),
|
||||
progress: t.Optional(Progress),
|
||||
entries: t.Array(t.Omit(Entry, ["videos", "progress"])),
|
||||
previous: t.Optional(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user