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-24 14:16:29 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5cc3d5dcab3d7cf4eef40124af1a6bb9c78efe70
5cc3d5dc
1 parent
f3b7b439
feat. new bottle update
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
server/src/api/bottle/bottle.ctrl.js
server/src/api/bottle/bottle.ctrl.js
View file @
5cc3d5d
...
...
@@ -100,8 +100,8 @@ exports.lookupInfo = async(ctx) => {
const
{
userId
}
=
jwt
.
verify
(
token
,
process
.
env
.
JWT_SECRET
);
const
{
bottleId
}
=
ctx
.
params
;
const
bottle
=
await
Bottle
.
findByBottleId
(
bottleId
);
if
(
!
bottle
)
{
const
isBottleExist
=
await
Bottle
.
findByBottleId
(
bottleId
);
if
(
!
isBottleExist
)
{
ctx
.
status
=
404
;
return
;
}
...
...
@@ -117,7 +117,9 @@ exports.lookupInfo = async(ctx) => {
const
client
=
await
Mqtt
.
mqttOn
(
hosting
);
const
topic
=
'bottle/'
+
bottleId
+
'/stb'
;
const
message
=
'req'
;
Mqtt
.
mqttPublishMessage
(
client
,
{
topic
,
message
});
await
Mqtt
.
mqttPublishMessage
(
client
,
{
topic
,
message
});
const
bottle
=
await
Bottle
.
findByBottleId
(
bottleId
);
ctx
.
status
=
200
;
ctx
.
body
=
bottle
;
...
...
Please
register
or
login
to post a comment