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-11 15:07:39 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8cf05dc9bfe24f904935980df24656ad8d4a752e
8cf05dc9
1 parent
047b4d21
style. code refactoring
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
38 deletions
server/src/api/auth/auth.ctrl.js
server/src/api/manage/manage.ctrl.js
server/src/api/user/user.ctrl.js
server/src/api/auth/auth.ctrl.js
View file @
8cf05dc
...
...
@@ -512,45 +512,28 @@ exports.secession = async ctx => {
}
if
(
user
.
userTypeCd
===
'NORMAL'
)
{
const
profile
=
await
Profile
.
findOne
({
userId
});
//프로필 삭제
await
profile
.
setUseYn
(
'N'
);
await
profile
.
save
();
await
Profile
.
updateOne
({
userId
},
{
useYn
:
'N'
});
//유저에 등록된 허브, 약병, 약병정보 전부 삭제
const
hubList
=
await
Hub
.
find
({
userId
});
await
Promise
.
all
(
hubList
.
map
(
async
hub
=>
{
const
bottleList
=
await
Bottle
.
find
({
hubId
:
hub
.
hubId
});
await
Promise
.
all
(
bottleList
.
map
(
async
bottle
=>
{
const
bottleMedicine
=
await
BottleMedicine
.
findOne
({
bottleId
:
bottle
.
bottleId
});
await
bottleMedicine
.
setUseYn
(
'N'
);
await
bottleMedicine
.
save
();
}));
await
Bottle
.
deleteMany
({
hubId
:
hub
.
hubId
});
}));
await
Hub
.
deleteMany
({
userId
});
//환자 정보 삭제
const
patientInfoList
=
await
PatientInfo
.
find
({
patientId
:
userId
,
useYn
:
'Y'
});
await
Promise
.
all
(
patientInfoList
.
map
(
async
patientInfo
=>
{
await
patientInfo
.
setUseYn
(
'N'
);
await
patientInfo
.
save
();
}));
await
PatientInfo
.
updateMany
({
patientId
:
userId
,
useYn
:
'Y'
},
{
useYn
:
'N'
});
//유저 삭제
await
user
.
setUseYn
(
'N'
);
await
user
.
save
();
}
else
if
(
user
.
userTypeCd
===
'DOCTOR'
)
{
const
doctorInfo
=
await
DoctorInfo
.
findOne
({
doctorId
:
userId
});
await
doctorInfo
.
setUseYn
(
'WS'
);
await
doctorInfo
.
save
();
//의사 정보 및 환자 정보 삭제
await
DoctorInfo
.
updateOne
({
doctorId
:
userId
},
{
useYn
:
'WS'
});
await
PatientInfo
.
updateMany
({
doctorId
:
userId
},
{
useYn
:
'WS'
});
await
user
.
setUseYn
(
'WS'
);
await
user
.
save
();
...
...
server/src/api/manage/manage.ctrl.js
View file @
8cf05dc
const
User
=
require
(
'../../models/user'
);
const
DoctorInfo
=
require
(
'../../models/doctorInfo'
);
const
PatientInfo
=
require
(
'../../models/patientInfo'
);
const
jwt
=
require
(
'jsonwebtoken'
);
const
{
viewDoctorLicense
}
=
require
(
'../../util/GoogleCloudStorage'
);
...
...
@@ -314,18 +315,11 @@ exports.acceptDoctorRegReq = async ctx => {
return
;
}
const
doctorInfo
=
await
DoctorInfo
.
findOne
({
doctorId
,
useYn
:
'W'
,
});
await
DoctorInfo
.
updateOne
({
doctorId
,
useYn
:
'W'
},
{
useYn
:
'N'
});
await
doctor
.
setUseYn
(
'N'
);
await
doctor
.
save
();
await
doctorInfo
.
setUseYn
(
'N'
);
await
doctorInfo
.
save
();
ctx
.
status
=
200
;
}
catch
(
e
)
{
...
...
@@ -388,17 +382,12 @@ exports.acceptDoctorRegReq = async ctx => {
}
const
doctorInfo
=
await
DoctorInfo
.
findOne
({
doctorId
,
useYn
:
'WS'
,
});
await
DoctorInfo
.
updateOne
({
doctorId
,
useYn
:
'WS'
},
{
useYn
:
'N'
});
await
PatientInfo
.
updateMany
({
doctorId
:
userId
,
useYn
:
'WS'
},
{
useYn
:
'N'
});
await
doctor
.
setUseYn
(
'N'
);
await
doctor
.
save
();
await
doctorInfo
.
setUseYn
(
'N'
);
await
doctorInfo
.
save
();
ctx
.
status
=
200
;
}
catch
(
e
)
{
...
...
server/src/api/user/user.ctrl.js
View file @
8cf05dc
...
...
@@ -168,7 +168,10 @@ exports.viewAllDoctorRegisterReq = async ctx => {
})
const
doctorReqList
=
await
Promise
.
all
(
patientInfoList
.
map
(
async
patientInfo
=>
{
const
doctor
=
await
DoctorInfo
.
findOne
({
doctorId
:
patientInfo
.
doctorId
});
const
doctor
=
await
DoctorInfo
.
findOne
({
doctorId
:
patientInfo
.
doctorId
,
useYn
:
'Y'
,
});
return
{
patientId
:
patientInfo
.
patientId
,
doctorId
:
patientInfo
.
doctorId
,
...
...
Please
register
or
login
to post a comment