get for pending,delivery boy assigned,out for delivery, cancelled, delivered tankers

master^2
Varun 2 months ago
parent 96d71c78ec
commit 21c597ec04

@ -619,7 +619,7 @@ exports.getAllOrderaccepted = async (req, reply) => {
const customerId = req.params.customerId; const customerId = req.params.customerId;
try { try {
const orders = await Tankerbooking.find({ customerId: customerId, orderStatus: "accepted" }) const orders = await Tankerbooking.find({ customerId: customerId, orderStatus: "pending" })
.limit(limit) .limit(limit)
.skip(startindex) .skip(startindex)
.exec(); .exec();
@ -666,9 +666,10 @@ exports.getAllOrderreject = 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;
const startindex = (page - 1) * limit; const startindex = (page - 1) * limit;
const customerId = req.params.customerId
//const customerId = req.params.customerId //const customerId = req.params.customerId
try { try {
await Tankerbooking.find({ orderStatus: ["rejected"]}) await Tankerbooking.find({ customerId: customerId,orderStatus: ["rejected"]})
.limit(limit) .limit(limit)
.skip(startindex) .skip(startindex)
.exec() .exec()
@ -680,6 +681,46 @@ exports.getAllOrderreject = async (req, reply) => {
} }
}; };
exports.getAllOrdersoutfordelivery = 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
//const customerId = req.params.customerId
try {
await Tankerbooking.find({ customerId: customerId,orderStatus: ["out_for_delivery"]})
.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.getAllOrdersdeliveryboyasigned = 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
//const customerId = req.params.customerId
try {
await Tankerbooking.find({ customerId: customerId,orderStatus: ["delivery_boy_assigned"]})
.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.getCustomerOrderreject = async (req, reply) => { exports.getCustomerOrderreject = 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;

@ -468,23 +468,26 @@ module.exports = function (fastify, opts, next) {
handler:supplierOrderController.getAllOrderaccepted, handler:supplierOrderController.getAllOrderaccepted,
}); });
fastify.route({ fastify.route({
method: "GET", method: "GET",
url: "/api/allrejected", url: "/api/allrejected/:customerId",
schema: { schema: {
tags: ["Supplier-Order"], tags: ["Supplier-Order"],
description:"This is for Get All order cancelled", description:"This is for Get All order cancelled",
summary: "This is for Get All order cancelled", summary: "This is for Get All order cancelled",
// params: { params: {
// required: ["customerId"], required: ["customerId"],
// type: "object", type: "object",
// properties: { properties: {
// customerId: { customerId: {
// type: "string", type: "string",
// description: "customerId", description: "customerId",
// }, },
// }, },
// }, },
security: [ security: [
{ {
@ -495,6 +498,65 @@ module.exports = function (fastify, opts, next) {
}, },
handler:supplierOrderController.getAllOrderreject, handler:supplierOrderController.getAllOrderreject,
});
fastify.route({
method: "GET",
url: "/api/getAllOrdersoutfordelivery/:customerId",
schema: {
tags: ["Supplier-Order"],
description:"This is for Get All order out for delivery",
summary: "This is for Get All out for delivery",
params: {
required: ["customerId"],
type: "object",
properties: {
customerId: {
type: "string",
description: "customerId",
},
},
},
security: [
{
basicAuth: [],
},
],
},
handler:supplierOrderController.getAllOrdersoutfordelivery,
});
fastify.route({
method: "GET",
url: "/api/getAllOrdersdeliveryboyasigned/:customerId",
schema: {
tags: ["Supplier-Order"],
description:"This is for Get All orders for delivery boy assigned",
summary: "This is for Get All out for delivery boy assigned",
params: {
required: ["customerId"],
type: "object",
properties: {
customerId: {
type: "string",
description: "customerId",
},
},
},
security: [
{
basicAuth: [],
},
],
},
handler:supplierOrderController.getAllOrdersdeliveryboyasigned,
}); });
fastify.route({ fastify.route({

Loading…
Cancel
Save