Skip to content

Commit

Permalink
Added display to getSketch() (#410)
Browse files Browse the repository at this point in the history
* Added display to getSketch()

* update templater version

* build for dockerhub

* new templater version

* bumped templater version

* eslint

* remove branch from testing

Co-authored-by: umut0 <[email protected]>
  • Loading branch information
Thiemann96 and umut0 authored Jan 18, 2021
1 parent 89ccceb commit 1324be5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion packages/api/lib/controllers/boxesController.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,8 @@ const getSketch = async function getSketch (req, res, next) {
password: req._userParams.password,
devEUI: req._userParams.devEUI,
appEUI: req._userParams.appEUI,
appKey: req._userParams.appKey
appKey: req._userParams.appKey,
display_enabled: req._userParams.display_enabled
};

// pass access token only if useAuth is true and access_token is available
Expand Down Expand Up @@ -497,6 +498,7 @@ module.exports = {
{ name: 'devEUI', dataType: 'StringWithEmpty' },
{ name: 'appEUI', dataType: 'StringWithEmpty' },
{ name: 'appKey', dataType: 'StringWithEmpty' },
{ name: 'display_enabled', allowedValues: ['true', 'false'] },
]),
checkPrivilege,
getSketch
Expand Down
2 changes: 1 addition & 1 deletion packages/models/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"dependencies": {
"@sensebox/osem-protos": "^1.1.0",
"@sensebox/sketch-templater": "^1.8.3",
"@sensebox/sketch-templater": "^1.9.0",
"bcrypt": "^5.0.0",
"bunyan": "^1.8.14",
"config": "^3.3.3",
Expand Down
3 changes: 2 additions & 1 deletion packages/models/src/box/box.js
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ boxSchema.methods.updateSensors = function updateSensors (sensors) {
}
};

boxSchema.methods.getSketch = function getSketch ({ encoding, serialPort, soilDigitalPort, soundMeterPort, windSpeedPort, ssid, password, devEUI, appEUI, appKey, access_token } = {}) {
boxSchema.methods.getSketch = function getSketch ({ encoding, serialPort, soilDigitalPort, soundMeterPort, windSpeedPort, ssid, password, devEUI, appEUI, appKey, access_token, display_enabled } = {}) {
if (serialPort) {
this.serialPort = serialPort;
}
Expand All @@ -837,6 +837,7 @@ boxSchema.methods.getSketch = function getSketch ({ encoding, serialPort, soilDi
this.appEUI = appEUI,
this.appKey = appKey;
this.access_token = access_token;
this.display_enabled = display_enabled;

return templateSketcher.generateSketch(this, { encoding });
};
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
resolved "https://registry.yarnpkg.com/@sensebox/osem-protos/-/osem-protos-1.1.0.tgz#a7de8bc6be867953f1309181a012063c23299e79"
integrity sha512-H+nUVcWlT0dvIqfJnYHuX9JBcCkP1ZKGE5YTRNWPbAEdZ11h+srpQsmeI58wK5hJcdukaZAjc4Dy96IeGM77aA==

"@sensebox/sketch-templater@^1.8.3":
version "1.8.3"
resolved "https://registry.yarnpkg.com/@sensebox/sketch-templater/-/sketch-templater-1.8.3.tgz#16fe48afdd2e472ab443e5d21890b59ec8701cd9"
integrity sha512-oKKgv6foFzoiTcyCeZEnycOshyE5owh8Xsjk3a0YuhfG+pLwd9EN4maV7jW6IPcmtSXtaTEICoB+H9K7DiAyLQ==
"@sensebox/sketch-templater@^1.9.0":
version "1.9.0"
resolved "https://registry.yarnpkg.com/@sensebox/sketch-templater/-/sketch-templater-1.9.0.tgz#ef7d3222242dffc1e060f7ea843a6c2a1a090662"
integrity sha512-wciob8MREljN16Th4VgPOQRUFeOT2rh3uXjdYk++Xs2ir3psGZ/iY9ft1mMW3RaTbSPNz1vICtJNgCelxHxodA==
dependencies:
config "^1.29.2"
dedent "^0.7.0"
Expand Down

0 comments on commit 1324be5

Please sign in to comment.