// import necesary module
import express from 'express';
import verifyToken from '../middlewares/verifyToken.js';
import users from '../controllers/users';

const router = express.Router();

// API index endpoint
router.get('/', (req, res) => res.status(200).send({
  message: 'Welcome to Hello-books API',
}));

router.get('/borrowrequests', verifyToken, users.getBorrowRequests);
router.get('/returnrequests', verifyToken, users.getReturnRequests);

export default router;

@@ -148,16 +148,68 @@
 /users';
+%0Aimport checkAdmin from '../middlewares/checkAdmin';
 %0A%0Aconst 
@@ -358,16 +358,55 @@
 ,%0A%7D));%0A%0A
+// Endpoint to get all borrow requests%0A
 router.g
@@ -408,16 +408,19 @@
 ter.get(
+%0A  
 '/borrow
@@ -421,32 +421,34 @@
 borrowrequests',
+%0A 
  verifyToken, us
@@ -436,32 +436,48 @@
 ,%0A  verifyToken,
+%0A  checkAdmin,%0A 
  users.getBorrow
@@ -484,18 +484,60 @@
 Requests
+,%0A
 );
+%0A%0A// Endpoint to get all return requests
 %0Arouter.
@@ -540,16 +540,19 @@
 ter.get(
+%0A  
 '/return
@@ -561,16 +561,18 @@
 quests',
+%0A 
  verifyT
@@ -576,16 +576,32 @@
 fyToken,
+%0A  checkAdmin,%0A 
  users.g
@@ -616,16 +616,18 @@
 Requests
+,%0A
 );%0A%0Aexpo

Fix endpoint to get borrow requests and return requests