박권수

feat. bottle extra logic

...@@ -23,6 +23,17 @@ exports.lookupInfo = async(ctx) => { ...@@ -23,6 +23,17 @@ exports.lookupInfo = async(ctx) => {
23 } 23 }
24 } 24 }
25 25
26 +//약병의 ID를 찾아서 약의 정보를 등록 : Post
27 +exports.setMedicine = async(ctx) => {
28 + const { medicineId, bottleId } = ctx.request.body;
29 +
30 + await Bottle.findOneAndUpdate({
31 + bottleId
32 + }, { medicineId });
33 +
34 + ctx.status = 200;
35 +}
36 +
26 const dataRequest = () => { 37 const dataRequest = () => {
27 return 'dataRequest' 38 return 'dataRequest'
28 } 39 }
......
...@@ -4,5 +4,6 @@ const bottleCtrl = require('./bottle.ctrl'); ...@@ -4,5 +4,6 @@ const bottleCtrl = require('./bottle.ctrl');
4 const bottle = new Router(); 4 const bottle = new Router();
5 5
6 bottle.post('/lookupInfo', bottleCtrl.lookupInfo); 6 bottle.post('/lookupInfo', bottleCtrl.lookupInfo);
7 +bottle.post('/setmedicine', bottleCtrl.setMedicine);
7 8
8 module.exports = bottle; 9 module.exports = bottle;
...\ No newline at end of file ...\ No newline at end of file
......