forked from Yara724/api
Merge pull request 'fix(auth): resolve insurer name in expert profiles' (#348) from s.yahyaee/yara724-api:main into main
Reviewed-on: Yara724/api#348
This commit is contained in:
@@ -450,7 +450,25 @@ export class ActorAuthService {
|
|||||||
currentUser.role === "company" ? currentUser.username : null,
|
currentUser.role === "company" ? currentUser.username : null,
|
||||||
currentUser.sub,
|
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>) {
|
async modifyProfile(currentUser: any, update: Record<string, any>) {
|
||||||
|
|||||||
Reference in New Issue
Block a user