feat: allow partial matching on totalPaid field

This commit is contained in:
2025-10-11 15:14:17 +05:30
parent 06781bd998
commit 183cf2dde9

View File

@@ -41,7 +41,15 @@ export async function listPayments(
$or: [ $or: [
{ permitNumber: { $regex: regex } }, { permitNumber: { $regex: regex } },
{ "address.full_address": { $regex: regex } }, { "address.full_address": { $regex: regex } },
{ totalPaid: { $regex: regex } }, {
$expr: {
$regexMatch: {
input: { $toString: "$totalPaid" },
regex: params.searchToken,
options: "i",
},
},
},
...(isNaN(numericSearch) ? [] : [{ totalPaid: numericSearch }]), ...(isNaN(numericSearch) ? [] : [{ totalPaid: numericSearch }]),
], ],
}, },