forked from Yara724/api
173 lines
4.1 KiB
TypeScript
173 lines
4.1 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional, OmitType } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
import {
|
|
IsArray,
|
|
IsEmail,
|
|
IsEnum,
|
|
IsMongoId,
|
|
Matches,
|
|
IsNotEmpty,
|
|
IsOptional,
|
|
IsString,
|
|
ValidateNested,
|
|
} from 'class-validator';
|
|
import { RoleEnum } from 'src/Types&Enums/role.enum';
|
|
import { UserType } from 'src/Types&Enums/userType.enum';
|
|
|
|
export class ExpertLocationDto {
|
|
@ApiProperty({
|
|
example: '110011',
|
|
description: 'Fanavaran Location / OpBUId',
|
|
})
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
id: string;
|
|
|
|
@ApiProperty({ example: 'شعبه غرب' })
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
name: string;
|
|
}
|
|
|
|
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()
|
|
firstName: string;
|
|
|
|
@ApiProperty({ example: 'Ahmadi' })
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
lastName: string;
|
|
|
|
@ApiProperty({ example: '1234567890' })
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
nationalCode: string;
|
|
|
|
@ApiProperty({ example: 'expert@example.com' })
|
|
@IsEmail()
|
|
email: string;
|
|
|
|
@ApiProperty({ example: 'StrongPass!123' })
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
password: string;
|
|
|
|
@ApiProperty({ example: '09121234567' })
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
mobile: string;
|
|
|
|
@ApiProperty({
|
|
example: '665f0e5ab74d670939b08920',
|
|
description: 'Branch id this expert belongs to',
|
|
})
|
|
@IsMongoId()
|
|
branchId: string;
|
|
|
|
@ApiPropertyOptional({ enum: UserType, example: UserType.LEGAL })
|
|
@IsOptional()
|
|
@IsEnum(UserType)
|
|
userType?: UserType;
|
|
|
|
@ApiPropertyOptional({ example: '02112345678' })
|
|
@IsOptional()
|
|
@IsString()
|
|
phone?: string;
|
|
|
|
@ApiPropertyOptional({ example: 'Tehran' })
|
|
@IsOptional()
|
|
@IsString()
|
|
state?: string;
|
|
|
|
@ApiPropertyOptional({ example: 'Tehran' })
|
|
@IsOptional()
|
|
@IsString()
|
|
city?: string;
|
|
|
|
@ApiPropertyOptional({ example: 'No. 12, Sample St.' })
|
|
@IsOptional()
|
|
@IsString()
|
|
address?: string;
|
|
|
|
@ApiPropertyOptional({
|
|
type: [ExpertLocationDto],
|
|
description:
|
|
'Fanavaran Location entries (id = OpBUId), stored on the staff profile. The first id is used as the HTTP Location header. When empty, the code of the branch referenced by branchId is used. Claim submissions require a staff location or branch code.',
|
|
})
|
|
@IsOptional()
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => ExpertLocationDto)
|
|
locations?: ExpertLocationDto[];
|
|
}
|
|
|
|
export class CreateBlameExpertByInsurerDto extends CreateInsurerExpertDto {
|
|
@ApiPropertyOptional({
|
|
enum: [RoleEnum.EXPERT],
|
|
default: RoleEnum.EXPERT,
|
|
})
|
|
role?: RoleEnum.EXPERT;
|
|
}
|
|
|
|
export class CreateClaimExpertByInsurerDto extends CreateInsurerExpertDto {
|
|
@ApiPropertyOptional({
|
|
enum: [RoleEnum.DAMAGE_EXPERT],
|
|
default: RoleEnum.DAMAGE_EXPERT,
|
|
})
|
|
role?: RoleEnum.DAMAGE_EXPERT;
|
|
}
|
|
|
|
export class CreateFileMakerByInsurerDto extends OmitType(
|
|
CreateInsurerExpertDto,
|
|
['ThirdPartyExpertiseClaim', 'CarBodyExpertiseClaim'] as const,
|
|
) {
|
|
@ApiPropertyOptional({
|
|
enum: [RoleEnum.FILE_MAKER],
|
|
default: RoleEnum.FILE_MAKER,
|
|
})
|
|
role?: RoleEnum.FILE_MAKER;
|
|
}
|
|
|
|
export class CreateFileReviewerByInsurerDto extends OmitType(
|
|
CreateInsurerExpertDto,
|
|
['ThirdPartyClaimExpertId', 'CarBodyClaimExpertId'] as const,
|
|
) {
|
|
@ApiPropertyOptional({
|
|
enum: [RoleEnum.FILE_REVIEWER],
|
|
default: RoleEnum.FILE_REVIEWER,
|
|
})
|
|
role?: RoleEnum.FILE_REVIEWER;
|
|
}
|