Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design1
/
RIT_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박권수
2021-10-13 01:03:06 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c72caee1c5a11274636b1665b94cfec5a9b3bae6
c72caee1
1 parent
44b31e31
fix. catch error
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
22 deletions
server/src/api/auth/auth.ctrl.js
server/src/util/GoogleCloudStorage.js
server/src/api/auth/auth.ctrl.js
View file @
c72caee
...
...
@@ -198,10 +198,10 @@ exports.doctorRegister = async ctx => {
doctorId
:
userId
,
info
,
useYn
:
'W'
,
});
});
await
doctor
.
save
();
await
doctorInfo
.
save
();
await
doctor
.
save
();
ctx
.
status
=
201
;
...
...
server/src/util/GoogleCloudStorage.js
View file @
c72caee
...
...
@@ -17,23 +17,29 @@ exports.uploadDoctorLicense = async ({ userId, fileName, filePath }) => {
return
doctorLicenseUrl
;
}
catch
(
e
)
{
console
.
log
(
e
);
return
null
;
}
};
//의사 정보를 인자로 받아 해당 Doctor License의 Signed URL을 반환
exports
.
viewDoctorLicense
=
async
({
doctorInfo
})
=>
{
const
fileName
=
doctorInfo
.
info
.
doctorLicense
.
split
(
'/'
).
pop
();
const
file
=
storage
.
bucket
(
'doctor-info'
).
file
(
fileName
);
const
option
=
{
version
:
'v4'
,
expires
:
Date
.
now
()
+
1000
*
60
*
15
,
action
:
'read'
,
};
const
[
signedUrl
]
=
file
?
await
file
.
getSignedUrl
(
option
)
:
[
null
];
return
signedUrl
;
try
{
const
fileName
=
doctorInfo
.
info
.
doctorLicense
.
split
(
'/'
).
pop
();
const
file
=
storage
.
bucket
(
'doctor-info'
).
file
(
fileName
);
const
option
=
{
version
:
'v4'
,
expires
:
Date
.
now
()
+
1000
*
60
*
15
,
action
:
'read'
,
};
const
[
signedUrl
]
=
file
?
await
file
.
getSignedUrl
(
option
)
:
[
null
];
return
signedUrl
;
}
catch
(
e
)
{
console
.
log
(
e
);
return
null
;
}
};
//의사 ID, 약 ID, 복용량을 인자로 받아, QR Code를 생성
...
...
@@ -59,15 +65,20 @@ exports.uploadQrCode = async ({ directory, qrCodeFileName }) => {
//생성된 QR코드의 signedUrl을 가져옴
exports
.
getQrCodeUrl
=
async
({
qrCodeFileName
})
=>
{
const
fileName
=
qrCodeFileName
;
const
file
=
storage
.
bucket
(
'prescribe-medicine-qrcode'
).
file
(
fileName
);
const
option
=
{
version
:
'v4'
,
expires
:
Date
.
now
()
+
1000
*
60
*
15
,
action
:
'read'
,
};
try
{
const
fileName
=
qrCodeFileName
;
const
file
=
storage
.
bucket
(
'prescribe-medicine-qrcode'
).
file
(
fileName
);
const
option
=
{
version
:
'v4'
,
expires
:
Date
.
now
()
+
1000
*
60
*
15
,
action
:
'read'
,
};
const
[
signedUrl
]
=
file
?
await
file
.
getSignedUrl
(
option
)
:
[
null
];
const
[
signedUrl
]
=
file
?
await
file
.
getSignedUrl
(
option
)
:
[
null
];
return
signedUrl
;
return
signedUrl
;
}
catch
(
e
)
{
console
.
log
(
e
);
return
null
;
}
};
\ No newline at end of file
...
...
Please
register
or
login
to post a comment