add search on totalPaid field for payments

This commit is contained in:
2025-09-13 16:15:56 +05:30
parent e20f60363c
commit 0360ba398a
2 changed files with 3 additions and 0 deletions

0
scripts/cron.sh Executable file → Normal file
View File

View File

@@ -34,12 +34,15 @@ export async function listPayments(
if (params.searchToken) {
const regex = new RegExp(params.searchToken, "i");
const numericSearch = parseFloat(params.searchToken);
pipeline.push({
$match: {
$or: [
{ permitNumber: { $regex: regex } },
{ "address.full_address": { $regex: regex } },
{ totalPaid: { $regex: regex } },
...(isNaN(numericSearch) ? [] : [{ totalPaid: numericSearch }]),
],
},
});