From cfd70b05e81e0ede266646f7d5d076406e463eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Saint-Roch?= Date: Mon, 29 Jul 2024 14:57:36 +0200 Subject: [PATCH] Fix non-iterable arg.filter.and --- services/libs/data-access-layer/src/activities/sql.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/services/libs/data-access-layer/src/activities/sql.ts b/services/libs/data-access-layer/src/activities/sql.ts index d033c7a7a1..4ff2329f6e 100644 --- a/services/libs/data-access-layer/src/activities/sql.ts +++ b/services/libs/data-access-layer/src/activities/sql.ts @@ -499,9 +499,11 @@ export async function queryActivities( } // Delete empty arrays filtering conversationId. - for (const f of arg.filter.and) { - if (f.conversationId && f.conversationId.in && f.conversationId.in.length === 0) { - delete f.conversationId + if (arg.filter.and) { + for (const f of arg.filter.and) { + if (f.conversationId && f.conversationId.in && f.conversationId.in.length === 0) { + delete f.conversationId + } } } @@ -531,7 +533,7 @@ export async function queryActivities( } } - const orderByString = parsedOrderBys.map((o) => `${o.column} ${o.direction}`).join(',') + const orderByString = parsedOrderBys.map((o) => `"${o.column}" ${o.direction}`).join(',') const params: any = { tenantId: arg.tenantId,