filter bug fix
This commit is contained in:
@@ -43,7 +43,7 @@ export async function listNotifications(
|
||||
const page = params.page || 1;
|
||||
const pageSize = params.pageSize || 10;
|
||||
const sortObj = getSortObject(params, notificationFields);
|
||||
const filterObj = getFilterObject(params);
|
||||
const filterObj = getFilterObject(params) || [];
|
||||
|
||||
const pipeline: any = [
|
||||
{
|
||||
|
||||
@@ -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 } };
|
||||
|
||||
@@ -62,7 +62,7 @@ export async function listRts(params: PageQueryParams, tenantId: string) {
|
||||
const page = params.page || 1;
|
||||
const pageSize = params.pageSize || 10;
|
||||
const sortObj = getSortObject(params, rtsFields);
|
||||
const filterObj = getFilterObject(params);
|
||||
const filterObj = getFilterObject(params) || [];
|
||||
|
||||
const rtsList = await rtsModel.aggregate([
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@ export async function listTasks(params: PageQueryParams, tenantId: string) {
|
||||
const page = params.page || 1;
|
||||
const pageSize = params.pageSize || 10;
|
||||
const sortObj = getSortObject(params, taskFields);
|
||||
const filterObj = getFilterObject(params);
|
||||
const filterObj = getFilterObject(params) || [];
|
||||
|
||||
const taskList = await taskModel.aggregate([
|
||||
{
|
||||
@@ -145,7 +145,7 @@ export async function searchTasks(params: PageQueryParams, tenantId: string) {
|
||||
const page = params.page || 1;
|
||||
const pageSize = params.pageSize || 10;
|
||||
const sortObj = getSortObject(params, taskFields);
|
||||
const filterObj = getFilterObject(params);
|
||||
const filterObj = getFilterObject(params) || [];
|
||||
|
||||
const regex = new RegExp(params.searchToken, "i");
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ export async function listViews(
|
||||
const page = params.page || 1;
|
||||
const pageSize = params.pageSize || 10;
|
||||
const sortObj = getSortObject(params, viewFields);
|
||||
const filterObj = getFilterObject(params);
|
||||
const filterObj = getFilterObject(params) || [];
|
||||
|
||||
return await viewModel.find({
|
||||
$and: [
|
||||
|
||||
Reference in New Issue
Block a user