created get booking data of a tanker

master
varun 3 years ago
parent 0bdd1ad280
commit e3b00c6782

@ -174,6 +174,29 @@ exports.getTanker = async (req, reply) => {
} }
}; };
exports.getTankersBookingdetails = async (req, reply) => {
try {
const customerId = req.params.customerId
const tankerName = req.query.tankerName
await Tankerbooking.find({ customerId:customerId,tankerName: tankerName, }
.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) => { exports.addBores = async (req, reply) => {
try { try {

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

Loading…
Cancel
Save