iot sensor finished
1)with validation on front and backend 2)fixed seed route generating value 0 for data
This commit is contained in:
23
IoT-sensor/functions/dbFunctions.js
Normal file
23
IoT-sensor/functions/dbFunctions.js
Normal file
@ -0,0 +1,23 @@
|
||||
const { locationModel } = require("../Database/locationModel");
|
||||
const { sensorModel } = require("../Database/sensorModel");
|
||||
|
||||
async function getLocation() {
|
||||
const location = locationModel.findAll({
|
||||
raw: true,
|
||||
order: [["id", "ASC"]],
|
||||
attributes: ["id"],
|
||||
});
|
||||
return location;
|
||||
}
|
||||
|
||||
async function getSensor() {
|
||||
const sensor = sensorModel.findAll({
|
||||
raw: true,
|
||||
order: [["id", "ASC"]],
|
||||
attributes: ["id"],
|
||||
});
|
||||
return sensor;
|
||||
}
|
||||
|
||||
|
||||
module.exports = { getLocation, getSensor };
|
Reference in New Issue
Block a user