From 0a295b1ee27c9a9b0cf8e62bfe6d4cd8a141cb42 Mon Sep 17 00:00:00 2001 From: YaroslavBerkuta Date: Mon, 12 Feb 2024 09:11:56 +0000 Subject: [PATCH] fix search users in chat (#3) Reviewed-on: https://gitlab.work-jetup.site/task-me/api-rws/pulls/3 Co-authored-by: YaroslavBerkuta Co-committed-by: YaroslavBerkuta --- src/domain/users/services/users.service.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/domain/users/services/users.service.ts b/src/domain/users/services/users.service.ts index a0051bb..41739b4 100644 --- a/src/domain/users/services/users.service.ts +++ b/src/domain/users/services/users.service.ts @@ -390,8 +390,13 @@ export class UsersService implements Users.IUsersService { .leftJoinAndSelect('it.info', 'info') .where( new Brackets(subQuery => { - subQuery.where('info.firstName ILIKE :search', { search: toSearch }) - subQuery.orWhere('info.lastName ILIKE :search', { search: toSearch }) + subQuery + .where("info.firstName || ' ' || info.lastName ILIKE :search", { + search: toSearch, + }) + .orWhere("info.lastName || ' ' || info.firstName ILIKE :search", { + search: toSearch, + }) }), )