박권수

fix. db update and modify error fix

......@@ -2,16 +2,16 @@
const Hub = require('../../models/hub');
const Mqtt = require('../../lib/MqttModule');
exports.hubRegister = async (ctx) => {
exports.hubConnect = async (ctx) => {
const { host, port, hubId, topic } = ctx.request.body;
const hub = new Hub({
const hub = {
hubId,
hosting : {
host,
port
}
});
};
await Hub.findOneAndUpdate({
hubId
......@@ -24,4 +24,8 @@ exports.hubRegister = async (ctx) => {
ctx.body = 'host :' + host;
ctx.status = 200;
}
exports.hubDisconnect = async(ctx) => {
}
\ No newline at end of file
......
......@@ -38,22 +38,22 @@ const getItemsList = async(queryUrl) => {
}
//itemArray에 있는 모든 data를 MongoDB의 SMB collections에 저장함
const exportJsonData = async(itemList) => {
const exportJsonData = (itemList) => {
itemList.forEach(item => {
const medicine = new Medicine({
medicineId : item.itemSeq,
const medicineId = item.itemSeq;
const medicineInfo = {
name : item.itemName,
company : item.entpName,
target : item.efcyQesitm,
dosage : item.useMethodQesitm,
warn : item.atpnWarnQesitm + '\n\n' + item.atpnQesitm,
antiEffect : item.seQesitm
})
};
Medicine.findOneAndUpdate({
medicineId : medicine.medicineId
}, medicine, {
medicineId
}, medicineInfo, {
upsert : true
})
}).exec();
})
}
\ No newline at end of file
......