YARA-1110

This commit is contained in:
SepehrYahyaee
2026-07-13 11:53:47 +03:30
parent 72dec7a917
commit 5595083e86
21 changed files with 413 additions and 653 deletions

View File

@@ -97,11 +97,3 @@ export class CreateFileReviewerByInsurerDto extends CreateInsurerExpertDto {
})
role?: RoleEnum.FILE_REVIEWER;
}
export class CreateFinancialExpertByInsurerDto extends CreateInsurerExpertDto {
@ApiPropertyOptional({
enum: [RoleEnum.FINANCIAL_EXPERT],
default: RoleEnum.FINANCIAL_EXPERT,
})
role?: RoleEnum.FINANCIAL_EXPERT;
}

View File

@@ -38,7 +38,6 @@ import {
CreateClaimExpertByInsurerDto,
CreateFileMakerByInsurerDto,
CreateFileReviewerByInsurerDto,
CreateFinancialExpertByInsurerDto,
} from "./dto/create-insurer-expert.dto";
@Controller("expert-insurer")
@@ -183,23 +182,6 @@ export class ExpertInsurerController {
return this.expertInsurerService.addFileReviewer(insurer.clientKey, body);
}
@Post("experts/financial-expert")
@ApiBody({ type: CreateFinancialExpertByInsurerDto })
@ApiOperation({
summary: "Create a FinancialExpert account under this insurer (V5 flow)",
description:
"FinancialExperts are the final approvers in the V5 blame flow before fanavaran submission.",
})
async addFinancialExpert(
@CurrentUser() insurer,
@Body() body: CreateFinancialExpertByInsurerDto,
) {
if (!insurer) {
throw new UnauthorizedException("Could not identify the current user.");
}
return this.expertInsurerService.addFinancialExpert(insurer.clientKey, body);
}
@ApiQuery({ name: "page", type: Number })
@ApiQuery({ name: "response_count", type: Number })
@Get("experts/list")

View File

@@ -14,7 +14,6 @@ import {
CreateClaimExpertByInsurerDto,
CreateFileMakerByInsurerDto,
CreateFileReviewerByInsurerDto,
CreateFinancialExpertByInsurerDto,
CreateInsurerExpertDto,
} from "./dto/create-insurer-expert.dto";
import {
@@ -30,7 +29,6 @@ import { ExpertDbService } from "src/users/entities/db-service/expert.db.service
import { FieldExpertDbService } from "src/users/entities/db-service/field-expert.db.service";
import { FileMakerDbService } from "src/users/entities/db-service/file-maker.db.service";
import { FileReviewerDbService } from "src/users/entities/db-service/file-reviewer.db.service";
import { FinancialExpertDbService } from "src/users/entities/db-service/financial-expert.db.service";
import { ExpertFileActivityDbService } from "src/users/entities/db-service/expert-file-activity.db.service";
import { ExpertFileActivityType } from "src/users/entities/schema/expert-file-activity.schema";
import { HashService } from "src/utils/hash/hash.service";
@@ -97,7 +95,6 @@ export class ExpertInsurerService {
private readonly claimSignDbService: ClaimSignDbService,
private readonly fileMakerDbService: FileMakerDbService,
private readonly fileReviewerDbService: FileReviewerDbService,
private readonly financialExpertDbService: FinancialExpertDbService,
) {}
/**
@@ -1769,58 +1766,6 @@ export class ExpertInsurerService {
};
}
async addFinancialExpert(
insurerClientKey: string,
payload: CreateFinancialExpertByInsurerDto,
) {
const clientObjectId = this.getClientId(insurerClientKey);
const branch = await this.assertBranchBelongsToClient(
payload.branchId,
clientObjectId,
);
const email = payload.email.trim().toLowerCase();
const existing = await this.financialExpertDbService.findOne({ email });
if (existing) {
throw new ConflictException(
"A FinancialExpert with this email already exists.",
);
}
const nationalCode = payload.nationalCode.trim();
const existingByNational = await this.financialExpertDbService.findOne({
nationalCode,
});
if (existingByNational) {
throw new ConflictException(
"A FinancialExpert with this national code already exists.",
);
}
const hashedPassword = await this.hashService.hash(payload.password);
const created = await this.financialExpertDbService.create({
...payload,
email,
nationalCode,
password: hashedPassword,
role: RoleEnum.FINANCIAL_EXPERT,
clientKey: clientObjectId,
branchId: new Types.ObjectId(payload.branchId),
});
return {
financialExpert: this.sanitizeExpertResponse(created),
branch: {
_id: (branch as any)._id,
name: branch.name,
code: branch.code,
city: branch.city,
state: branch.state,
address: branch.address,
},
};
}
/**
* Get comprehensive statistics for all experts of a client
* Returns: