filter bug fix

This commit is contained in:
2025-05-03 18:25:55 +05:30
parent dbc82f53a3
commit aeda2b60a1
5 changed files with 7 additions and 7 deletions

View File

@@ -39,7 +39,7 @@ export async function listOrgs(params: PageQueryParams, tenantId: string) {
const page = params.page || 1;
const pageSize = params.pageSize || 10;
const sortObj = getSortObject(params, orgFields);
const filterObj = getFilterObject(params);
const filterObj = getFilterObject(params) || [];
const orgs = await orgModel.aggregate([
{ $match: { $and: [{ tenantId: tenantId }, ...filterObj] } },
@@ -122,7 +122,7 @@ export async function searchOrgs(params: PageQueryParams, tenantId: string) {
const page = params.page || 1;
const pageSize = params.pageSize || 10;
const sortObj = getSortObject(params, orgFields);
const filterObj = getFilterObject(params);
const filterObj = getFilterObject(params) || [];
if (!params.searchToken)
return { orgs: [], metadata: { count: 0, page, pageSize } };