tanker order accepted and rejected

master
Bhaskara Kishore 3 years ago
parent f01063df28
commit 43c14a804d

@ -327,6 +327,31 @@ exports.getAllTankersBookingdetails = async (req, reply) => {
};
exports.getAllTankersaccepted = async (req, reply) => {
const limit = parseInt(req.query.limit) || 100;
const page = parseInt(req.query.page) || 1;
const startindex = (page - 1) * limit;
const supplierId = req.params.supplierId
try {
await Tankerbooking.find( { supplierId, orderStatus: ["accepted","rejected"] })
.limit(limit)
.skip(startindex)
.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 {
@ -608,3 +633,4 @@ exports.connectstatus = async (req, reply) => {
};

@ -675,6 +675,30 @@ module.exports = function (fastify, opts, next) {
handler: tankersController.connectstatus,
});
fastify.get("/api/alltankersaccepted/:supplierId", {
schema: {
tags: ["Supplier-Order"],
description: "This is for Get All connected and rejected for Suppliers",
summary: "This is for to Get All connected and rejected for suppliers",
params: {
type: "object",
properties: {
supplierId: {
type: "string",
description: "supplierId",
},
},
},
security: [
{
basicAuth: [],
},
],
},
handler: tankersController.getAllTankersaccepted,
});
next();
}

Loading…
Cancel
Save