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-08-21 18:22:27 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
d2e48e9aeca40a44ce7d6ee33a9d3120ed2b0147
d2e48e9a
2 parents
49de8694
0137e2d3
Merge branch 'server' into web
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
4 deletions
server/src/api/auth/auth.ctrl.js
server/src/api/manage/manage.ctrl.js
server/src/api/auth/auth.ctrl.js
View file @
d2e48e9
...
...
@@ -29,12 +29,18 @@ exports.register = async(ctx) => {
const
result
=
schema
.
validate
(
ctx
.
request
.
body
);
if
(
result
.
error
||
password
!==
passwordCheck
)
{
ctx
.
status
=
400
;
ctx
.
body
=
{
error
:
'회원가입 양식이 잘못되었습니다.'
,
};
return
;
}
const
existUser
=
await
User
.
findByUserId
(
userId
);
if
(
existUser
)
{
ctx
.
status
=
409
;
ctx
.
body
=
{
error
:
'이미 존재하는 회원입니다.'
,
};
return
;
}
...
...
@@ -78,13 +84,33 @@ exports.doctorRegister = async ctx => {
const
result
=
schema
.
validate
(
ctx
.
request
.
body
);
if
(
result
.
error
||
password
!==
passwordCheck
)
{
ctx
.
status
=
400
;
ctx
.
body
=
{
error
:
'회원가입 양식이 잘못되었습니다.'
,
};
return
;
}
const
existUser
=
await
User
.
findByUserId
(
userId
);
const
existDoctorInfo
=
await
DoctorInfo
.
findByDoctorId
(
userId
);
if
(
existUser
||
existDoctorInfo
)
{
if
(
existUser
)
{
ctx
.
status
=
409
;
ctx
.
body
=
{
error
:
'이미 존재하는 회원입니다.'
,
};
return
;
}
const
existDoctorInfo
=
await
DoctorInfo
.
findByDoctorId
(
userId
);
if
(
existDoctorInfo
.
useYn
===
'W'
)
{
ctx
.
status
=
401
;
ctx
.
body
=
{
error
:
'가입 승인 대기중인 회원입니다.'
,
};
return
;
}
else
if
(
existDoctorInfo
.
useYn
===
'N'
)
{
ctx
.
status
=
401
;
ctx
.
body
=
{
error
:
'가입이 거절된 회원입니다.'
,
};
return
;
}
...
...
@@ -121,23 +147,35 @@ exports.login = async(ctx) => {
const
result
=
schema
.
validate
(
ctx
.
request
.
body
);
if
(
result
.
error
)
{
ctx
.
status
=
400
;
ctx
.
body
=
{
error
:
'로그인 양식이 잘못되었습니다.'
,
};
return
;
}
const
user
=
await
User
.
findByUserId
(
userId
);
if
(
!
user
||
!
user
.
userTypeCd
)
{
ctx
.
stauts
=
401
;
ctx
.
body
=
{
error
:
'존재하지 않는 회원입니다.'
,
};
return
;
}
const
isPasswordTrue
=
await
user
.
checkPassword
(
password
);
if
(
!
isPasswordTrue
)
{
ctx
.
status
=
401
;
ctx
.
body
=
{
error
:
'비밀번호가 틀렸습니다.'
,
};
return
;
}
if
(
user
.
useYn
!==
'Y'
)
{
ctx
.
status
=
403
;
ctx
.
body
=
{
error
:
'가입 대기중이거나 탈퇴한 회원입니다.'
,
};
return
;
}
...
...
server/src/api/manage/manage.ctrl.js
View file @
d2e48e9
...
...
@@ -98,7 +98,7 @@ exports.getDoctorRegReqDetail = async ctx => {
ctx
.
status
=
400
;
ctx
.
body
=
{
error
:
'이미 의사 인증이 완료된 회원입니다.'
};
1
};
return
;
}
else
if
(
doctorInfo
.
useYn
===
'N'
)
{
ctx
.
status
=
400
;
...
...
@@ -118,7 +118,6 @@ exports.getDoctorRegReqDetail = async ctx => {
ctx
.
body
=
{
error
:
'알 수 없는 에러가 발생했습니다.'
,
};
console
.
log
(
e
);
}
};
...
...
@@ -172,8 +171,15 @@ exports.acceptDoctorRegReq = async ctx => {
return
;
}
const
doctorInfo
=
await
DoctorInfo
.
findOne
({
doctorId
,
useYn
:
'W'
,
});
doctor
.
setUseYn
(
'Y'
);
doctor
.
save
();
doctorInfo
.
setUseYn
(
'Y'
);
doctorInfo
.
save
();
ctx
.
status
=
200
;
...
...
@@ -236,8 +242,16 @@ exports.acceptDoctorRegReq = async ctx => {
return
;
}
const
doctorInfo
=
await
DoctorInfo
.
findOne
({
doctorId
,
useYn
:
'W'
,
});
doctor
.
setUseYn
(
'N'
);
doctor
.
save
();
doctorInfo
.
setUseYn
(
'N'
);
doctorInfo
.
save
();
ctx
.
status
=
200
;
...
...
Please
register
or
login
to post a comment