const express = require("express") const router = express.Router() const userController = require("../controllers/user") const orderController = require("../controllers/order") const auth = require("../auth"); const { authenticateToken, verifyAdmin, verifyUser } = auth; // User registration route router.post("/register", userController.registerUser) // User authentication route router.post("/authenticate", userController.authenticateUser) // Update user data route router.put("/update", authenticateToken, userController.updateUserData) // POST /users/order router.post("/order", orderController.createOrder); // Retrieve user details router.get('/retrieveUser', authenticateToken, verifyUser, userController.getUserDetails); // EXCLUSIVE ADMIN ACCOUNT // Set user to Admin User router.post('/set-admin', authenticateToken, verifyAdmin, userController.setAdmin); // Route to retrieve authenticated user's orders router.post("/getOrders", authenticateToken, verifyUser, orderController.getOrders); // Route to retrieve all orders router.get("/orders-all", authenticateToken, verifyAdmin, orderController.getAllOrders); module.exports = router