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 });
|
res = await this.damageExpertDbService.findOne({ email: username });
|
||||||
break;
|
break;
|
||||||
case RoleEnum.COMPANY:
|
case RoleEnum.COMPANY:
|
||||||
res = await this.insurerExpertDbService.findOne({ email: username });
|
res = await this.insurerExpertDbService.findOne({ username });
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
@@ -153,6 +153,11 @@ export class ActorAuthService {
|
|||||||
clientKey: body.clientKey,
|
clientKey: body.clientKey,
|
||||||
firstName: body.firstName,
|
firstName: body.firstName,
|
||||||
lastName: body.lastName,
|
lastName: body.lastName,
|
||||||
|
phone: body.phone,
|
||||||
|
mobile:body.mobile,
|
||||||
|
city: body.city,
|
||||||
|
state: body.state,
|
||||||
|
address: body.address,
|
||||||
};
|
};
|
||||||
|
|
||||||
return new RegisterDtoRs(
|
return new RegisterDtoRs(
|
||||||
@@ -332,6 +337,15 @@ export class ActorAuthService {
|
|||||||
"avatarUrl",
|
"avatarUrl",
|
||||||
"address",
|
"address",
|
||||||
],
|
],
|
||||||
|
company: [
|
||||||
|
"firstName",
|
||||||
|
"lastName",
|
||||||
|
"phone",
|
||||||
|
"mobile",
|
||||||
|
"city",
|
||||||
|
"state",
|
||||||
|
"address",
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
const allowedFields = allowedFieldsByRole[role];
|
const allowedFields = allowedFieldsByRole[role];
|
||||||
@@ -384,6 +398,13 @@ export class ActorAuthService {
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "company":
|
||||||
|
await this.insurerExpertDbService.updateOne(
|
||||||
|
{ _id: new Types.ObjectId(userId) },
|
||||||
|
{ $set: sanitized },
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new ForbiddenException("Unsupported role for update");
|
throw new ForbiddenException("Unsupported role for update");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -328,6 +328,21 @@ export class InsurerRegisterDto {
|
|||||||
|
|
||||||
@ApiProperty({ example: "{saman : 651abe5814ed4bb6ee20cd81}" })
|
@ApiProperty({ example: "{saman : 651abe5814ed4bb6ee20cd81}" })
|
||||||
clientKey: Types.ObjectId;
|
clientKey: Types.ObjectId;
|
||||||
|
|
||||||
|
@ApiProperty()
|
||||||
|
phone?: string;
|
||||||
|
|
||||||
|
@ApiProperty()
|
||||||
|
mobile?: string;
|
||||||
|
|
||||||
|
@ApiProperty()
|
||||||
|
city?: string;
|
||||||
|
|
||||||
|
@ApiProperty()
|
||||||
|
state?: string;
|
||||||
|
|
||||||
|
@ApiProperty()
|
||||||
|
address?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RegisterDtoRs extends RegisterDto {
|
export class RegisterDtoRs extends RegisterDto {
|
||||||
|
|||||||
@@ -17,4 +17,8 @@ export class InsurerExpertDbService {
|
|||||||
async findOne(filter: FilterQuery<InsurerExpertModel>) {
|
async findOne(filter: FilterQuery<InsurerExpertModel>) {
|
||||||
return await this.insurerExpert.findOne(filter);
|
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()
|
@Prop()
|
||||||
clientKey: Types.ObjectId;
|
clientKey: Types.ObjectId;
|
||||||
|
|
||||||
|
@Prop()
|
||||||
|
phone?: string;
|
||||||
|
|
||||||
|
@Prop()
|
||||||
|
mobile?: string;
|
||||||
|
|
||||||
|
@Prop()
|
||||||
|
city?: string;
|
||||||
|
|
||||||
|
@Prop()
|
||||||
|
state?: string;
|
||||||
|
|
||||||
|
@Prop()
|
||||||
|
address?: string;
|
||||||
|
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
}
|
}
|
||||||
export const InsurerExpertDbSchema =
|
export const InsurerExpertDbSchema =
|
||||||
|
|||||||
Reference in New Issue
Block a user