feat: related content and featured cross-content sidebar widgets
- Add excludeId arg to videos and articles GraphQL resolvers - Add excludeId + featured params to getVideos/getArticles services - Video page: fetch related videos by tag + featured article in parallel - Article page: fetch related articles by category + featured video in parallel - Implement sidebar widgets with thumbnails, metadata, hover interactions - Add videos.related and magazine.related i18n keys - Seed dummy articles (spotlight, interview, psychology) and videos with overlapping tags for testing related content Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,7 @@ import {
|
||||
arrayContains,
|
||||
isNull,
|
||||
or,
|
||||
ne,
|
||||
type SQL,
|
||||
} from "drizzle-orm";
|
||||
import { requireAdmin } from "../../lib/acl";
|
||||
@@ -97,6 +98,7 @@ builder.queryField("videos", (t) =>
|
||||
sortBy: t.arg.string(),
|
||||
duration: t.arg.string(),
|
||||
tag: t.arg.string(),
|
||||
excludeId: t.arg.string(),
|
||||
},
|
||||
resolve: async (_root, args, ctx) => {
|
||||
const pageSize = args.limit ?? 24;
|
||||
@@ -113,6 +115,9 @@ builder.queryField("videos", (t) =>
|
||||
if (args.tag) {
|
||||
conditions.push(arrayContains(videos.tags, [args.tag]));
|
||||
}
|
||||
if (args.excludeId) {
|
||||
conditions.push(ne(videos.id, args.excludeId));
|
||||
}
|
||||
if (args.modelId) {
|
||||
const videoIds = await ctx.db
|
||||
.select({ video_id: video_models.video_id })
|
||||
|
||||
Reference in New Issue
Block a user