From 1324be5bf3855bafa1182c82f7cabea8328a24da Mon Sep 17 00:00:00 2001 From: Eric Thieme-Garmann Date: Mon, 18 Jan 2021 11:09:07 +0100 Subject: [PATCH] Added display to getSketch() (#410) * 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 --- packages/api/lib/controllers/boxesController.js | 4 +++- packages/models/package.json | 2 +- packages/models/src/box/box.js | 3 ++- yarn.lock | 8 ++++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/api/lib/controllers/boxesController.js b/packages/api/lib/controllers/boxesController.js index 9b8f3e7f..17b2529f 100644 --- a/packages/api/lib/controllers/boxesController.js +++ b/packages/api/lib/controllers/boxesController.js @@ -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 @@ -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 diff --git a/packages/models/package.json b/packages/models/package.json index bd7f8540..6064b702 100644 --- a/packages/models/package.json +++ b/packages/models/package.json @@ -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", diff --git a/packages/models/src/box/box.js b/packages/models/src/box/box.js index f5f35e62..83115a6b 100644 --- a/packages/models/src/box/box.js +++ b/packages/models/src/box/box.js @@ -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; } @@ -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 }); }; diff --git a/yarn.lock b/yarn.lock index 5a44c99a..455302ce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"