add search on totalPaid field for payments
This commit is contained in:
0
scripts/cron.sh
Executable file → Normal file
0
scripts/cron.sh
Executable file → Normal file
@@ -34,12 +34,15 @@ export async function listPayments(
|
|||||||
|
|
||||||
if (params.searchToken) {
|
if (params.searchToken) {
|
||||||
const regex = new RegExp(params.searchToken, "i");
|
const regex = new RegExp(params.searchToken, "i");
|
||||||
|
const numericSearch = parseFloat(params.searchToken);
|
||||||
|
|
||||||
pipeline.push({
|
pipeline.push({
|
||||||
$match: {
|
$match: {
|
||||||
$or: [
|
$or: [
|
||||||
{ permitNumber: { $regex: regex } },
|
{ permitNumber: { $regex: regex } },
|
||||||
{ "address.full_address": { $regex: regex } },
|
{ "address.full_address": { $regex: regex } },
|
||||||
|
{ totalPaid: { $regex: regex } },
|
||||||
|
...(isNaN(numericSearch) ? [] : [{ totalPaid: numericSearch }]),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user