cancel order particular customer

master
Bhaskara Kishore 2 years ago
parent 3a08130982
commit fab3660b48

@ -643,6 +643,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) => { exports.getAllOrderpending = async (req, reply) => {
const limit = parseInt(req.query.limit) || 100; const limit = parseInt(req.query.limit) || 100;
const page = parseInt(req.query.page) || 1; const page = parseInt(req.query.page) || 1;

@ -501,7 +501,7 @@ module.exports = function (fastify, opts, next) {
}); });
fastify.route({ fastify.route({
method: "GET", method: "GET",
url: "/api/rejected/:customerId", url: "/api/allrejected",
schema: { schema: {
tags: ["Supplier-Order"], tags: ["Supplier-Order"],
description:"This is for Get All order cancelled", 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({ fastify.route({
method: "GET", method: "GET",
url: "/api/delivered/:customerId", url: "/api/delivered/:customerId",

Loading…
Cancel
Save