async function enrichWithProfileAndVideoAndActivity(
ctx: QueryCtx,
upload: Doc<'userUpload'>,
) {
const [imageUrl, profile, video, activity] = await Promise.all([
ctx.storage.getUrl(upload.imageStorageId),
ctx.db.get(upload.userProfileId),
ctx.db.get(upload.videoId),
ctx.db.query('activity').withIndex('by_video', (q) => q.eq('videoId', upload.videoId)).first(),
]);
return {
...upload,
enrichments: {
imageUrl,
profileName: profile?.name,
videoTitle: video?.title,
activityTitle: activity?.title,
},
}
}
async function enrichWithProfileAndVideoAndActivity(
ctx: QueryCtx,
upload: Doc<'userUpload'>,
) {
const [imageUrl, profile, video, activity] = await Promise.all([
ctx.storage.getUrl(upload.imageStorageId),
ctx.db.get(upload.userProfileId),
ctx.db.get(upload.videoId),
ctx.db.query('activity').withIndex('by_video', (q) => q.eq('videoId', upload.videoId)).first(),
]);
return {
...upload,
enrichments: {
imageUrl,
profileName: profile?.name,
videoTitle: video?.title,
activityTitle: activity?.title,
},
}
}