박권수

fix. error catch

...@@ -122,7 +122,6 @@ exports.doctorRegister = async ctx => { ...@@ -122,7 +122,6 @@ exports.doctorRegister = async ctx => {
122 122
123 const { doctorInfoFile } = ctx.request.files; 123 const { doctorInfoFile } = ctx.request.files;
124 124
125 -
126 const schema = Joi.object().keys({ 125 const schema = Joi.object().keys({
127 userId : Joi.string().email().max(50).required(), 126 userId : Joi.string().email().max(50).required(),
128 password : Joi.string().required(), 127 password : Joi.string().required(),
...@@ -200,8 +199,8 @@ exports.doctorRegister = async ctx => { ...@@ -200,8 +199,8 @@ exports.doctorRegister = async ctx => {
200 useYn : 'W', 199 useYn : 'W',
201 }); 200 });
202 201
203 - await doctor.save();
204 await doctorInfo.save(); 202 await doctorInfo.save();
203 + await doctor.save();
205 204
206 ctx.status = 201; 205 ctx.status = 201;
207 206
...@@ -374,9 +373,9 @@ exports.socialRegister = async ctx => { ...@@ -374,9 +373,9 @@ exports.socialRegister = async ctx => {
374 contact, 373 contact,
375 deviceToken, 374 deviceToken,
376 }); 375 });
377 - 376 +
378 - await user.save();
379 await profile.save(); 377 await profile.save();
378 + await user.save();
380 379
381 ctx.status = 201; 380 ctx.status = 201;
382 381
......
...@@ -42,6 +42,7 @@ exports.getDoctorRegReqList = async ctx => { ...@@ -42,6 +42,7 @@ exports.getDoctorRegReqList = async ctx => {
42 error : '알 수 없는 에러가 발생했습니다.', 42 error : '알 수 없는 에러가 발생했습니다.',
43 }; 43 };
44 console.log(e); 44 console.log(e);
45 + return;
45 } 46 }
46 }; 47 };
47 48
...@@ -82,6 +83,7 @@ exports.getDoctorRegReqList = async ctx => { ...@@ -82,6 +83,7 @@ exports.getDoctorRegReqList = async ctx => {
82 error : '알 수 없는 에러가 발생했습니다.', 83 error : '알 수 없는 에러가 발생했습니다.',
83 }; 84 };
84 console.log(e); 85 console.log(e);
86 + return;
85 } 87 }
86 }; 88 };
87 89
...@@ -171,6 +173,8 @@ exports.getDoctorRegReqDetail = async ctx => { ...@@ -171,6 +173,8 @@ exports.getDoctorRegReqDetail = async ctx => {
171 ctx.body = { 173 ctx.body = {
172 error : '알 수 없는 에러가 발생했습니다.', 174 error : '알 수 없는 에러가 발생했습니다.',
173 }; 175 };
176 + console.log(e);
177 + return;
174 } 178 }
175 }; 179 };
176 180
...@@ -262,6 +266,7 @@ exports.acceptDoctorRegReq = async ctx => { ...@@ -262,6 +266,7 @@ exports.acceptDoctorRegReq = async ctx => {
262 error : '알 수 없는 에러가 발생했습니다.', 266 error : '알 수 없는 에러가 발생했습니다.',
263 }; 267 };
264 console.log(e); 268 console.log(e);
269 + return;
265 } 270 }
266 }; 271 };
267 272
...@@ -328,6 +333,7 @@ exports.acceptDoctorRegReq = async ctx => { ...@@ -328,6 +333,7 @@ exports.acceptDoctorRegReq = async ctx => {
328 error : '알 수 없는 에러가 발생했습니다.', 333 error : '알 수 없는 에러가 발생했습니다.',
329 }; 334 };
330 console.log(e); 335 console.log(e);
336 + return;
331 } 337 }
332 }; 338 };
333 339
...@@ -396,6 +402,7 @@ exports.acceptDoctorRegReq = async ctx => { ...@@ -396,6 +402,7 @@ exports.acceptDoctorRegReq = async ctx => {
396 error : '알 수 없는 에러가 발생했습니다.', 402 error : '알 수 없는 에러가 발생했습니다.',
397 }; 403 };
398 console.log(e); 404 console.log(e);
405 + return;
399 } 406 }
400 }; 407 };
401 408
......
...@@ -17,23 +17,29 @@ exports.uploadDoctorLicense = async ({ userId, fileName, filePath }) => { ...@@ -17,23 +17,29 @@ exports.uploadDoctorLicense = async ({ userId, fileName, filePath }) => {
17 17
18 return doctorLicenseUrl; 18 return doctorLicenseUrl;
19 } catch(e) { 19 } catch(e) {
20 + console.log(e);
20 return null; 21 return null;
21 } 22 }
22 }; 23 };
23 24
24 //의사 정보를 인자로 받아 해당 Doctor License의 Signed URL을 반환 25 //의사 정보를 인자로 받아 해당 Doctor License의 Signed URL을 반환
25 exports.viewDoctorLicense = async ({ doctorInfo }) => { 26 exports.viewDoctorLicense = async ({ doctorInfo }) => {
26 - const fileName = doctorInfo.info.doctorLicense.split('/').pop(); 27 + try {
27 - const file = storage.bucket('doctor-info').file(fileName); 28 + const fileName = doctorInfo.info.doctorLicense.split('/').pop();
28 - const option = { 29 + const file = storage.bucket('doctor-info').file(fileName);
29 - version : 'v4', 30 + const option = {
30 - expires : Date.now() + 1000 * 60 * 15, 31 + version : 'v4',
31 - action : 'read', 32 + expires : Date.now() + 1000 * 60 * 15,
32 - }; 33 + action : 'read',
34 + };
33 35
34 - const [signedUrl] = file ? await file.getSignedUrl(option) : [null]; 36 + const [signedUrl] = file ? await file.getSignedUrl(option) : [null];
35 37
36 - return signedUrl; 38 + return signedUrl;
39 + } catch(e) {
40 + console.log(e);
41 + return null;
42 + }
37 }; 43 };
38 44
39 //의사 ID, 약 ID, 복용량을 인자로 받아, QR Code를 생성 45 //의사 ID, 약 ID, 복용량을 인자로 받아, QR Code를 생성
...@@ -59,15 +65,20 @@ exports.uploadQrCode = async ({ directory, qrCodeFileName }) => { ...@@ -59,15 +65,20 @@ exports.uploadQrCode = async ({ directory, qrCodeFileName }) => {
59 65
60 //생성된 QR코드의 signedUrl을 가져옴 66 //생성된 QR코드의 signedUrl을 가져옴
61 exports.getQrCodeUrl = async ({ qrCodeFileName }) => { 67 exports.getQrCodeUrl = async ({ qrCodeFileName }) => {
62 - const fileName = qrCodeFileName; 68 + try {
63 - const file = storage.bucket('prescribe-medicine-qrcode').file(fileName); 69 + const fileName = qrCodeFileName;
64 - const option = { 70 + const file = storage.bucket('prescribe-medicine-qrcode').file(fileName);
65 - version : 'v4', 71 + const option = {
66 - expires : Date.now() + 1000 * 60 * 15, 72 + version : 'v4',
67 - action : 'read', 73 + expires : Date.now() + 1000 * 60 * 15,
68 - }; 74 + action : 'read',
69 - 75 + };
70 - const [signedUrl] = file ? await file.getSignedUrl(option) : [null]; 76 +
71 - 77 + const [signedUrl] = file ? await file.getSignedUrl(option) : [null];
72 - return signedUrl; 78 +
79 + return signedUrl;
80 + } catch(e) {
81 + console.log(e);
82 + return null;
83 + }
73 }; 84 };
...\ No newline at end of file ...\ No newline at end of file
......