From 3420a7041cc55f92d15c4045c4022cbcaa13c82d Mon Sep 17 00:00:00 2001 From: Akalanka Date: Sat, 14 Oct 2023 23:36:48 +0530 Subject: [PATCH] Fix: add timestamp to id upload --- src/components/identification-form.jsx | 5 +++-- src/services/azure.js | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/identification-form.jsx b/src/components/identification-form.jsx index 3802d1b..96bf942 100644 --- a/src/components/identification-form.jsx +++ b/src/components/identification-form.jsx @@ -48,8 +48,9 @@ const IdentificationForm = () => { } const members = await Promise.all( formData.map(async (member, index) => { - member["student_id_url"] = - member["student_id_url"] || (await uploadIdCard(team.name, member.name, idFiles[index])); + if (idFiles[index]) { + member["student_id_url"] = await uploadIdCard(team.name, member.name, idFiles[index]); + } return member; }) ); diff --git a/src/services/azure.js b/src/services/azure.js index 3d5d623..23daff8 100644 --- a/src/services/azure.js +++ b/src/services/azure.js @@ -30,5 +30,9 @@ export const uploadSubmission = async (file) => { }; export const uploadIdCard = async (teamName, userName, file) => { - return uploadFile(genericContainerClient, file, `documents/${teamName}/${userName}-${file.name}`); + return uploadFile( + genericContainerClient, + file, + `documents/${teamName}/${userName}-${file.name}-${new Date().toISOString()}` + ); };