date wise order sort

This commit is contained in:
Sibunnayak 2024-09-25 10:24:51 +05:30
parent 24018d4bdf
commit bd44ab91b6

View File

@ -816,13 +816,13 @@ export const getProcessingInvoices = async (req, res) => {
query.invoiceId = { $regex: invoiceId, $options: "i" };
}
const invoices = await Invoice.find(query)
.sort({ createdAt: -1 })
.skip(skip)
.limit(limit)
.populate({
path: "orderId",
select: "uniqueId",
});
})
.sort({ "courierstatus_timeline.processing": -1 });
if (orderId) {
const filteredInvoices = invoices.filter(
@ -1026,7 +1026,8 @@ export const getDispatchedInvoices = async (req, res) => {
.populate({
path: "orderId",
select: "uniqueId",
});
})
.sort({ "courierstatus_timeline.dispatched": -1 });
if (orderId) {
const filteredInvoices = invoices.filter(
@ -1213,7 +1214,8 @@ export const getDeliveredInvoices = async (req, res) => {
.populate({
path: "orderId",
select: "uniqueId",
});
})
.sort({ "courierstatus_timeline.delivered": -1 });
if (orderId) {
const filteredInvoices = invoices.filter(