From 3ac43a6bc99a50b2f9034736cb7772bc3b66641a Mon Sep 17 00:00:00 2001 From: Rudhra Deep Biswas <98055396+rudeUltra@users.noreply.github.com> Date: Thu, 10 Apr 2025 13:03:33 +0530 Subject: [PATCH] init (#12530) --- .../_services/commentNotifications.service.js | 11 ++++++++--- .../src/modules/data-queries/util.service.ts | 6 +----- .../modules/licensing/configs/LicenseBase.ts | 2 +- server/src/modules/users/repository.ts | 19 ++++++++++++------- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/frontend/src/_services/commentNotifications.service.js b/frontend/src/_services/commentNotifications.service.js index b79e559ddd..8550a79667 100644 --- a/frontend/src/_services/commentNotifications.service.js +++ b/frontend/src/_services/commentNotifications.service.js @@ -2,16 +2,21 @@ import HttpClient from '@/_helpers/http-client'; const adapter = new HttpClient(); +//Uncomment when Comment Notifications Module is ready + function findAll(isRead = false) { - return adapter.get(`/comment_notifications?isRead=${isRead}`); + return { data: [] }; + // return adapter.get(`/comment_notifications?isRead=${isRead}`); } function updateAll(isRead) { - return adapter.patch(`/comment_notifications`, { isRead }); + return; + // return adapter.patch(`/comment_notifications`, { isRead }); } function update(id, isRead) { - return adapter.patch(`/comment_notifications/${id}`, { isRead }); + return; + // return adapter.patch(`/comment_notifications/${id}`, { isRead }); } export const commentNotificationsService = { diff --git a/server/src/modules/data-queries/util.service.ts b/server/src/modules/data-queries/util.service.ts index 889b39046d..273d111582 100644 --- a/server/src/modules/data-queries/util.service.ts +++ b/server/src/modules/data-queries/util.service.ts @@ -420,11 +420,7 @@ export class DataQueriesUtilService implements IDataQueriesUtilService { } // c: Replace all occurrences of {{ }} variables - if ( - typeof resolvedValue === 'string' && - resolvedValue?.match(/\{\{(.*?)\}\}/g)?.length > 0 && - !(resolvedValue.startsWith('{{') && resolvedValue.endsWith('}}')) - ) { + if (typeof resolvedValue === 'string' && resolvedValue?.match(/\{\{(.*?)\}\}/g)?.length > 0) { const variables = resolvedValue.match(/\{\{(.*?)\}\}/g); for (const variable of variables || []) { diff --git a/server/src/modules/licensing/configs/LicenseBase.ts b/server/src/modules/licensing/configs/LicenseBase.ts index 6f7764addd..e1c9cf290d 100644 --- a/server/src/modules/licensing/configs/LicenseBase.ts +++ b/server/src/modules/licensing/configs/LicenseBase.ts @@ -271,7 +271,7 @@ export default class LicenseBase { } public get ai(): object { - return this._ai; + return this._ai || {}; } public get aiFeature(): boolean { diff --git a/server/src/modules/users/repository.ts b/server/src/modules/users/repository.ts index e70a865028..236e8de8fa 100644 --- a/server/src/modules/users/repository.ts +++ b/server/src/modules/users/repository.ts @@ -39,14 +39,19 @@ export class UserRepository extends Repository { if (options?.status) { findOptions.status = options?.status; } - const whereConditions = []; + + // For the search query, create an array of conditions + let whereOptions: FindOptionsWhere | FindOptionsWhere[] = findOptions; + if (options?.searchText) { const searchLower = options.searchText.toLowerCase(); - whereConditions.concat([ - { email: ILike(`%${searchLower}%`) }, - { firstName: ILike(`%${searchLower}%`) }, - { lastName: ILike(`%${searchLower}%`) }, - ]); + + // Create an array of OR conditions + whereOptions = [ + { ...findOptions, email: ILike(`%${searchLower}%`) }, + { ...findOptions, firstName: ILike(`%${searchLower}%`) }, + { ...findOptions, lastName: ILike(`%${searchLower}%`) }, + ]; } const [items, total] = await this.manager.findAndCount(User, { @@ -74,7 +79,7 @@ export class UserRepository extends Repository { organization: true, }, }, - where: whereConditions ? whereConditions.map((condition) => ({ ...findOptions, ...condition })) : findOptions, + where: whereOptions, order: { createdAt: 'ASC' }, take: 10, skip: 10 * (options?.page ? options?.page - 1 : 0),