MCPcopy
hub / github.com/CapSoftware/Cap / triggerVideoProcessing

Function triggerVideoProcessing

apps/web/actions/video/trigger-processing.ts:33–65  ·  view source on GitHub ↗
({
	videoId,
	rawFileKey,
	bucketId,
}: {
	videoId: Video.VideoId;
	rawFileKey: string;
	bucketId: string | null;
})

Source from the content-addressed store, hash-verified

31}
32
33export async function triggerVideoProcessing({
34 videoId,
35 rawFileKey,
36 bucketId,
37}: {
38 videoId: Video.VideoId;
39 rawFileKey: string;
40 bucketId: string | null;
41}): Promise<{ success: boolean }> {
42 const user = await getCurrentUser();
43 if (!user) throw new Error("Unauthorized");
44
45 const [video] = await db()
46 .select()
47 .from(videos)
48 .where(eq(videos.id, videoId));
49
50 if (!video) throw new Error("Video not found");
51 if (video.ownerId !== user.id) throw new Error("Unauthorized");
52
53 await verifyRawFileUploaded(video, rawFileKey);
54
55 await startVideoProcessingWorkflow({
56 videoId,
57 userId: user.id,
58 rawFileKey,
59 bucketId,
60 processingMessage: "Starting video processing...",
61 startFailureMessage: "Video processing could not start.",
62 });
63
64 return { success: true };
65}

Callers 1

Calls 3

dbFunction · 0.90
verifyRawFileUploadedFunction · 0.85

Tested by

no test coverage detected