made changes in supplier and delivery

master
varun 3 years ago
parent 0f11d82f36
commit a712ecb43b

@ -110,3 +110,39 @@ exports.orderNow = async (req, reply) => {
throw boom.boomify(err);
}
};
exports.getbookingsofsupplier = async (req, reply) => {
try {
console.log(req.params.supplierId)
await Tankerbooking.find({supplierId: req.params.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.getbookingsofdeliveryboy = async (req, reply) => {
try {
console.log(req.params.supplierId)
await Tankerbooking.find({delivery_agent_mobile: req.params.agent_mobile})
.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);
}
};

@ -105,6 +105,57 @@ module.exports = function (fastify, opts, next) {
fastify.get("/api/getsupplierbookings/:supplierId", {
schema: {
tags: ["Supplier"],
description: "This is for Get supplier bookings Data",
summary: "This is for to Get supplier bookings Data",
params: {
required: ["supplierId"],
type: "object",
properties: {
supplierId: {
type: "string",
description: "supplierId",
},
},
},
security: [
{
basicAuth: [],
},
],
},
preHandler: fastify.auth([fastify.authenticate]),
handler: supplierOrderController.getbookingsofsupplier,
});
fastify.get("/api/getdeliveryboybookings/:agent_mobile", {
schema: {
tags: ["Supplier"],
description: "This is for Get delivery bookings Data",
summary: "This is for to Get delivery bookings Data",
params: {
required: ["agent_mobile"],
type: "object",
properties: {
agent_mobile: {
type: "string",
description: "agent_mobile",
},
},
},
security: [
{
basicAuth: [],
},
],
},
preHandler: fastify.auth([fastify.authenticate]),
handler: supplierOrderController.getbookingsofdeliveryboy,
});
next();
}

Loading…
Cancel
Save