added array filter option
This commit is contained in:
@@ -41,15 +41,15 @@ export async function listProcessedPermits(
|
||||
const page = params.page || 1;
|
||||
const pageSize = params.pageSize || 10;
|
||||
const sortObj = getSortObject(params, processedFields);
|
||||
const filterObj = getFilterObject(params) || {};
|
||||
const filterObj = getFilterObject(params) || [];
|
||||
|
||||
if (user.role == "client") {
|
||||
filterObj["client"] = new mongoose.Types.ObjectId(user.orgId);
|
||||
filterObj.push({ client: new mongoose.Types.ObjectId(user.orgId) });
|
||||
}
|
||||
|
||||
const pipeline: any = [
|
||||
{
|
||||
$match: { $and: [{ tenantId: user.tenantId }, { ...filterObj }] },
|
||||
$match: { $and: [{ tenantId: user.tenantId }, ...filterObj] },
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user