diff --git a/src/controllers/userController.js b/src/controllers/userController.js index 6e940856..2baa3d23 100644 --- a/src/controllers/userController.js +++ b/src/controllers/userController.js @@ -1484,3 +1484,20 @@ exports.getordersofcustomer = async (req, reply) => { throw boom.boomify(err); } }; + + + +exports.getallsuppliers = async (req, reply) => { + try { + // Find the specific tank + const suppliers = await Supplier.find({ + }); + if (!suppliers) { + return reply.send({ status_code: 404, error: "suppliers not found" }); + } + // Send the found tank within a list + reply.send({ status_code: 200, data: [suppliers] }); + } catch (err) { + throw boom.boomify(err); + } +}; \ No newline at end of file diff --git a/src/routes/usersRoute.js b/src/routes/usersRoute.js index cd8970a3..354728d1 100644 --- a/src/routes/usersRoute.js +++ b/src/routes/usersRoute.js @@ -1231,7 +1231,16 @@ fastify.route({ handler: userController.getordersofcustomer }); - +fastify.route({ + method: "GET", + url: "/api/getallsuppliers", + schema: { + tags: ["User"], + description: "Get all suppliers for showing", + summary: "Get all suppliers for showing", + }, + handler: userController.getallsuppliers + });