fix(auth): resolve insurer name in expert profiles

This commit is contained in:
2026-10-02 15:29:38 +03:30
parent 1e18537b84
commit 78ebf3104a
+19 -1
View File
@@ -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<string, any>) {