forked from Yara724/api
fix(auth): resolve insurer name in expert profiles
This commit is contained in:
@@ -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>) {
|
||||
|
||||
Reference in New Issue
Block a user