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-09-18 23:45:30 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1a1d400354e9925746040df90debce96d986063c
1a1d4003
1 parent
151da409
feat. validate doctor license 수정 및, 검증 자격번호 인증 추가
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
4 deletions
server/src/api/manage/manage.ctrl.js
server/src/models/doctorInfo.js
server/src/api/manage/manage.ctrl.js
View file @
1a1d400
...
...
@@ -155,7 +155,7 @@ exports.acceptDoctorRegReq = async ctx => {
}
try
{
const
{
doctorId
}
=
ctx
.
request
.
body
;
const
{
doctorId
,
validateDoctorLicense
}
=
ctx
.
request
.
body
;
const
doctor
=
await
User
.
findOne
({
userId
:
doctorId
});
if
(
!
doctor
)
{
ctx
.
status
=
404
;
...
...
@@ -181,8 +181,26 @@ exports.acceptDoctorRegReq = async ctx => {
error
:
'의사로 가입된 회원이 아닙니다.'
,
};
return
;
}
else
if
(
!
validateDoctorLicense
)
{
ctx
.
status
=
400
;
ctx
.
body
=
{
error
:
'유효한 자격 번호가 아닙니다.'
,
};
return
;
}
const
existDoctorInfo
=
await
DoctorInfo
.
findOne
({
'info.validateDoctorLicense'
:
validateDoctorLicense
});
if
(
existDoctorInfo
)
{
ctx
.
status
=
403
;
ctx
.
body
=
{
error
:
'중복된 자격번호입니다.'
,
};
return
;
}
const
doctorInfo
=
await
DoctorInfo
.
findOne
({
doctorId
,
useYn
:
'W'
,
...
...
@@ -190,7 +208,9 @@ exports.acceptDoctorRegReq = async ctx => {
doctor
.
setUseYn
(
'Y'
);
doctor
.
save
();
doctorInfo
.
setUseYn
(
'Y'
);
doctorInfo
.
setValidateDoctorLicense
(
validateDoctorLicense
);
doctorInfo
.
save
();
ctx
.
status
=
200
;
...
...
@@ -296,12 +316,12 @@ exports.validateDoctorLicense = async ctx => {
return
;
}
const
{
d
octorLicense
}
=
ctx
.
request
.
body
;
const
doctorInfo
=
await
DoctorInfo
.
find
({
'info.doctorLicense'
:
d
octorLicense
});
const
{
validateD
octorLicense
}
=
ctx
.
request
.
body
;
const
doctorInfo
=
await
DoctorInfo
.
find
One
({
'info.validateDoctorLicense'
:
validateD
octorLicense
});
ctx
.
status
=
200
;
ctx
.
body
=
{
result
:
doctorInfo
.
length
>
1
?
false
:
true
,
result
:
doctorInfo
?
false
:
true
,
};
};
...
...
server/src/models/doctorInfo.js
View file @
1a1d400
...
...
@@ -6,6 +6,7 @@ const DoctorInfoSchema = new Schema({
doctorId
:
{
type
:
String
,
required
:
true
,
},
info
:
{
doctorLicense
:
{
type
:
String
,
required
:
true
,
},
validateDoctorLicense
:
{
type
:
String
,
default
:
null
},
hospitalNm
:
{
type
:
String
,
default
:
null
,
},
hospitalAddr
:
{
type
:
String
,
default
:
null
,
},
contact
:
{
type
:
String
,
required
:
true
,
},
...
...
@@ -23,5 +24,9 @@ DoctorInfoSchema.methods.setUseYn = function(useYn) {
this
.
useYn
=
useYn
;
};
DoctorInfoSchema
.
methods
.
setValidateDoctorLicense
=
function
(
validateDoctorLicense
)
{
this
.
info
.
validateDoctorLicense
=
validateDoctorLicense
;
};
module
.
exports
=
mongoose
.
model
(
'DoctorInfo'
,
DoctorInfoSchema
);
...
...
Please
register
or
login
to post a comment