diff --git a/server/src/class/Database.ts b/server/src/class/Database.ts index 0165138..bcd8950 100644 --- a/server/src/class/Database.ts +++ b/server/src/class/Database.ts @@ -68,7 +68,11 @@ export class Database { let formatedData: Array<{}> = []; rawData.forEach((element: any) => { - formatedData.push({ time: element._time, value: element._value }); + formatedData.push({ + client: element.client, + time: element._time, + value: element._value, + }); }); return formatedData; diff --git a/server/src/routes/Routes.ts b/server/src/routes/Routes.ts index 5621bb4..1c1bc15 100644 --- a/server/src/routes/Routes.ts +++ b/server/src/routes/Routes.ts @@ -1,5 +1,4 @@ import * as express from 'express'; -import { Database } from '../class/Database'; import { Service } from '../class/Service'; export class Routes { @@ -39,17 +38,14 @@ export class Routes { private measurements(): void { this.app.get('/measurements', async (req, res) => { - req.on('data', async (data) => { - const { filter, timeFrame } = JSON.parse(data); - const points = await this.service.database.query('temperature', '5m'); + const points = await this.service.database.query('temperature', '1h'); - res.header('Content-Type', 'application/json'); - if (points) { - res.send(JSON.stringify(points)); - } else { - res.send(JSON.stringify({})); - } - }); + res.header('Content-Type', 'application/json'); + if (points) { + res.send(JSON.stringify(points)); + } else { + res.send(JSON.stringify({})); + } }); }