Update CSS, add relationship between sensorModel and locationModel, and remove console.log statements
This commit is contained in:
@ -18,15 +18,19 @@ async function getSensorData() {
|
||||
const sensorData = await sensorDataModel.findAll();
|
||||
return sensorData;
|
||||
}
|
||||
|
||||
let dataArray = [];
|
||||
async function addSensorData(id_sensor, id_location, sensordata) {
|
||||
const sensorData = await sensorDataModel.create({
|
||||
sensorid: id_sensor,
|
||||
locationid: id_location,
|
||||
measurement: sensordata,
|
||||
locationid: id_location ,
|
||||
measurement: sensordata.measurement,
|
||||
});
|
||||
io().emit('sensorData:new', sensorData)
|
||||
|
||||
//console.log("sensorData", sensorData);
|
||||
//console.log("sensorData", sensordata);
|
||||
dataArray.push(sensordata);
|
||||
console.log("dataArray", dataArray);
|
||||
|
||||
io().emit('sensorData:new', dataArray)
|
||||
return sensorData;
|
||||
}
|
||||
|
||||
@ -61,6 +65,14 @@ async function getSensorDataById(id) {
|
||||
});
|
||||
return sensorData;
|
||||
}
|
||||
|
||||
async function getLatestData() {
|
||||
const sensorData = await sensorDataModel.findAll({
|
||||
limit: 1,
|
||||
order: [["createdAt", "DESC"]],
|
||||
});
|
||||
return sensorData;
|
||||
}
|
||||
var ormQuery = {};
|
||||
var whereClause = {};
|
||||
var whereDate = {};
|
||||
@ -724,5 +736,6 @@ module.exports = {
|
||||
getSensorDataById,
|
||||
getData,
|
||||
getDatabyRange,
|
||||
getLatestData,
|
||||
|
||||
};
|
Reference in New Issue
Block a user