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-06 20:25:57 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
efe8dc3335860caa246e464acbe3835a8fd9c0bc
efe8dc33
1 parent
fd00b32a
fix. db update and modify error fix
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
10 deletions
server/src/api/hub/hub.ctrl.js
server/src/lib/UpdatingMedicineInfo.js
server/src/api/hub/hub.ctrl.js
View file @
efe8dc3
...
...
@@ -2,16 +2,16 @@
const
Hub
=
require
(
'../../models/hub'
);
const
Mqtt
=
require
(
'../../lib/MqttModule'
);
exports
.
hub
Register
=
async
(
ctx
)
=>
{
exports
.
hub
Connect
=
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
...
...
server/src/lib/UpdatingMedicineInfo.js
View file @
efe8dc3
...
...
@@ -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
medicine
Id
=
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
},
medicine
Info
,
{
upsert
:
true
})
})
.
exec
();
})
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment