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:00:38 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d798dc6f55faa8ae27c4f1151ffe4c5e80aa6005
d798dc6f
1 parent
e4e0fa29
fix. error catch
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
24 deletions
server/src/api/auth/auth.ctrl.js
server/src/api/manage/manage.ctrl.js
server/src/util/GoogleCloudStorage.js
server/src/api/auth/auth.ctrl.js
View file @
d798dc6
...
...
@@ -122,7 +122,6 @@ exports.doctorRegister = async ctx => {
const
{
doctorInfoFile
}
=
ctx
.
request
.
files
;
const
schema
=
Joi
.
object
().
keys
({
userId
:
Joi
.
string
().
email
().
max
(
50
).
required
(),
password
:
Joi
.
string
().
required
(),
...
...
@@ -200,8 +199,8 @@ exports.doctorRegister = async ctx => {
useYn
:
'W'
,
});
await
doctor
.
save
();
await
doctorInfo
.
save
();
await
doctor
.
save
();
ctx
.
status
=
201
;
...
...
@@ -374,9 +373,9 @@ exports.socialRegister = async ctx => {
contact
,
deviceToken
,
});
await
user
.
save
();
await
profile
.
save
();
await
user
.
save
();
ctx
.
status
=
201
;
...
...
server/src/api/manage/manage.ctrl.js
View file @
d798dc6
...
...
@@ -42,6 +42,7 @@ exports.getDoctorRegReqList = async ctx => {
error
:
'알 수 없는 에러가 발생했습니다.'
,
};
console
.
log
(
e
);
return
;
}
};
...
...
@@ -82,6 +83,7 @@ exports.getDoctorRegReqList = async ctx => {
error
:
'알 수 없는 에러가 발생했습니다.'
,
};
console
.
log
(
e
);
return
;
}
};
...
...
@@ -171,6 +173,8 @@ exports.getDoctorRegReqDetail = async ctx => {
ctx
.
body
=
{
error
:
'알 수 없는 에러가 발생했습니다.'
,
};
console
.
log
(
e
);
return
;
}
};
...
...
@@ -262,6 +266,7 @@ exports.acceptDoctorRegReq = async ctx => {
error
:
'알 수 없는 에러가 발생했습니다.'
,
};
console
.
log
(
e
);
return
;
}
};
...
...
@@ -328,6 +333,7 @@ exports.acceptDoctorRegReq = async ctx => {
error
:
'알 수 없는 에러가 발생했습니다.'
,
};
console
.
log
(
e
);
return
;
}
};
...
...
@@ -396,6 +402,7 @@ exports.acceptDoctorRegReq = async ctx => {
error
:
'알 수 없는 에러가 발생했습니다.'
,
};
console
.
log
(
e
);
return
;
}
};
...
...
server/src/util/GoogleCloudStorage.js
View file @
d798dc6
...
...
@@ -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'
,
};
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
];
const
[
signedUrl
]
=
file
?
await
file
.
getSignedUrl
(
option
)
:
[
null
];
return
signedUrl
;
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'
,
};
const
[
signedUrl
]
=
file
?
await
file
.
getSignedUrl
(
option
)
:
[
null
];
return
signedUrl
;
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
];
return
signedUrl
;
}
catch
(
e
)
{
console
.
log
(
e
);
return
null
;
}
};
\ No newline at end of file
...
...
Please
register
or
login
to post a comment