From 0360ba398a71967b12227ebe08dbe818b41154a6 Mon Sep 17 00:00:00 2001 From: Akhil Meka Date: Sat, 13 Sep 2025 16:15:56 +0530 Subject: [PATCH] add search on totalPaid field for payments --- scripts/cron.sh | 0 src/payments/payments.service.ts | 3 +++ 2 files changed, 3 insertions(+) mode change 100755 => 100644 scripts/cron.sh diff --git a/scripts/cron.sh b/scripts/cron.sh old mode 100755 new mode 100644 diff --git a/src/payments/payments.service.ts b/src/payments/payments.service.ts index e624d94..c8497b1 100644 --- a/src/payments/payments.service.ts +++ b/src/payments/payments.service.ts @@ -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 }]), ], }, });