From 6057c77d28cba8f460b5994b65cbe5ced275d9e4 Mon Sep 17 00:00:00 2001 From: Abin Date: Sat, 9 Sep 2023 14:46:50 +0530 Subject: [PATCH] instructor register problem fixed with url --- server/src/app/usecases/auth/instructorAuth.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/server/src/app/usecases/auth/instructorAuth.ts b/server/src/app/usecases/auth/instructorAuth.ts index 7a53d9f..c059ea9 100644 --- a/server/src/app/usecases/auth/instructorAuth.ts +++ b/server/src/app/usecases/auth/instructorAuth.ts @@ -15,16 +15,23 @@ export const instructorRegister = async ( instructorRepository: ReturnType, authService: ReturnType ) => { - instructor.certificates = [] + console.log(instructor); + instructor.certificates = []; + instructor.profilePic = { + name: '', + key: '', + url: '' + }; if (files) { files.map((file) => { if (file.originalname === 'profilePic') { instructor.profilePic.url = file.path; + instructor.profilePic.name=file.originalname } else { const certificate = { - name:file.originalname, - url:file.path - } + name: file.originalname, + url: file.path + }; instructor.certificates.push(certificate); } }); @@ -42,6 +49,7 @@ export const instructorRegister = async ( if (password) { instructor.password = await authService.hashPassword(password); } + console.log(instructor) const response = await instructorRepository.addInstructor(instructor); return response ? { status: true, message: 'successfully registered!' }