diff --git a/server/actions/influx_actions.js b/server/actions/influx_actions.js index c7edb1e..a787e8a 100644 --- a/server/actions/influx_actions.js +++ b/server/actions/influx_actions.js @@ -4,7 +4,7 @@ const chalk = require('chalk') const {writeApi, queryApi} = require('../connections/influx_conn') const {bucket} = require('../config/keys') -write = (pointName, uuid, measurement) => { +iWrite = (pointName, uuid, measurement) => { const point = new Point(pointName) .tag('client', uuid) .floatField('value', measurement); @@ -26,7 +26,7 @@ closeWrite = () => { }); } -query = (timeFrame, filter) => { +iPoint = (timeFrame, filter) => { const query = `from(bucket: "${bucket}") |> range(start: -${timeFrame}) |> group(columns: ["client"]) |> filter(fn: (r) => r._measurement == "${filter}")`; @@ -39,4 +39,4 @@ query = (timeFrame, filter) => { }); } -module.exports = {write, closeWrite, query} +module.exports = {iWrite, closeWrite, iPoint} diff --git a/server/services/socket.js b/server/services/socket.js index 1ed9c50..d32ac51 100644 --- a/server/services/socket.js +++ b/server/services/socket.js @@ -2,7 +2,7 @@ const socket = require('socket.io'); const chalk = require('chalk'); const {pub, sub} = require('../connections/redis_conn') -const {write, closeWrite, query} = require('../actions/influx_actions') +const {iWrite, closeWrite, iQuery} = require('../actions/influx_actions') module.exports = (server) => { // noinspection JSValidateTypes @@ -19,7 +19,7 @@ module.exports = (server) => { const {measurement, pointName} = data; pub.publish('data', measurement); - write(socket.id, measurement, pointName) + iWrite(pointName, socket.id, measurement) }) }); } \ No newline at end of file