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

Function clearEditProcessingState

apps/web/workflows/edit-video.ts:758–786  ·  view source on GitHub ↗
(
	videoId: string,
	sourceKey: string,
	previousSpec: VideoEditSpec,
)

Source from the content-addressed store, hash-verified

756}
757
758async function clearEditProcessingState(
759 videoId: string,
760 sourceKey: string,
761 previousSpec: VideoEditSpec,
762): Promise<void> {
763 "use step";
764
765 const previousDuration = getValidDuration(
766 getEditSpecOutputDuration(previousSpec),
767 );
768
769 await db().transaction(async (tx) => {
770 if (previousDuration !== undefined) {
771 await tx
772 .update(videos)
773 .set({ duration: previousDuration })
774 .where(eq(videos.id, videoId as Video.VideoId));
775 }
776
777 await tx
778 .delete(videoUploads)
779 .where(
780 and(
781 eq(videoUploads.videoId, videoId as Video.VideoId),
782 eq(videoUploads.rawFileKey, sourceKey),
783 ),
784 );
785 });
786}

Callers 1

editVideoWorkflowFunction · 0.85

Calls 4

dbFunction · 0.90
updateMethod · 0.80
getValidDurationFunction · 0.70

Tested by

no test coverage detected