( videoId: string, sourceKey: string, previousSpec: VideoEditSpec, )
| 756 | } |
| 757 | |
| 758 | async 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 | } |
no test coverage detected