forked from Yara724/api
Fixed bugs of car-body steps
This commit is contained in:
@@ -254,13 +254,14 @@ export class ClaimRequestManagementV2Controller {
|
||||
**Workflow Step:** SELECT_OTHER_PARTS (Step 3 of Claim)
|
||||
|
||||
**Purpose:** User selects non-body damaged parts and provides bank information for payment.
|
||||
Optional: upload car green card file in the same step.
|
||||
|
||||
**Validations:**
|
||||
- Claim must exist
|
||||
- User must be the claim owner (damaged party from blame case)
|
||||
- Current workflow step must be SELECT_OTHER_PARTS
|
||||
- Bank information must not have been submitted previously
|
||||
- Sheba number must be exactly 24 digits
|
||||
- Sheba (sheba) accepted as IR + 24 digits or only 24 digits
|
||||
- National code must be exactly 10 digits
|
||||
|
||||
**Valid Other Parts (Optional):**
|
||||
@@ -278,42 +279,38 @@ export class ClaimRequestManagementV2Controller {
|
||||
description: "The claim case ID (MongoDB ObjectId)",
|
||||
example: "507f1f77bcf86cd799439011",
|
||||
})
|
||||
@ApiConsumes("multipart/form-data")
|
||||
@UseInterceptors(
|
||||
FileInterceptor("file", {
|
||||
limits: { fileSize: 10 * 1024 * 1024 },
|
||||
storage: diskStorage({
|
||||
destination: "./files/claim-required-document",
|
||||
filename: (req, file, callback) => {
|
||||
const unique = Date.now();
|
||||
const ex = extname(file.originalname);
|
||||
callback(null, `other-parts-${unique}${ex}`);
|
||||
},
|
||||
}),
|
||||
}),
|
||||
)
|
||||
@ApiBody({
|
||||
type: SelectOtherPartsV2Dto,
|
||||
description: "Other parts selection and bank information",
|
||||
examples: {
|
||||
example1: {
|
||||
summary: "Only bank info (no other parts damaged)",
|
||||
value: {
|
||||
otherParts: [],
|
||||
shebaNumber: "123456789012345678901234",
|
||||
nationalCodeOfOwner: "1234567890",
|
||||
},
|
||||
},
|
||||
example2: {
|
||||
summary: "Engine and suspension damage",
|
||||
value: {
|
||||
otherParts: ["engine", "suspension"],
|
||||
shebaNumber: "123456789012345678901234",
|
||||
nationalCodeOfOwner: "1234567890",
|
||||
},
|
||||
},
|
||||
example3: {
|
||||
summary: "Multiple systems damaged",
|
||||
value: {
|
||||
otherParts: ["engine", "brake_system", "electrical", "headlight"],
|
||||
shebaNumber: "123456789012345678901234",
|
||||
nationalCodeOfOwner: "1234567890",
|
||||
},
|
||||
},
|
||||
example4: {
|
||||
summary: "Lighting and glass damage",
|
||||
value: {
|
||||
otherParts: ["headlight", "taillight", "mirror", "glass"],
|
||||
shebaNumber: "123456789012345678901234",
|
||||
nationalCodeOfOwner: "1234567890",
|
||||
description:
|
||||
"Other parts + bank information. Use `sheba` and `nationalCodeOfInsurer` like THIRD_PARTY flow. Optional file can be uploaded as car green card.",
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
otherParts: {
|
||||
oneOf: [
|
||||
{ type: "array", items: { type: "string" } },
|
||||
{ type: "string", description: "JSON string array for multipart" },
|
||||
],
|
||||
example: ["engine", "suspension"],
|
||||
},
|
||||
sheba: { type: "string", example: "IR123456789012345678901234" },
|
||||
nationalCodeOfInsurer: { type: "string", example: "1234567890" },
|
||||
file: { type: "string", format: "binary" },
|
||||
},
|
||||
required: ["sheba", "nationalCodeOfInsurer"],
|
||||
},
|
||||
})
|
||||
@ApiResponse({
|
||||
@@ -341,6 +338,7 @@ export class ClaimRequestManagementV2Controller {
|
||||
@Param("claimRequestId") claimRequestId: string,
|
||||
@Body() body: SelectOtherPartsV2Dto,
|
||||
@CurrentUser() user: any,
|
||||
@UploadedFile() file?: Express.Multer.File,
|
||||
): Promise<SelectOtherPartsV2ResponseDto> {
|
||||
try {
|
||||
return await this.claimRequestManagementService.selectOtherPartsV2(
|
||||
@@ -348,6 +346,7 @@ export class ClaimRequestManagementV2Controller {
|
||||
body,
|
||||
user.sub,
|
||||
user,
|
||||
file,
|
||||
);
|
||||
} catch (error) {
|
||||
if (error instanceof HttpException) throw error;
|
||||
|
||||
Reference in New Issue
Block a user