Showing
2 changed files
with
33 additions
and
22 deletions
... | @@ -198,10 +198,10 @@ exports.doctorRegister = async ctx => { | ... | @@ -198,10 +198,10 @@ exports.doctorRegister = async ctx => { |
198 | doctorId : userId, | 198 | doctorId : userId, |
199 | info, | 199 | info, |
200 | useYn : 'W', | 200 | useYn : 'W', |
201 | - }); | 201 | + }); |
202 | 202 | ||
203 | - await doctor.save(); | ||
204 | await doctorInfo.save(); | 203 | await doctorInfo.save(); |
204 | + await doctor.save(); | ||
205 | 205 | ||
206 | ctx.status = 201; | 206 | ctx.status = 201; |
207 | 207 | ... | ... |
... | @@ -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', |
33 | - | 34 | + }; |
34 | - const [signedUrl] = file ? await file.getSignedUrl(option) : [null]; | 35 | + |
35 | - | 36 | + const [signedUrl] = file ? await file.getSignedUrl(option) : [null]; |
36 | - return signedUrl; | 37 | + |
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', |
75 | + }; | ||
69 | 76 | ||
70 | - const [signedUrl] = file ? await file.getSignedUrl(option) : [null]; | 77 | + const [signedUrl] = file ? await file.getSignedUrl(option) : [null]; |
71 | 78 | ||
72 | - return signedUrl; | 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 | ... | ... |
-
Please register or login to post a comment