From f7ff8a837bed336a14aa0442ed8286f3ef78f577 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 1 Nov 2015 01:06:40 +0100 Subject: core: o Adding updates of device property's name and description. web: o Ading editing of property name and description. --- src/Diller.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/Diller.js') diff --git a/src/Diller.js b/src/Diller.js index 46dc8e2..dc4c5e7 100644 --- a/src/Diller.js +++ b/src/Diller.js @@ -21,13 +21,13 @@ function Diller(config, pg, dao) { function newName(dao, device, property, timestamp, name) { log.info('New name for property ', device.key + '/' + property.key + '.name = ' + name); - return dao.updatePropertyName(property.id, name); + return dao.updateProperty(property.id, {name: name}); } function newDescription(dao, device, property, timestamp, description) { log.info('New description for property ', device.key + '/' + property.key + '.description = ' + description); - return dao.updatePropertyDescription(property.id, description); + return dao.updateProperty(property.id, {description: description}); } function updateAggregates(propertyId, timestamp) { @@ -54,6 +54,14 @@ function Diller(config, pg, dao) { return dao.updateDevice(deviceId, attributes); } + function updatePropertyAttributes(propertyId, attributes) { + var x = _.clone(attributes); + x.propertyId = propertyId; + log.info('Updating property attributes', x); + + return dao.updateProperty(propertyId, attributes); + } + //noinspection JSUnusedLocalSymbols function onMessage(topic, message, payload) { var timestamp = new Date(); @@ -121,7 +129,8 @@ function Diller(config, pg, dao) { return { onMessage: onMessage, - updateDeviceAttributes: updateDeviceAttributes + updateDeviceAttributes: updateDeviceAttributes, + updatePropertyAttributes: updatePropertyAttributes } } -- cgit v1.2.3