1
0
forked from Yara724/api

Fix CAR_GREEN_CARD place to upload for v3

This commit is contained in:
SepehrYahyaee
2026-06-28 14:21:08 +03:30
parent 7e597db423
commit d3249e9854
3 changed files with 159 additions and 128 deletions

View File

@@ -45,9 +45,7 @@ import {
SelectOuterPartsV2Dto,
SelectOuterPartsV2ResponseDto,
} from "src/claim-request-management/dto/select-outer-parts-v2.dto";
import {
SelectOtherPartsV2ResponseDto,
} from "src/claim-request-management/dto/select-other-parts-v2.dto";
import { SelectOtherPartsV2ResponseDto } from "src/claim-request-management/dto/select-other-parts-v2.dto";
import { SelectOtherPartsV3Dto } from "src/claim-request-management/dto/select-other-parts-v3.dto";
import {
UploadRequiredDocumentV2Dto,
@@ -117,7 +115,8 @@ export class ExpertInitiatedBlameV3MirrorController {
@ApiBody({ type: SendPartyOtpDto })
@ApiOperation({
summary: "Send OTP to one party",
description: "Guilty party first; damaged party after guilty party has signed (THIRD_PARTY).",
description:
"Guilty party first; damaged party after guilty party has signed (THIRD_PARTY).",
})
async sendPartyOtp(
@CurrentUser() expert: any,
@@ -139,7 +138,11 @@ export class ExpertInitiatedBlameV3MirrorController {
@Param("requestId") requestId: string,
@Body() dto: VerifyPartyOtpDto,
) {
return this.requestManagementService.verifyPartyOtpV2(expert, requestId, dto);
return this.requestManagementService.verifyPartyOtpV2(
expert,
requestId,
dto,
);
}
@Post("car-body-form/:requestId")
@@ -181,7 +184,9 @@ export class ExpertInitiatedBlameV3MirrorController {
@Post("add-detail-location/:requestId")
@ApiParam({ name: "requestId" })
@ApiBody({ type: LocationDto })
@ApiOperation({ summary: "Add location for current party (partyRole FIRST or SECOND)" })
@ApiOperation({
summary: "Add location for current party (partyRole FIRST or SECOND)",
})
async addLocation(
@Param("requestId") requestId: string,
@Body() body: LocationDto,
@@ -400,38 +405,42 @@ export class ExpertInitiatedBlameV3MirrorController {
@Patch("select-other-parts/:claimRequestId")
@ApiParam({ name: "claimRequestId", example: "507f1f77bcf86cd799439011" })
@ApiConsumes("multipart/form-data")
@UseInterceptors(
FileInterceptor("file", {
limits: { fileSize: DEFAULT_MEDIA_MAX_BYTES },
storage: diskStorage({
destination: "./files/claim-required-document",
filename: (req, file, callback) => {
const unique = Date.now();
const ex = extname(file.originalname);
callback(null, `v3-other-parts-${unique}${ex}`);
},
}),
}),
)
@ApiOperation({
summary: "Select other damaged parts (V3)",
description:
"Other parts only — sheba and national code were collected during run-inquiries. Optional car green card file.",
})
@ApiBody({
description: "Other parts selection. Bank info is already on the claim from run-inquiries.",
description:
"Other parts selection. Bank info is already on the claim from run-inquiries.",
schema: {
type: "object",
properties: {
otherParts: {
oneOf: [
{ type: "array", items: { type: "string", enum: ["engine", "suspension", "brake_system", "electrical", "radiator", "transmission", "exhaust", "headlight", "taillight", "mirror", "glass"] } },
{
type: "array",
items: {
type: "string",
enum: [
"engine",
"suspension",
"brake_system",
"electrical",
"radiator",
"transmission",
"exhaust",
"headlight",
"taillight",
"mirror",
"glass",
],
},
},
{ type: "string", description: "JSON string array for multipart" },
],
example: ["engine", "suspension"],
},
file: { type: "string", format: "binary", description: "Optional car green card" },
},
},
})
@@ -439,17 +448,12 @@ export class ExpertInitiatedBlameV3MirrorController {
@Param("claimRequestId") claimRequestId: string,
@Body() body: SelectOtherPartsV3Dto,
@CurrentUser() expert: any,
@UploadedFile() file?: Express.Multer.File,
): Promise<SelectOtherPartsV2ResponseDto> {
if (file) {
await this.mediaPolicyService.assertForClaim(file, claimRequestId, "image");
}
return this.claimRequestManagementService.selectOtherPartsV3(
claimRequestId,
body,
expert.sub,
expert,
file,
);
}