feat: add manual video tagging
This commit is contained in:
+18
-3
@@ -1,6 +1,10 @@
|
||||
import type { Metadata } from "next";
|
||||
import Link from "next/link";
|
||||
import { ASR_CONTENT_TAGS, isAsrContentTag } from "@/lib/asr-tags";
|
||||
import {
|
||||
ASR_CONTENT_TAGS,
|
||||
isAsrContentTag,
|
||||
resolveEffectiveContentTags,
|
||||
} from "@/lib/asr-tags";
|
||||
import { getFileUrl } from "@/lib/minio";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import FeedMasonry from "./components/FeedMasonry";
|
||||
@@ -26,7 +30,15 @@ export default async function Home({
|
||||
const [videos, posts] = await Promise.all([
|
||||
prisma.video.findMany({
|
||||
where: selectedTag
|
||||
? { transcript: { is: { content_tags: { has: selectedTag } } } }
|
||||
? {
|
||||
OR: [
|
||||
{ manual_content_tags: { has: selectedTag } },
|
||||
{
|
||||
manual_content_tags: { isEmpty: true },
|
||||
transcript: { is: { content_tags: { has: selectedTag } } },
|
||||
},
|
||||
],
|
||||
}
|
||||
: undefined,
|
||||
orderBy: { created_at: "desc" },
|
||||
take: 60,
|
||||
@@ -63,7 +75,10 @@ export default async function Home({
|
||||
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