edited scheme but still not working
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
setTakeDateV2,
|
||||
setReturnDateV2,
|
||||
getLoanByCodeV2,
|
||||
openDoor,
|
||||
} from "./api.database.js";
|
||||
|
||||
// Route for API to get all items from the database
|
||||
@@ -79,4 +80,15 @@ router.post(
|
||||
}
|
||||
);
|
||||
|
||||
router.get("/open-door/:key/:doorKey", authenticate, async (req, res) => {
|
||||
const doorKey = req.params.doorKey;
|
||||
|
||||
const result = await openDoor(doorKey);
|
||||
if (result.success) {
|
||||
res.status(200).json({ data: result.data });
|
||||
} else {
|
||||
res.status(500).json({ message: "Failed to open door" });
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user