From 78ebf3104af8ca39b22231668ae07d473d58bce0 Mon Sep 17 00:00:00 2001 From: Sepehr Yahyaee Date: Fri, 2 Oct 2026 15:29:38 +0330 Subject: [PATCH] fix(auth): resolve insurer name in expert profiles --- src/auth/auth-services/actor.auth.service.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/auth/auth-services/actor.auth.service.ts b/src/auth/auth-services/actor.auth.service.ts index 1bff64b..597b801 100644 --- a/src/auth/auth-services/actor.auth.service.ts +++ b/src/auth/auth-services/actor.auth.service.ts @@ -450,7 +450,25 @@ export class ActorAuthService { currentUser.role === "company" ? currentUser.username : null, currentUser.sub, ); - return new ProfileActor(userDetail); + const profile = new ProfileActor(userDetail); + + if (currentUser.role !== RoleEnum.COMPANY) { + const clientId = [userDetail?.clientKey, userDetail?.insuActivityCo] + .map((value) => String(value ?? "").trim()) + .find((value) => Types.ObjectId.isValid(value)); + + if (clientId) { + const client = await this.clientDbService.findOne({ + _id: new Types.ObjectId(clientId), + }); + profile.insuActivityCo = + client?.clientName?.persian || + client?.clientName?.english || + profile.insuActivityCo; + } + } + + return profile; } async modifyProfile(currentUser: any, update: Record) {