Fixed actors profile check and update for all of them

This commit is contained in:
SepehrYahyaee
2026-01-21 16:45:34 +03:30
parent c5fe27934b
commit 1ed46d1609
3 changed files with 9 additions and 4 deletions

View File

@@ -70,7 +70,7 @@ export class ActorAuthService {
res = await this.damageExpertDbService.findOne({ email: username });
break;
case RoleEnum.COMPANY:
res = await this.insurerExpertDbService.findOne({ username });
res = await this.insurerExpertDbService.findOne({ email: username });
break;
default:
return null;
@@ -295,7 +295,7 @@ export class ActorAuthService {
async getProfiles(currentUser) {
const userDetail = await this.dynamicDbController(
currentUser.role,
null,
currentUser.role === "company" ? currentUser.username : null,
currentUser.sub,
);
return new ProfileActor(userDetail);
@@ -372,7 +372,7 @@ export class ActorAuthService {
}
// fetch user detail (document or plain object)
const document = await this.dynamicDbController(role, null, userId);
const document = await this.dynamicDbController(role, currentUser.role === "company" ? currentUser.username : null, userId);
if (!document) throw new NotFoundException("Profile not found");