1
0
forked from Yara724/api
This commit is contained in:
SepehrYahyaee
2026-01-19 17:48:06 +03:30
parent 245f98b577
commit d9509c5df5
4 changed files with 56 additions and 1 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({ email: username });
res = await this.insurerExpertDbService.findOne({ username });
break;
default:
return null;
@@ -153,6 +153,11 @@ export class ActorAuthService {
clientKey: body.clientKey,
firstName: body.firstName,
lastName: body.lastName,
phone: body.phone,
mobile:body.mobile,
city: body.city,
state: body.state,
address: body.address,
};
return new RegisterDtoRs(
@@ -332,6 +337,15 @@ export class ActorAuthService {
"avatarUrl",
"address",
],
company: [
"firstName",
"lastName",
"phone",
"mobile",
"city",
"state",
"address",
]
};
const allowedFields = allowedFieldsByRole[role];
@@ -384,6 +398,13 @@ export class ActorAuthService {
);
break;
case "company":
await this.insurerExpertDbService.updateOne(
{ _id: new Types.ObjectId(userId) },
{ $set: sanitized },
);
break;
default:
throw new ForbiddenException("Unsupported role for update");
}