get all tanker booking details

master
Bhaskara Kishore 3 years ago
parent 0d2f022d9e
commit 06342b492f

@ -299,6 +299,35 @@ exports.getTankersBookingdetails = async (req, reply) => {
}
};
exports.getAllTankersBookingdetails = async (req, reply) => {
try {
const supplierId = req.params.customerId
// const tankerName = req.query.tankerName
await Tankerbooking.find({ supplierId:supplierId })
.exec()
.then((docs) => {
reply.send({ status_code: 200, data: docs, count: docs.length });
})
.catch((err) => {
console.log(err);
reply.send({ error: err });
});
} catch (err) {
throw boom.boomify(err);
}
};
exports.addBores = async (req, reply) => {
try {

@ -327,6 +327,35 @@ module.exports = function (fastify, opts, next) {
handler: tankersController.getTankersBookingdetails,
});
fastify.get("/api/getAllTankersBookingdetails/:supplierId", {
schema: {
tags: ["Supplier"],
description: "This is for Get All Tanker Booking Data",
summary: "This is for to Get All Tanker Booking Data",
params: {
required: ["supplierId"],
type: "object",
properties: {
supplierId: {
type: "string",
description: "supplierId",
},
},
},
// querystring: {
// tankerName: {type: 'string'}
// },
security: [
{
basicAuth: [],
},
],
},
preHandler: fastify.auth([fastify.authenticate]),
handler: tankersController.getAllTankersBookingdetails,
});
fastify.get("/api/getBores", {
schema: {
tags: ["Supplier"],

Loading…
Cancel
Save