MCPcopy Index your code
hub / github.com/CapSoftware/Cap / validateProcessingRequest

Function validateProcessingRequest

apps/web/workflows/process-video.ts:69–105  ·  view source on GitHub ↗
(
	videoId: string,
	rawFileKey: string,
)

Source from the content-addressed store, hash-verified

67}
68
69async function validateProcessingRequest(
70 videoId: string,
71 rawFileKey: string,
72): Promise<void> {
73 "use step";
74
75 const mediaServerUrl = serverEnv().MEDIA_SERVER_URL;
76 if (!mediaServerUrl) {
77 throw new FatalError("MEDIA_SERVER_URL is not configured");
78 }
79
80 const [video] = await db()
81 .select()
82 .from(videos)
83 .where(eq(videos.id, videoId as Video.VideoId));
84
85 if (!video) {
86 throw new FatalError("Video does not exist");
87 }
88
89 const [upload] = await db()
90 .select()
91 .from(videoUploads)
92 .where(eq(videoUploads.videoId, videoId as Video.VideoId));
93
94 if (!upload) {
95 throw new FatalError("Upload does not exist");
96 }
97
98 if (upload.rawFileKey !== rawFileKey) {
99 throw new FatalError("Upload raw file key does not match");
100 }
101
102 if (upload.phase !== "processing") {
103 throw new FatalError("Upload is not ready for processing");
104 }
105}
106
107interface MediaServerProcessResult {
108 metadata: {

Callers 1

processVideoWorkflowFunction · 0.85

Calls 2

serverEnvFunction · 0.90
dbFunction · 0.90

Tested by

no test coverage detected