From 37973554c9cf28d8ae095cd47e8db1de0788715e Mon Sep 17 00:00:00 2001 From: cse47122 Date: Fri, 25 Dec 2020 15:47:01 +0000 Subject: [PATCH] Delete 'fake-device-connection.js' --- fake-device-connection.js | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 fake-device-connection.js diff --git a/fake-device-connection.js b/fake-device-connection.js deleted file mode 100644 index 2bcb2e0..0000000 --- a/fake-device-connection.js +++ /dev/null @@ -1,37 +0,0 @@ -const influx = require('./influx')() - -module.exports = function () { - /** - * Generates writepoints for influx bluk write operation - */ - const getWritePoints = (deviceId, data) => { - let writePoints = [] - // itterate all data chunks - data.forEach(chunk => { - // and for each data chunk key, create measurement and push it into writePoint (bulk-write) - Object - .keys(chunk) - .filter(measurement => measurement !== 'timestamp') - .forEach(measurement => { - writePoints.push({ - measurement, - tags: { - deviceId - }, - fields: { - value: chunk[measurement] - }, - timestamp: chunk['timestamp'] - }) - }) - }) - return writePoints - } - - const send = function (deviceId, data) { - return influx.writePoints(getWritePoints(deviceId, data)) - } - return { - send - } -}