varun 2 years ago
commit 68036ab6d6

@ -648,6 +648,25 @@ exports.getAllOrderreject = async (req, reply) => {
}
};
exports.getCustomerOrderreject = async (req, reply) => {
const limit = parseInt(req.query.limit) || 100;
const page = parseInt(req.query.page) || 1;
const startindex = (page - 1) * limit;
const customerId = req.params.customerId
try {
await Tankerbooking.find({ customerId, orderStatus: ["rejected"]})
.limit(limit)
.skip(startindex)
.exec()
.then((docs) => {
reply.send({ status_code: 200, data: docs, count: docs.length });
})
} catch (err) {
reply.status(400).send({ message: err.message });
}
};
exports.getAllOrderpending = async (req, reply) => {
const limit = parseInt(req.query.limit) || 100;
const page = parseInt(req.query.page) || 1;

@ -501,7 +501,7 @@ module.exports = function (fastify, opts, next) {
});
fastify.route({
method: "GET",
url: "/api/rejected/:customerId",
url: "/api/allrejected",
schema: {
tags: ["Supplier-Order"],
description:"This is for Get All order cancelled",
@ -528,6 +528,35 @@ module.exports = function (fastify, opts, next) {
});
fastify.route({
method: "GET",
url: "/api/rejected/:customerId",
schema: {
tags: ["Supplier-Order"],
description:"This is for Get particular customer order cancelled",
summary: "This is for Get particular customer order cancelled",
params: {
required: ["customerId"],
type: "object",
properties: {
customerId: {
type: "string",
description: "customerId",
},
},
},
security: [
{
basicAuth: [],
},
],
},
handler:supplierOrderController.getCustomerOrderreject,
});
fastify.route({
method: "GET",
url: "/api/delivered/:customerId",

Loading…
Cancel
Save