backend validation wip

This commit is contained in:
newtbot
2024-01-02 02:53:44 +08:00
parent a058b1ba70
commit 6342d5a4cb
13 changed files with 410 additions and 211 deletions

View File

@ -23,8 +23,8 @@ router.get("/", async (req, res, next) => {
router.post("/new", async (req, res, next) => {
try {
const { sensortype, added_by, description, location } = req.body;
await addSensor(sensortype, added_by, description, location);
const { sensorname, added_by, mac_address , description, location } = req.body;
await addSensor(sensorname, added_by, mac_address ,description, location);
} catch (error) {
console.error(error);
next(error);
@ -33,8 +33,8 @@ router.post("/new", async (req, res, next) => {
router.put("/update", async (req, res, next) => {
try {
const { id, sensortype, added_by, description, location } = req.body;
await updateSensor(id, sensortype, added_by, description, location);
const { id, sensorname, added_by, mac_address ,description, location } = req.body;
await updateSensor(id, sensorname, added_by, mac_address , description, location);
} catch (error) {
console.error(error);
next(error);