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-05-14 15:29:31 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
70183771e0ddb4255556b1b187ff587a5e7a6c84
70183771
1 parent
7cfd01fe
feat. RESTful now
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
7 deletions
server/src/api/bottle/index.js
server/src/api/hub/index.js
server/src/api/medicine/index.js
server/src/api/medicine/medicine.ctrl.js
server/src/api/bottle/index.js
View file @
7018377
...
...
@@ -3,9 +3,9 @@ const bottleCtrl = require('./bottle.ctrl');
const
bottle
=
new
Router
();
bottle
.
post
(
'/
connect
'
,
bottleCtrl
.
bottleConnect
);
bottle
.
post
(
'/disconnect
/:bottleId'
,
bottleCtrl
.
bottleDisconnect
);
bottle
.
post
(
'/lookupInfo
/:bottleId'
,
bottleCtrl
.
lookupInfo
);
bottle
.
p
ost
(
'/setmedicine
/:bottleId'
,
bottleCtrl
.
setMedicine
);
bottle
.
post
(
'/'
,
bottleCtrl
.
bottleConnect
);
bottle
.
delete
(
'
/:bottleId'
,
bottleCtrl
.
bottleDisconnect
);
bottle
.
get
(
'
/:bottleId'
,
bottleCtrl
.
lookupInfo
);
bottle
.
p
atch
(
'
/:bottleId'
,
bottleCtrl
.
setMedicine
);
module
.
exports
=
bottle
;
\ No newline at end of file
...
...
server/src/api/hub/index.js
View file @
7018377
...
...
@@ -3,7 +3,7 @@ const hubCtrl = require('./hub.ctrl');
const
hub
=
new
Router
();
hub
.
post
(
'/
connect
'
,
hubCtrl
.
hubConnect
);
hub
.
post
(
'/disconnect
/:hubId'
,
hubCtrl
.
hubDisconnect
);
hub
.
post
(
'/'
,
hubCtrl
.
hubConnect
);
hub
.
delete
(
'
/:hubId'
,
hubCtrl
.
hubDisconnect
);
module
.
exports
=
hub
;
\ No newline at end of file
...
...
server/src/api/medicine/index.js
View file @
7018377
...
...
@@ -3,6 +3,7 @@ const medicineCtrl = require('./medicine.ctrl');
const
medicine
=
new
Router
();
medicine
.
get
(
'/search'
,
medicineCtrl
.
medicineSearch
);
medicine
.
post
(
'/'
,
medicineCtrl
.
medicineSearch
);
medicine
.
get
(
'/:medicineId'
,
medicineCtrl
.
medicineGet
);
module
.
exports
=
medicine
;
\ No newline at end of file
...
...
server/src/api/medicine/medicine.ctrl.js
View file @
7018377
...
...
@@ -28,6 +28,25 @@ exports.medicineSearch = async(ctx) => {
}
}
exports
.
medicineGet
=
async
(
ctx
)
=>
{
const
token
=
ctx
.
cookies
.
get
(
'access_token'
);
if
(
!
token
)
{
ctx
.
status
=
401
;
return
;
}
const
{
medicineId
}
=
ctx
.
params
;
const
medicine
=
await
Medicine
.
findByMedicineId
(
medicineId
);
if
(
!
medicine
)
{
ctx
.
status
=
404
;
return
;
}
ctx
.
status
=
200
;
ctx
.
body
=
medicine
;
}
//이름으로 약 검색
const
medicineSearch_ByName
=
async
(
name
)
=>
{
const
result
=
await
Medicine
.
findByName
(
name
);
...
...
Please
register
or
login
to post a comment