From d9509c5df5e0605e11838efa38afa231a90c3bfa Mon Sep 17 00:00:00 2001 From: SepehrYahyaee <7heycallmegray@gmail.com> Date: Mon, 19 Jan 2026 17:48:06 +0330 Subject: [PATCH] YARA-718 --- src/auth/auth-services/actor.auth.service.ts | 23 ++++++++++++++++++- src/auth/dto/actor/register.actor.dto.ts | 15 ++++++++++++ .../db-service/insurer-expert.db.service.ts | 4 ++++ .../entities/schema/insurer-expert.schema.ts | 15 ++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/auth/auth-services/actor.auth.service.ts b/src/auth/auth-services/actor.auth.service.ts index a2710e4..af9b7b7 100644 --- a/src/auth/auth-services/actor.auth.service.ts +++ b/src/auth/auth-services/actor.auth.service.ts @@ -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"); } diff --git a/src/auth/dto/actor/register.actor.dto.ts b/src/auth/dto/actor/register.actor.dto.ts index 44d61af..af7554d 100644 --- a/src/auth/dto/actor/register.actor.dto.ts +++ b/src/auth/dto/actor/register.actor.dto.ts @@ -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 { diff --git a/src/users/entities/db-service/insurer-expert.db.service.ts b/src/users/entities/db-service/insurer-expert.db.service.ts index 55cb68c..2b58e70 100644 --- a/src/users/entities/db-service/insurer-expert.db.service.ts +++ b/src/users/entities/db-service/insurer-expert.db.service.ts @@ -17,4 +17,8 @@ export class InsurerExpertDbService { async findOne(filter: FilterQuery) { return await this.insurerExpert.findOne(filter); } + + async updateOne(filter: any, update: any) { + return this.insurerExpert.updateOne(filter, update); + } } diff --git a/src/users/entities/schema/insurer-expert.schema.ts b/src/users/entities/schema/insurer-expert.schema.ts index 270bacb..947f199 100644 --- a/src/users/entities/schema/insurer-expert.schema.ts +++ b/src/users/entities/schema/insurer-expert.schema.ts @@ -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 =