diff --git a/gymboard-app/src/api/cdn/index.ts b/gymboard-app/src/api/cdn/index.ts index 21cda1c..8165289 100644 --- a/gymboard-app/src/api/cdn/index.ts +++ b/gymboard-app/src/api/cdn/index.ts @@ -8,6 +8,7 @@ const api = axios.create({ }); export enum VideoProcessingStatus { + NOT_STARTED = 'NOT_STARTED', WAITING = 'WAITING', IN_PROGRESS = 'IN_PROGRESS', COMPLETED = 'COMPLETED', @@ -18,24 +19,21 @@ export interface FileMetadata { filename: string; mimeType: string; size: number; - uploadedAt: string; - availableForDownload: boolean; + createdAt: string; } -export async function uploadVideoToCDN(file: File): Promise { +export async function uploadVideoToCDN(file: File): Promise { const response = await api.post('/uploads/video', file, { headers: { 'Content-Type': file.type, }, }); - return response.data.id; + return response.data.taskId; } -export async function getVideoProcessingStatus( - id: string -): Promise { +export async function getVideoProcessingStatus(taskId: number): Promise { try { - const response = await api.get(`/uploads/video/${id}/status`); + const response = await api.get(`/uploads/video/${taskId}/status`); return response.data.status; } catch (error: any) { if (error.response && error.response.status === 404) { @@ -45,16 +43,14 @@ export async function getVideoProcessingStatus( } } -export async function waitUntilVideoProcessingComplete( - id: string -): Promise { +export async function waitUntilVideoProcessingComplete(taskId: number): Promise { let failureCount = 0; let attemptCount = 0; while (failureCount < 5 && attemptCount < 60) { await sleep(1000); attemptCount++; try { - const status = await getVideoProcessingStatus(id); + const status = await getVideoProcessingStatus(taskId); failureCount = 0; if ( status === VideoProcessingStatus.COMPLETED || diff --git a/gymboard-app/src/i18n/en-US/index.ts b/gymboard-app/src/i18n/en-US/index.ts index 7f4675c..82281e1 100644 --- a/gymboard-app/src/i18n/en-US/index.ts +++ b/gymboard-app/src/i18n/en-US/index.ts @@ -51,8 +51,8 @@ export default { upload: 'Video File to Upload', submit: 'Submit', submitUploading: 'Uploading video...', + submitUploadFailed: 'Video upload failed.', submitCreatingSubmission: 'Creating submission...', - submitVideoProcessing: 'Processing...', submitComplete: 'Submission complete!', submitFailed: 'Submission processing failed. Please try again later.', }, diff --git a/gymboard-app/src/pages/gym/GymSubmissionPage.vue b/gymboard-app/src/pages/gym/GymSubmissionPage.vue index 0c82025..ec91789 100644 --- a/gymboard-app/src/pages/gym/GymSubmissionPage.vue +++ b/gymboard-app/src/pages/gym/GymSubmissionPage.vue @@ -48,7 +48,7 @@ A high-level overview of the submission process is as follows: