diff --git a/src/microservices/Request.js b/src/microservices/Request.js index 66d4911..91c6cad 100644 --- a/src/microservices/Request.js +++ b/src/microservices/Request.js @@ -16,13 +16,16 @@ async function getProductCategory(req, res) { } async function getFilteredByCategoryRequest(req, res) { - const response = await baseGet( - `${request}/requests/${req.params.categoryId}` + const { usermail } = req.query; + const response = await queryGet( + `${request}/requests/available/${req.params.categoryId}`, + { + usermail, + } ); - const requests = response.data.requests; + const { requests } = response.data; const mergedUserWithRequest = await mergeUserDataFromRequest(requests); - - res.json(mergedUserWithRequest); + res.status(200).json(mergedUserWithRequest); } async function createProductCategory(req, res) { diff --git a/src/routes/request.routes.js b/src/routes/request.routes.js index c4b787e..5b70421 100644 --- a/src/routes/request.routes.js +++ b/src/routes/request.routes.js @@ -5,7 +5,10 @@ import Request from '../microservices/Request.js'; const requestRouter = Router(); requestRouter.get('/request', Request.getRequest); -requestRouter.get('/request/:categoryId', Request.getFilteredByCategoryRequest); +requestRouter.get( + '/request/available/:categoryId', + Request.getFilteredByCategoryRequest +); requestRouter.post('/request', Request.createRequest); requestRouter.put('/request/:id', Request.updateRequest); requestRouter.delete('/request/:id', Request.deleteRequest);