Browse Source

🔨 Rename influx actions to avoid conflict with npm package

main
Haris Razis 4 years ago
parent
commit
341b85dc48
No known key found for this signature in database GPG Key ID: 86A4D290ED03FAB4
  1. 6
      server/actions/influx_actions.js
  2. 4
      server/services/socket.js

6
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}

4
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)
})
});
}
Loading…
Cancel
Save