mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-05-22 15:12:28 -04:00
Add back slugs field in videos
This commit is contained in:
@@ -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,
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user