forked from Yara724/api
YARA-718
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({ 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");
|
||||
}
|
||||
|
||||
@@ -328,6 +328,21 @@ export class InsurerRegisterDto {
|
||||
|
||||
@ApiProperty({ example: "{saman : 651abe5814ed4bb6ee20cd81}" })
|
||||
clientKey: Types.ObjectId;
|
||||
|
||||
@ApiProperty()
|
||||
phone?: string;
|
||||
|
||||
@ApiProperty()
|
||||
mobile?: string;
|
||||
|
||||
@ApiProperty()
|
||||
city?: string;
|
||||
|
||||
@ApiProperty()
|
||||
state?: string;
|
||||
|
||||
@ApiProperty()
|
||||
address?: string;
|
||||
}
|
||||
|
||||
export class RegisterDtoRs extends RegisterDto {
|
||||
|
||||
@@ -17,4 +17,8 @@ export class InsurerExpertDbService {
|
||||
async findOne(filter: FilterQuery<InsurerExpertModel>) {
|
||||
return await this.insurerExpert.findOne(filter);
|
||||
}
|
||||
|
||||
async updateOne(filter: any, update: any) {
|
||||
return this.insurerExpert.updateOne(filter, update);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,21 @@ export class InsurerExpertModel {
|
||||
@Prop()
|
||||
clientKey: Types.ObjectId;
|
||||
|
||||
@Prop()
|
||||
phone?: string;
|
||||
|
||||
@Prop()
|
||||
mobile?: string;
|
||||
|
||||
@Prop()
|
||||
city?: string;
|
||||
|
||||
@Prop()
|
||||
state?: string;
|
||||
|
||||
@Prop()
|
||||
address?: string;
|
||||
|
||||
createdAt: Date;
|
||||
}
|
||||
export const InsurerExpertDbSchema =
|
||||
|
||||
Reference in New Issue
Block a user