feat: add manual video tagging
This commit is contained in:
+14
-3
@@ -1,6 +1,6 @@
|
||||
import { type NextRequest, NextResponse } from "next/server";
|
||||
import type { FeedItem, FeedResponse } from "@/app/types/feed";
|
||||
import { isAsrContentTag } from "@/lib/asr-tags";
|
||||
import { isAsrContentTag, resolveEffectiveContentTags } from "@/lib/asr-tags";
|
||||
import { getFileUrl } from "@/lib/minio";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
|
||||
@@ -24,7 +24,15 @@ export async function GET(req: NextRequest) {
|
||||
const videoWhere = {
|
||||
...(before ? { created_at: { lt: before } } : {}),
|
||||
...(selectedTag
|
||||
? { transcript: { is: { content_tags: { has: selectedTag } } } }
|
||||
? {
|
||||
OR: [
|
||||
{ manual_content_tags: { has: selectedTag } },
|
||||
{
|
||||
manual_content_tags: { isEmpty: true },
|
||||
transcript: { is: { content_tags: { has: selectedTag } } },
|
||||
},
|
||||
],
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
|
||||
@@ -68,7 +76,10 @@ export async function GET(req: NextRequest) {
|
||||
sec_uid: v.author.sec_uid,
|
||||
},
|
||||
likes: Number(v.digg_count),
|
||||
content_tags: v.transcript?.content_tags ?? [],
|
||||
content_tags: resolveEffectiveContentTags(
|
||||
v.manual_content_tags,
|
||||
v.transcript?.content_tags,
|
||||
),
|
||||
})),
|
||||
...posts.map((p) => {
|
||||
const coverPath = p.images?.[0]?.url;
|
||||
|
||||
Reference in New Issue
Block a user