forked from Yara724/api
Initial commit after migration to gitea
This commit is contained in:
80
src/expert-claim/dto/claim-list-perId-rs.dto.ts
Normal file
80
src/expert-claim/dto/claim-list-perId-rs.dto.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
import { UserObjectionDto } from "src/claim-request-management/dto/user-objection.dto";
|
||||
import {
|
||||
ClaimRequestManagementModel,
|
||||
SubmitReply,
|
||||
UserComment,
|
||||
UserResendDocuments,
|
||||
PriceDrop,
|
||||
} from "src/claim-request-management/entites/schema/claim-request-management.schema";
|
||||
|
||||
export class ClaimPerIdRs {
|
||||
requestDetail: any;
|
||||
bankDamageUserInformation: {};
|
||||
accidentLocation: {};
|
||||
blameFile: any;
|
||||
aiImages: any;
|
||||
carPartDamage: any;
|
||||
imageRequired: any;
|
||||
carGreenCard: any;
|
||||
nationalCodeOfInsurer: string;
|
||||
otherParts: any;
|
||||
sheba: any;
|
||||
expertSubmitReply: any;
|
||||
damageExpertResend: any;
|
||||
damageExpertReply: SubmitReply;
|
||||
damageExpertReplyFinal: SubmitReply;
|
||||
lockFile: boolean;
|
||||
videoCaptureId: any;
|
||||
signDetails: UserComment;
|
||||
lockTime: string | number | Date;
|
||||
unlockTime: number | Date;
|
||||
userResendDocuments: UserResendDocuments;
|
||||
objection: UserObjectionDto;
|
||||
dropPrice: PriceDrop;
|
||||
type: string;
|
||||
requiredDocuments: any;
|
||||
constructor(request: ClaimRequestManagementModel) {
|
||||
request.imageRequired.aroundTheCar = request.imageRequired.aroundTheCar.map(
|
||||
(v) => {
|
||||
//@ts-ignore
|
||||
delete v.aiReport;
|
||||
return v;
|
||||
},
|
||||
);
|
||||
request.imageRequired.aroundTheCar =
|
||||
request.imageRequired.selectPartOfCar.map((v) => {
|
||||
//@ts-ignore
|
||||
delete v.aiReport;
|
||||
return v;
|
||||
});
|
||||
this.requestDetail = {
|
||||
createdDate: request.createdAt.toLocaleDateString("fa-IR"),
|
||||
createdTime: request.createdAt.toLocaleTimeString("fa-IR"),
|
||||
status: request.claimStatus,
|
||||
};
|
||||
delete request.blameFile.actorsChecker;
|
||||
this.bankDamageUserInformation = {
|
||||
fullName: request.fullName,
|
||||
numberOfSheba: request.sheba,
|
||||
};
|
||||
this.blameFile = request.blameFile;
|
||||
this.videoCaptureId = request?.videoCaptureId;
|
||||
this.damageExpertResend = request.damageExpertResend;
|
||||
this.damageExpertReply = request.damageExpertReply;
|
||||
this.damageExpertReplyFinal = request.damageExpertReplyFinal;
|
||||
this.lockFile = request.lockFile;
|
||||
this.lockTime = request.lockTime;
|
||||
this.unlockTime = request.unlockTime;
|
||||
this.userResendDocuments = request.userResendDocuments;
|
||||
this.objection = request.objection as UserObjectionDto;
|
||||
this.carPartDamage = request.carPartDamage;
|
||||
this.imageRequired = request.imageRequired;
|
||||
this.carGreenCard = request.carGreenCard;
|
||||
this.nationalCodeOfInsurer = request.nationalCodeOfInsurer;
|
||||
this.otherParts = request.otherParts;
|
||||
this.sheba = request.sheba;
|
||||
this.dropPrice = request.priceDrop;
|
||||
this.type = request.blameFile?.type || "THIRD_PARTY"; // Include type field from blameFile
|
||||
this.requiredDocuments = request.requiredDocuments;
|
||||
}
|
||||
}
|
||||
22
src/expert-claim/dto/claim-list-rs.dto.ts
Normal file
22
src/expert-claim/dto/claim-list-rs.dto.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export class ClaimListDtoRs {
|
||||
public data: any[];
|
||||
constructor(claimFile) {
|
||||
this.data = claimFile.map((i) => {
|
||||
return {
|
||||
requestId: i._id,
|
||||
lockFile: i.isLocked,
|
||||
claimStatus: i.claimStatus,
|
||||
requestCode: i.blameFile?.requestNumber,
|
||||
firstPartyCar:
|
||||
i.blameFile.firstPartyDetails.firstPartyCarDetail.carName,
|
||||
secondPartyCar:
|
||||
i.blameFile.secondPartyDetails?.secondPartyCarDetail.carName,
|
||||
date: new Date(i.createdAt).toLocaleDateString("fa-IR"),
|
||||
time: new Date(i.createdAt).toLocaleTimeString("fa-IR"),
|
||||
status: i.status,
|
||||
effectedUserReply: i.effectedUserReply?.reply,
|
||||
type: i.blameFile?.type || "THIRD_PARTY", // Include type field from blameFile
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
33
src/expert-claim/dto/factor-validation.dto.ts
Normal file
33
src/expert-claim/dto/factor-validation.dto.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { Type } from "class-transformer";
|
||||
import {
|
||||
IsArray,
|
||||
IsEnum,
|
||||
IsOptional,
|
||||
IsString,
|
||||
ValidateNested,
|
||||
} from "class-validator";
|
||||
import { FactorStatus } from "src/Types&Enums/claim-request-management/factor-status.enum";
|
||||
|
||||
class FactorDecisionDto {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
partId: string;
|
||||
|
||||
@ApiProperty({ enum: [FactorStatus.APPROVED, FactorStatus.REJECTED] })
|
||||
@IsEnum([FactorStatus.APPROVED, FactorStatus.REJECTED])
|
||||
status: FactorStatus;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
rejectionReason?: string;
|
||||
}
|
||||
|
||||
export class FactorValidationDto {
|
||||
@ApiProperty({ type: [FactorDecisionDto] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => FactorDecisionDto)
|
||||
decisions: FactorDecisionDto[];
|
||||
}
|
||||
97
src/expert-claim/dto/reply.dto.ts
Normal file
97
src/expert-claim/dto/reply.dto.ts
Normal file
@@ -0,0 +1,97 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { TypeOfDamage } from "src/Types&Enums/claim-request-management/type-of-damage.enum";
|
||||
import { DaghiOption } from "src/Types&Enums/claim-request-management/daghi-option.enum";
|
||||
|
||||
export class CarPartDamageDto {
|
||||
@ApiProperty({ type: String })
|
||||
side: string;
|
||||
|
||||
@ApiProperty({ type: String })
|
||||
part: string;
|
||||
}
|
||||
|
||||
export class DaghiDetailsDto {
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
enum: DaghiOption,
|
||||
description: "Daghi option: ارزش لوازم بازیافتی, تحویل داغی, فاقد ارزش, با احتساب داغی",
|
||||
})
|
||||
option: DaghiOption;
|
||||
|
||||
@ApiProperty({
|
||||
required: false,
|
||||
type: String,
|
||||
description: "Price field required when option is 'ارزش لوازم بازیافتی'",
|
||||
})
|
||||
price?: string;
|
||||
|
||||
@ApiProperty({
|
||||
required: false,
|
||||
type: String,
|
||||
description: "Branch ID required when option is 'تحویل داغی'",
|
||||
})
|
||||
branchId?: string;
|
||||
}
|
||||
|
||||
export class PartsList {
|
||||
@ApiProperty({ required: true, type: String })
|
||||
partId: string;
|
||||
|
||||
@ApiProperty({ required: true, type: CarPartDamageDto })
|
||||
carPartDamage: CarPartDamageDto;
|
||||
|
||||
@ApiProperty({ required: true, type: String })
|
||||
typeOfDamage: TypeOfDamage;
|
||||
|
||||
@ApiProperty({ required: true, type: String })
|
||||
price: string;
|
||||
|
||||
@ApiProperty({ required: true, type: String })
|
||||
salary: string;
|
||||
|
||||
@ApiProperty({ required: true, type: String })
|
||||
totalPayment: string;
|
||||
|
||||
@ApiProperty({ required: true, type: DaghiDetailsDto })
|
||||
daghi: DaghiDetailsDto;
|
||||
|
||||
@ApiProperty({ required: true, type: Boolean })
|
||||
factorNeeded: boolean;
|
||||
}
|
||||
|
||||
export class ClaimSubmitReplyDto {
|
||||
@ApiProperty({ required: true })
|
||||
description: string;
|
||||
|
||||
@ApiProperty({ required: true, type: [PartsList] })
|
||||
parts: PartsList[];
|
||||
}
|
||||
|
||||
export class ResendCarPartsDto {
|
||||
@ApiProperty({ required: true })
|
||||
partId: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
partName: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
side?: string;
|
||||
}
|
||||
|
||||
class InPersonDocuments {
|
||||
NationalCertificate: string;
|
||||
CarCertificate: string;
|
||||
DrivingLicense: string;
|
||||
CarGreenCard: string;
|
||||
}
|
||||
|
||||
export class ClaimSubmitResendDto {
|
||||
@ApiProperty({ required: true })
|
||||
resendDescription: string;
|
||||
|
||||
@ApiProperty({ required: true, examples: InPersonDocuments })
|
||||
resendDocuments: InPersonDocuments[];
|
||||
|
||||
@ApiProperty({ required: true, type: [ResendCarPartsDto] })
|
||||
resendCarParts: ResendCarPartsDto[];
|
||||
}
|
||||
Reference in New Issue
Block a user