vault-video-processor / src /features /vault /actions /trigger-analysis.ts
dvijaykrishnan's picture
feat: Implement product moderation actions, enhance product card display with video snapshots, and introduce new showcase components.
900ee77
Raw
History Blame Contribute Delete
831 Bytes
"use server";
import { auth } from "@/lib/auth";
import { headers } from "next/headers";
import { ShowcaseService } from "../services/showcase.service";
import { revalidatePath } from "next/cache";
export async function triggerAnalysisAction(videoId: string) {
const session = await auth.api.getSession({
headers: await headers()
});
// We allow anonymous triggering for now as per ingestion rules
const userId = session?.user?.id || null;
if (!videoId) return { success: false, error: "Video ID is required" };
console.log(`[triggerAnalysisAction] Triggering analysis for ${videoId}...`);
const result = await ShowcaseService.ingestAndAnalyze(videoId, userId, { skipAnalysis: false });
if (result.success) {
revalidatePath(`/showcase/${videoId}`);
}
return result;
}