diff --git a/src/controllers/tankersController.js b/src/controllers/tankersController.js index 87a0e381..1164d0f1 100644 --- a/src/controllers/tankersController.js +++ b/src/controllers/tankersController.js @@ -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 { diff --git a/src/routes/tankersRoute.js b/src/routes/tankersRoute.js index 8a539ada..42d3a2c0 100644 --- a/src/routes/tankersRoute.js +++ b/src/routes/tankersRoute.js @@ -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"],