mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Fix entries's video retrieval
This commit is contained in:
parent
d61573668b
commit
34926dab51
@ -41,6 +41,7 @@ import {
|
||||
sortToSql,
|
||||
} from "~/models/utils";
|
||||
import { desc } from "~/models/utils/descriptions";
|
||||
import type { EmbeddedVideo } from "~/models/video";
|
||||
|
||||
const entryFilters: FilterDef = {
|
||||
kind: {
|
||||
@ -115,9 +116,14 @@ async function getEntries({
|
||||
const videosQ = db
|
||||
.select({
|
||||
videos: coalesce(
|
||||
jsonbAgg(jsonbBuildObject({ slug: entryVideoJoin.slug, ...videosCol })),
|
||||
jsonbAgg(
|
||||
jsonbBuildObject<EmbeddedVideo>({
|
||||
slug: entryVideoJoin.slug,
|
||||
...videosCol,
|
||||
}),
|
||||
),
|
||||
sql`'[]'::jsonb`,
|
||||
),
|
||||
).as("videos"),
|
||||
})
|
||||
.from(entryVideoJoin)
|
||||
.where(eq(entryVideoJoin.entryPk, entries.pk))
|
||||
|
@ -73,7 +73,7 @@ export const Video = t.Intersect([Resource(), SeedVideo, DbMetadata]);
|
||||
export type Video = Prettify<typeof Video.static>;
|
||||
|
||||
// type used in entry responses
|
||||
export const EmbeddedVideo = t.Omit(Video, ["createdAt", "updatedAt"]);
|
||||
export const EmbeddedVideo = t.Omit(Video, ["guess", "createdAt", "updatedAt"]);
|
||||
export type EmbeddedVideo = Prettify<typeof EmbeddedVideo.static>;
|
||||
|
||||
registerExamples(Video, bubbleVideo);
|
||||
|
Loading…
x
Reference in New Issue
Block a user