Add tenant-scoped insurer, staff and branch management APIs

Support all six staff roles and editable Fanavaran codes, insurer login accounts and optional branch details. Enforce tenant boundaries and role-specific fields, document setup and extend regression coverage.
This commit is contained in:
SepehrYahyaee
2026-10-11 10:42:44 +03:30
parent 4302be8595
commit 0c272f1e86
19 changed files with 1930 additions and 7 deletions
@@ -1,10 +1,11 @@
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional, OmitType } from "@nestjs/swagger";
import { Type } from "class-transformer";
import {
IsArray,
IsEmail,
IsEnum,
IsMongoId,
Matches,
IsNotEmpty,
IsOptional,
IsString,
@@ -14,7 +15,10 @@ import { RoleEnum } from "src/Types&Enums/role.enum";
import { UserType } from "src/Types&Enums/userType.enum";
export class ExpertLocationDto {
@ApiProperty({ example: "210050", description: "Fanavaran Location / OpBUId" })
@ApiProperty({
example: "210050",
description: "Fanavaran Location / OpBUId",
})
@IsString()
@IsNotEmpty()
id: string;
@@ -26,6 +30,36 @@ export class ExpertLocationDto {
}
export class CreateInsurerExpertDto {
@ApiPropertyOptional()
@IsOptional()
@IsString()
@Matches(/^\d+$/)
expertCode?: string;
@ApiPropertyOptional({ description: "کارشناس مسئول پرونده مالی" })
@IsOptional()
@IsString()
@Matches(/^\d+$/)
ThirdPartyClaimExpertId?: string;
@ApiPropertyOptional({ description: "کارشناس مسئول پرونده بدنه" })
@IsOptional()
@IsString()
@Matches(/^\d+$/)
CarBodyClaimExpertId?: string;
@ApiPropertyOptional({ description: "کارشناس ارزیاب خسارت ثالث مالی" })
@IsOptional()
@IsString()
@Matches(/^\d+$/)
ThirdPartyExpertiseClaim?: string;
@ApiPropertyOptional({ description: "کارشناس ارزیاب خسارت بدنه" })
@IsOptional()
@IsString()
@Matches(/^\d+$/)
CarBodyExpertiseClaim?: string;
@ApiProperty({ example: "Ali" })
@IsString()
@IsNotEmpty()
@@ -104,7 +138,10 @@ export class CreateClaimExpertByInsurerDto extends CreateInsurerExpertDto {
role?: RoleEnum.DAMAGE_EXPERT;
}
export class CreateFileMakerByInsurerDto extends CreateInsurerExpertDto {
export class CreateFileMakerByInsurerDto extends OmitType(
CreateInsurerExpertDto,
["ThirdPartyExpertiseClaim", "CarBodyExpertiseClaim"] as const,
) {
@ApiPropertyOptional({
enum: [RoleEnum.FILE_MAKER],
default: RoleEnum.FILE_MAKER,
@@ -123,7 +160,10 @@ export class CreateFileMakerByInsurerDto extends CreateInsurerExpertDto {
locations?: ExpertLocationDto[];
}
export class CreateFileReviewerByInsurerDto extends CreateInsurerExpertDto {
export class CreateFileReviewerByInsurerDto extends OmitType(
CreateInsurerExpertDto,
["ThirdPartyClaimExpertId", "CarBodyClaimExpertId"] as const,
) {
@ApiPropertyOptional({
enum: [RoleEnum.FILE_REVIEWER],
default: RoleEnum.FILE_REVIEWER,