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) {