forked from Yara724/api
Fixed actors profile check and update for all of them
This commit is contained in:
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user