get all suppliers

master^2
Varun 3 months ago
parent 3ab01f802f
commit 9711c0a409

@ -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);
}
};

@ -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
});

Loading…
Cancel
Save