forked from Yara724/api
Added v3 of field-expert
This commit is contained in:
91
src/request-management/dto/run-inquiries-v3.dto.ts
Normal file
91
src/request-management/dto/run-inquiries-v3.dto.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import {
|
||||
IsBoolean,
|
||||
IsNotEmpty,
|
||||
IsOptional,
|
||||
IsString,
|
||||
ValidateNested,
|
||||
} from "class-validator";
|
||||
import { Type } from "class-transformer";
|
||||
|
||||
class PlateV3Dto {
|
||||
@ApiProperty({ example: "44", description: "Left two digits" })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
leftDigits: string;
|
||||
|
||||
@ApiProperty({ example: "ب", description: "Center alphabet letter" })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
centerAlphabet: string;
|
||||
|
||||
@ApiProperty({ example: "111", description: "Center three digits" })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
centerDigits: string;
|
||||
|
||||
@ApiProperty({ example: "22", description: "Right two digits (Iran region code)" })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
ir: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Body for `POST run-inquiries/:requestId`.
|
||||
* First call = guilty party (+ auto claim). Second call = damaged party (THIRD_PARTY only).
|
||||
*/
|
||||
export class RunInquiriesV3Dto {
|
||||
@ApiProperty({
|
||||
type: PlateV3Dto,
|
||||
description: "Plate segments — Tejarat block / third-party inquiry.",
|
||||
})
|
||||
@ValidateNested()
|
||||
@Type(() => PlateV3Dto)
|
||||
plate: PlateV3Dto;
|
||||
|
||||
@ApiProperty({ example: "1234567890", description: "National code of the policyholder (insurer)" })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
nationalCodeOfInsurer: string;
|
||||
|
||||
@ApiProperty({ example: "1234567890", description: "National code of the driver" })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
nationalCodeOfDriver: string;
|
||||
|
||||
@ApiProperty({ example: true, description: "Whether the driver is the same person as the insurer" })
|
||||
@IsBoolean()
|
||||
driverIsInsurer: boolean;
|
||||
|
||||
@ApiProperty({ example: 13780624, description: "Insurer birth date (Jalali)" })
|
||||
insurerBirthday: number | string;
|
||||
|
||||
@ApiPropertyOptional({ example: 13780624, description: "Driver birth date (Jalali). Required when driverIsInsurer is false." })
|
||||
@IsOptional()
|
||||
driverBirthday?: number | string | null;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "IR123456789012345678901234",
|
||||
description:
|
||||
"Sheba (IBAN). Required on the damaged party call (CAR_BODY first call; THIRD_PARTY second call).",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
sheba?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "123456789",
|
||||
description: "Driver license (required when driverIsInsurer is false).",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
driverLicense?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "123456789",
|
||||
description: "Insurer license (required when driverIsInsurer is true).",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
insurerLicense?: string;
|
||||
}
|
||||
@@ -0,0 +1,584 @@
|
||||
import { extname } from "node:path";
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Get,
|
||||
Param,
|
||||
Patch,
|
||||
Post,
|
||||
Put,
|
||||
UploadedFile,
|
||||
UseGuards,
|
||||
UseInterceptors,
|
||||
} from "@nestjs/common";
|
||||
import {
|
||||
ApiBearerAuth,
|
||||
ApiBody,
|
||||
ApiConsumes,
|
||||
ApiOperation,
|
||||
ApiParam,
|
||||
ApiTags,
|
||||
} from "@nestjs/swagger";
|
||||
import { FileInterceptor } from "@nestjs/platform-express";
|
||||
import { diskStorage } from "multer";
|
||||
import { LocalActorAuthGuard } from "src/auth/guards/actor-local.guard";
|
||||
import { RolesGuard } from "src/auth/guards/role.guard";
|
||||
import { Roles } from "src/decorators/roles.decorator";
|
||||
import { CurrentUser } from "src/decorators/user.decorator";
|
||||
import { MediaPolicyService } from "src/media-policy/media-policy.service";
|
||||
import { DEFAULT_MEDIA_MAX_BYTES } from "src/client/client.service";
|
||||
import { RoleEnum } from "src/Types&Enums/role.enum";
|
||||
import { CreationMethod } from "./entities/schema/request-management.schema";
|
||||
import { CreateExpertInitiatedFileDto } from "./dto/expert-initiated.dto";
|
||||
import { SendPartyOtpDto, VerifyPartyOtpDto } from "./dto/party-otp.dto";
|
||||
import { RunInquiriesV3Dto } from "./dto/run-inquiries-v3.dto";
|
||||
import {
|
||||
CarBodyFormDto,
|
||||
DescriptionDto,
|
||||
LocationDto,
|
||||
} from "./dto/create-request-management.dto";
|
||||
import { ExpertAccidentFieldsDto } from "./dto/expert-accident-fields.dto";
|
||||
import { RequestManagementService } from "./request-management.service";
|
||||
import { ClaimRequestManagementService } from "src/claim-request-management/claim-request-management.service";
|
||||
import { PartyRole } from "./entities/schema/partyRole.enum";
|
||||
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 { SelectOtherPartsV3Dto } from "src/claim-request-management/dto/select-other-parts-v3.dto";
|
||||
import {
|
||||
UploadRequiredDocumentV2Dto,
|
||||
UploadRequiredDocumentV2ResponseDto,
|
||||
} from "src/claim-request-management/dto/upload-document-v2.dto";
|
||||
import {
|
||||
CapturePartV2Dto,
|
||||
CapturePartV2ResponseDto,
|
||||
} from "src/claim-request-management/dto/capture-part-v2.dto";
|
||||
import { GetCaptureRequirementsV2ResponseDto } from "src/claim-request-management/dto/capture-requirements-v2.dto";
|
||||
|
||||
/**
|
||||
* V3 field-expert in-person flow (one party at a time, standard workflow steps).
|
||||
*
|
||||
* THIRD_PARTY:
|
||||
* create → OTP/verify (guilty) → [car-body-form if CAR_BODY] → run-inquiries (guilty + claim)
|
||||
* → location/description/voice → sign → OTP/verify (damaged) → run-inquiries (damaged)
|
||||
* → location/description/voice → sign → accident-fields → docs → outer parts → other parts
|
||||
* → capture-part → car-capture → upload-video (blame accident video, last) → WAITING_FOR_EXPERT
|
||||
*
|
||||
* CAR_BODY: same but single party — omit second-party OTP/inquiries/sign steps.
|
||||
*/
|
||||
@ApiTags("expert-initiated blame (mirror v3 in-person)")
|
||||
@Controller("v3/expert-initiated/blame-request-management")
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(LocalActorAuthGuard, RolesGuard)
|
||||
@Roles(RoleEnum.FIELD_EXPERT)
|
||||
export class ExpertInitiatedBlameV3MirrorController {
|
||||
constructor(
|
||||
private readonly requestManagementService: RequestManagementService,
|
||||
private readonly claimRequestManagementService: ClaimRequestManagementService,
|
||||
private readonly mediaPolicyService: MediaPolicyService,
|
||||
) {}
|
||||
|
||||
@Post()
|
||||
@ApiOperation({ summary: "Create IN_PERSON blame file" })
|
||||
@ApiBody({ type: CreateExpertInitiatedFileDto })
|
||||
async create(
|
||||
@CurrentUser() expert: any,
|
||||
@Body() dto: CreateExpertInitiatedFileDto,
|
||||
) {
|
||||
return this.requestManagementService.createExpertInitiatedBlameV2(expert, {
|
||||
...dto,
|
||||
creationMethod: CreationMethod.IN_PERSON,
|
||||
});
|
||||
}
|
||||
|
||||
@Get("claim-id/:requestId")
|
||||
@ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
@ApiOperation({
|
||||
summary: "Get linked claim ID",
|
||||
description:
|
||||
"Returns the claim auto-created during guilty-party run-inquiries. Use this claim ID for capture-requirements, upload-document, and part-selection endpoints.",
|
||||
})
|
||||
async getLinkedClaimId(
|
||||
@Param("requestId") requestId: string,
|
||||
@CurrentUser() expert: any,
|
||||
) {
|
||||
return this.requestManagementService.getV3LinkedClaimForExpert(
|
||||
expert,
|
||||
requestId,
|
||||
);
|
||||
}
|
||||
|
||||
@Post("send-party-otp/:requestId")
|
||||
@ApiParam({ name: "requestId" })
|
||||
@ApiBody({ type: SendPartyOtpDto })
|
||||
@ApiOperation({
|
||||
summary: "Send OTP to one party",
|
||||
description: "Guilty party first; damaged party after guilty party has signed (THIRD_PARTY).",
|
||||
})
|
||||
async sendPartyOtp(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@Body() dto: SendPartyOtpDto,
|
||||
) {
|
||||
return this.requestManagementService.sendPartyOtpV2(expert, requestId, dto);
|
||||
}
|
||||
|
||||
@Post("verify-party-otp/:requestId")
|
||||
@ApiParam({ name: "requestId" })
|
||||
@ApiBody({ type: VerifyPartyOtpDto })
|
||||
@ApiOperation({
|
||||
summary: "Verify one party OTP",
|
||||
description: "FIRST (guilty) then SECOND (damaged) on THIRD_PARTY files.",
|
||||
})
|
||||
async verifyPartyOtp(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@Body() dto: VerifyPartyOtpDto,
|
||||
) {
|
||||
return this.requestManagementService.verifyPartyOtpV2(expert, requestId, dto);
|
||||
}
|
||||
|
||||
@Post("car-body-form/:requestId")
|
||||
@ApiParam({ name: "requestId" })
|
||||
@ApiBody({ type: CarBodyFormDto })
|
||||
@ApiOperation({
|
||||
summary: "CAR_BODY only — accident type before inquiries",
|
||||
description: "Submit after guilty-party OTP verify, before run-inquiries.",
|
||||
})
|
||||
async carBodyForm(
|
||||
@Param("requestId") requestId: string,
|
||||
@Body() body: CarBodyFormDto,
|
||||
@CurrentUser() expert: any,
|
||||
) {
|
||||
return this.requestManagementService.carBodyAccidentTypeFormV3(
|
||||
requestId,
|
||||
body,
|
||||
expert,
|
||||
);
|
||||
}
|
||||
|
||||
@Post("run-inquiries/:requestId")
|
||||
@ApiParam({ name: "requestId" })
|
||||
@ApiBody({ type: RunInquiriesV3Dto })
|
||||
@ApiOperation({
|
||||
summary: "Run external inquiries for the current party",
|
||||
description:
|
||||
"1st call = guilty party (+ auto claim). 2nd call = damaged party (THIRD_PARTY, after guilty sign). " +
|
||||
"Advances workflow to FIRST_INITIAL_FORM or SECOND_INITIAL_FORM.",
|
||||
})
|
||||
async runInquiries(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@Body() dto: RunInquiriesV3Dto,
|
||||
) {
|
||||
return this.requestManagementService.runInquiriesV3(requestId, expert, dto);
|
||||
}
|
||||
|
||||
@Post("add-detail-location/:requestId")
|
||||
@ApiParam({ name: "requestId" })
|
||||
@ApiBody({ type: LocationDto })
|
||||
@ApiOperation({ summary: "Add location for current party (partyRole FIRST or SECOND)" })
|
||||
async addLocation(
|
||||
@Param("requestId") requestId: string,
|
||||
@Body() body: LocationDto,
|
||||
@CurrentUser() expert: any,
|
||||
@Body("partyRole") partyRole?: string,
|
||||
) {
|
||||
return this.requestManagementService.addPartyLocationV3(
|
||||
requestId,
|
||||
expert,
|
||||
body,
|
||||
partyRole,
|
||||
);
|
||||
}
|
||||
|
||||
@Post("add-detail-description/:requestId")
|
||||
@ApiParam({ name: "requestId" })
|
||||
@ApiBody({ type: DescriptionDto })
|
||||
@ApiOperation({ summary: "Add description for current party" })
|
||||
async addDescription(
|
||||
@Param("requestId") requestId: string,
|
||||
@Body() body: DescriptionDto,
|
||||
@CurrentUser() expert: any,
|
||||
@Body("partyRole") partyRole?: string,
|
||||
) {
|
||||
return this.requestManagementService.addPartyDescriptionV3(
|
||||
requestId,
|
||||
expert,
|
||||
body,
|
||||
partyRole,
|
||||
);
|
||||
}
|
||||
|
||||
@ApiBody({
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
file: { type: "string", format: "binary" },
|
||||
partyRole: { type: "string", enum: ["FIRST", "SECOND"] },
|
||||
},
|
||||
required: ["file"],
|
||||
},
|
||||
})
|
||||
@ApiConsumes("multipart/form-data")
|
||||
@UseInterceptors(
|
||||
FileInterceptor("file", {
|
||||
limits: { fileSize: DEFAULT_MEDIA_MAX_BYTES },
|
||||
storage: diskStorage({
|
||||
destination: "./files/voice",
|
||||
filename: (req, file, callback) => {
|
||||
const unique = Date.now();
|
||||
const ex = extname(file.originalname);
|
||||
callback(null, `v3-expert-voice-${unique}${ex}`);
|
||||
},
|
||||
}),
|
||||
}),
|
||||
)
|
||||
@Post("upload-voice/:requestId")
|
||||
@ApiParam({ name: "requestId" })
|
||||
@ApiOperation({ summary: "Upload voice for current party" })
|
||||
async uploadVoice(
|
||||
@Param("requestId") requestId: string,
|
||||
@CurrentUser() expert: any,
|
||||
@UploadedFile() voice: Express.Multer.File,
|
||||
@Body("partyRole") partyRole?: string,
|
||||
) {
|
||||
await this.mediaPolicyService.assertForBlame(voice, requestId, "voice");
|
||||
return this.requestManagementService.addPartyVoiceV3(
|
||||
requestId,
|
||||
expert,
|
||||
voice,
|
||||
partyRole,
|
||||
);
|
||||
}
|
||||
|
||||
@Put("sign/:requestId")
|
||||
@ApiParam({ name: "requestId" })
|
||||
@ApiConsumes("multipart/form-data")
|
||||
@ApiOperation({ summary: "Party on-site signature" })
|
||||
@ApiBody({
|
||||
schema: {
|
||||
type: "object",
|
||||
required: ["partyRole", "sign"],
|
||||
properties: {
|
||||
partyRole: { type: "string", enum: ["FIRST", "SECOND"] },
|
||||
isAccept: { type: "boolean", default: true },
|
||||
sign: { type: "string", format: "binary" },
|
||||
},
|
||||
},
|
||||
})
|
||||
@UseInterceptors(
|
||||
FileInterceptor("sign", {
|
||||
limits: { fileSize: DEFAULT_MEDIA_MAX_BYTES },
|
||||
storage: diskStorage({
|
||||
destination: "./files/signs",
|
||||
filename: (req, file, callback) => {
|
||||
const unique = Date.now();
|
||||
const ex = extname(file.originalname);
|
||||
callback(null, `v3-expert-party-${unique}${ex}`);
|
||||
},
|
||||
}),
|
||||
}),
|
||||
)
|
||||
async sign(
|
||||
@Param("requestId") requestId: string,
|
||||
@Body() body: { partyRole?: string; isAccept?: string | boolean },
|
||||
@CurrentUser() expert: any,
|
||||
@UploadedFile() sign: Express.Multer.File,
|
||||
) {
|
||||
await this.mediaPolicyService.assertForBlame(sign, requestId, "image");
|
||||
const partyRole =
|
||||
body?.partyRole === "SECOND" ? PartyRole.SECOND : PartyRole.FIRST;
|
||||
const isAccept = !(body?.isAccept === false || body?.isAccept === "false");
|
||||
return this.requestManagementService.expertUploadPartySignatureV3(
|
||||
expert,
|
||||
requestId,
|
||||
partyRole,
|
||||
isAccept,
|
||||
sign,
|
||||
);
|
||||
}
|
||||
|
||||
@Post("accident-fields/:requestId")
|
||||
@ApiParam({ name: "requestId" })
|
||||
@ApiBody({ type: ExpertAccidentFieldsDto })
|
||||
@ApiOperation({
|
||||
summary: "Accident type / fields (after all signatures)",
|
||||
description:
|
||||
"Saves accident fields only. Does not move to WAITING_FOR_EXPERT — that happens after the final blame accident video.",
|
||||
})
|
||||
async addAccidentFields(
|
||||
@Param("requestId") requestId: string,
|
||||
@Body() fields: ExpertAccidentFieldsDto,
|
||||
@CurrentUser() expert: any,
|
||||
) {
|
||||
return this.requestManagementService.expertAddAccidentFieldsForBlameV3(
|
||||
expert,
|
||||
requestId,
|
||||
fields,
|
||||
);
|
||||
}
|
||||
|
||||
@Get("capture-requirements/:claimRequestId")
|
||||
@ApiParam({ name: "claimRequestId" })
|
||||
@ApiOperation({ summary: "List required claim documents" })
|
||||
async getCaptureRequirements(
|
||||
@Param("claimRequestId") claimRequestId: string,
|
||||
@CurrentUser() expert: any,
|
||||
): Promise<GetCaptureRequirementsV2ResponseDto> {
|
||||
return this.claimRequestManagementService.getCaptureRequirementsV3(
|
||||
claimRequestId,
|
||||
expert.sub,
|
||||
expert,
|
||||
);
|
||||
}
|
||||
|
||||
@Post("upload-document/:claimRequestId")
|
||||
@ApiParam({ name: "claimRequestId" })
|
||||
@ApiConsumes("multipart/form-data")
|
||||
@UseInterceptors(
|
||||
FileInterceptor("file", {
|
||||
limits: { fileSize: DEFAULT_MEDIA_MAX_BYTES },
|
||||
storage: diskStorage({
|
||||
destination: "./files/claim-documents",
|
||||
filename: (req, file, callback) => {
|
||||
const unique = Date.now();
|
||||
const ex = extname(file.originalname);
|
||||
callback(null, `${file.originalname.split(".")[0]}-${unique}${ex}`);
|
||||
},
|
||||
}),
|
||||
}),
|
||||
)
|
||||
@ApiOperation({ summary: "Upload one required claim document" })
|
||||
async uploadDocument(
|
||||
@Param("claimRequestId") claimRequestId: string,
|
||||
@Body() body: UploadRequiredDocumentV2Dto,
|
||||
@UploadedFile() file: Express.Multer.File,
|
||||
@CurrentUser() expert: any,
|
||||
): Promise<UploadRequiredDocumentV2ResponseDto> {
|
||||
await this.mediaPolicyService.assertForClaim(file, claimRequestId, "image");
|
||||
return this.claimRequestManagementService.uploadRequiredDocumentV3(
|
||||
claimRequestId,
|
||||
body,
|
||||
file,
|
||||
expert.sub,
|
||||
expert,
|
||||
);
|
||||
}
|
||||
|
||||
@Patch("select-outer-parts/:claimRequestId")
|
||||
@ApiParam({ name: "claimRequestId" })
|
||||
@ApiBody({ type: SelectOuterPartsV2Dto })
|
||||
@ApiOperation({ summary: "Select damaged outer parts" })
|
||||
async selectOuterParts(
|
||||
@Param("claimRequestId") claimRequestId: string,
|
||||
@Body() body: SelectOuterPartsV2Dto,
|
||||
@CurrentUser() expert: any,
|
||||
): Promise<SelectOuterPartsV2ResponseDto> {
|
||||
return this.claimRequestManagementService.selectOuterPartsV3(
|
||||
claimRequestId,
|
||||
body,
|
||||
expert.sub,
|
||||
expert,
|
||||
);
|
||||
}
|
||||
|
||||
@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.",
|
||||
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: "string", description: "JSON string array for multipart" },
|
||||
],
|
||||
example: ["engine", "suspension"],
|
||||
},
|
||||
file: { type: "string", format: "binary", description: "Optional car green card" },
|
||||
},
|
||||
},
|
||||
})
|
||||
async selectOtherParts(
|
||||
@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,
|
||||
);
|
||||
}
|
||||
|
||||
@Post("capture-part/:claimRequestId")
|
||||
@ApiParam({ name: "claimRequestId", example: "507f1f77bcf86cd799439011" })
|
||||
@ApiConsumes("multipart/form-data")
|
||||
@UseInterceptors(
|
||||
FileInterceptor("file", {
|
||||
limits: { fileSize: DEFAULT_MEDIA_MAX_BYTES },
|
||||
storage: diskStorage({
|
||||
destination: "./files/claim-captures",
|
||||
filename: (req, file, callback) => {
|
||||
const unique = Date.now();
|
||||
const ex = extname(file.originalname);
|
||||
callback(null, `v3-capture-${unique}${ex}`);
|
||||
},
|
||||
}),
|
||||
}),
|
||||
)
|
||||
@ApiOperation({
|
||||
summary: "Field — car angles and damaged-part photos",
|
||||
description:
|
||||
"CAPTURE_PART_DAMAGES: (1) all damaged-part photos, (2) four car angles, (3) chassis/engine/metal-plate via upload-document. Then car-capture walk-around video.",
|
||||
})
|
||||
@ApiBody({
|
||||
schema: {
|
||||
type: "object",
|
||||
required: ["captureType", "captureKey", "file"],
|
||||
properties: {
|
||||
captureType: {
|
||||
type: "string",
|
||||
enum: ["angle", "part"],
|
||||
example: "angle",
|
||||
},
|
||||
captureKey: {
|
||||
type: "string",
|
||||
example: "front",
|
||||
description:
|
||||
"For angle: front/back/left/right. For part: hood/front_bumper/etc.",
|
||||
},
|
||||
file: { type: "string", format: "binary" },
|
||||
},
|
||||
},
|
||||
})
|
||||
async capturePart(
|
||||
@Param("claimRequestId") claimRequestId: string,
|
||||
@Body() body: CapturePartV2Dto,
|
||||
@UploadedFile() file: Express.Multer.File,
|
||||
@CurrentUser() expert: any,
|
||||
): Promise<CapturePartV2ResponseDto> {
|
||||
await this.mediaPolicyService.assertForClaim(file, claimRequestId, "image");
|
||||
return this.claimRequestManagementService.capturePartV3(
|
||||
claimRequestId,
|
||||
body,
|
||||
file,
|
||||
expert.sub,
|
||||
expert,
|
||||
);
|
||||
}
|
||||
|
||||
@Patch("car-capture/:claimRequestId")
|
||||
@ApiParam({ name: "claimRequestId", example: "507f1f77bcf86cd799439011" })
|
||||
@ApiConsumes("multipart/form-data")
|
||||
@UseInterceptors(
|
||||
FileInterceptor("file", {
|
||||
limits: { fileSize: DEFAULT_MEDIA_MAX_BYTES },
|
||||
storage: diskStorage({
|
||||
destination: "./files/car-capture-videos/",
|
||||
filename: (req, file, callback) => {
|
||||
const unique = Date.now();
|
||||
const ex = extname(file.originalname);
|
||||
callback(null, `v3-claim-video-${unique}${ex}`);
|
||||
},
|
||||
}),
|
||||
}),
|
||||
)
|
||||
@ApiBody({
|
||||
schema: {
|
||||
type: "object",
|
||||
required: ["file"],
|
||||
properties: { file: { type: "string", format: "binary" } },
|
||||
},
|
||||
})
|
||||
@ApiOperation({
|
||||
summary: "Field — walk-around video",
|
||||
description:
|
||||
"Upload after capture-part is complete (parts, angles, capture-phase docs). Required before the final blame accident video.",
|
||||
})
|
||||
async carCapture(
|
||||
@Param("claimRequestId") claimRequestId: string,
|
||||
@UploadedFile("file") file: Express.Multer.File,
|
||||
@CurrentUser() expert: any,
|
||||
) {
|
||||
await this.mediaPolicyService.assertForClaim(file, claimRequestId, "video");
|
||||
return this.claimRequestManagementService.setVideoCaptureV3(
|
||||
claimRequestId,
|
||||
file,
|
||||
expert.sub,
|
||||
expert,
|
||||
);
|
||||
}
|
||||
|
||||
@ApiBody({
|
||||
schema: {
|
||||
type: "object",
|
||||
required: ["file"],
|
||||
properties: { file: { type: "string", format: "binary" } },
|
||||
},
|
||||
})
|
||||
@ApiConsumes("multipart/form-data")
|
||||
@UseInterceptors(
|
||||
FileInterceptor("file", {
|
||||
limits: { fileSize: DEFAULT_MEDIA_MAX_BYTES },
|
||||
storage: diskStorage({
|
||||
destination: "./files/video",
|
||||
filename: (req, file, callback) => {
|
||||
const unique = Date.now();
|
||||
const ex = extname(file.originalname);
|
||||
callback(null, `v3-blame-accident-${unique}${ex}`);
|
||||
},
|
||||
}),
|
||||
}),
|
||||
)
|
||||
@Post("upload-video/:requestId")
|
||||
@ApiParam({ name: "requestId" })
|
||||
@ApiOperation({
|
||||
summary: "Blame accident video (final step)",
|
||||
description:
|
||||
"Last step of the V3 flow. Requires claim walk-around video and completed capture. Sets blame status to WAITING_FOR_EXPERT.",
|
||||
})
|
||||
async uploadBlameVideo(
|
||||
@Param("requestId") requestId: string,
|
||||
@CurrentUser() expert: any,
|
||||
@UploadedFile() file: Express.Multer.File,
|
||||
) {
|
||||
await this.mediaPolicyService.assertForBlame(file, requestId, "video");
|
||||
return this.requestManagementService.expertUploadBlameVideoV3(
|
||||
expert,
|
||||
requestId,
|
||||
file,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
ApiOperation,
|
||||
ApiResponse,
|
||||
ApiConsumes,
|
||||
ApiExcludeController,
|
||||
} from "@nestjs/swagger";
|
||||
import { LocalActorAuthGuard } from "src/auth/guards/actor-local.guard";
|
||||
import { RolesGuard } from "src/auth/guards/role.guard";
|
||||
@@ -36,7 +37,8 @@ import { ExpertAccidentFieldsDto } from "./dto/expert-accident-fields.dto";
|
||||
import { ExpertCompleteClaimDataDto } from "./dto/expert-complete-claim-data.dto";
|
||||
import { ClaimRequestManagementService } from "src/claim-request-management/claim-request-management.service";
|
||||
|
||||
@ApiTags("expert-initiated-blame")
|
||||
@ApiExcludeController()
|
||||
// @ApiTags("expert-initiated-blame")
|
||||
@Controller("expert-initiated-blame")
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(LocalActorAuthGuard, RolesGuard)
|
||||
@@ -47,34 +49,26 @@ export class ExpertInitiatedController {
|
||||
private readonly claimRequestManagementService: ClaimRequestManagementService,
|
||||
) {}
|
||||
|
||||
@ApiOperation({ deprecated: true })
|
||||
// @ApiOperation({ deprecated: true })
|
||||
@Get("my-files")
|
||||
@ApiOperation({
|
||||
summary: "List my expert-initiated files",
|
||||
description:
|
||||
"Returns all blame files created by the current field expert (their panel).",
|
||||
})
|
||||
@ApiResponse({ status: 200, description: "List of expert-initiated files" })
|
||||
// @ApiOperation({
|
||||
// summary: "List my expert-initiated files",
|
||||
// description:
|
||||
// "Returns all blame files created by the current field expert (their panel).",
|
||||
// })
|
||||
// @ApiResponse({ status: 200, description: "List of expert-initiated files" })
|
||||
async getMyFiles(@CurrentUser() expert: any) {
|
||||
return await this.requestManagementService.getMyExpertInitiatedFiles(
|
||||
expert,
|
||||
);
|
||||
return await this.requestManagementService.getMyExpertInitiatedFiles(expert);
|
||||
}
|
||||
|
||||
@ApiOperation({ deprecated: true })
|
||||
// @ApiOperation({ deprecated: true })
|
||||
@Post("complete-blame-data/:requestId")
|
||||
@ApiOperation({
|
||||
summary: "Submit all blame-needed data",
|
||||
description:
|
||||
"Single endpoint to complete blame form: send THIRD_PARTY or CAR_BODY form data according to file type. " +
|
||||
"Video and voice can be uploaded separately.",
|
||||
})
|
||||
@ApiParam({ name: "requestId", description: "ID of the expert-initiated file" })
|
||||
@ApiBody({
|
||||
description:
|
||||
"Send ExpertCompleteThirdPartyFormDto for THIRD_PARTY files or ExpertCompleteCarBodyFormDto for CAR_BODY files (according to file type).",
|
||||
})
|
||||
@ApiResponse({ status: 200, description: "Blame form completed successfully" })
|
||||
// @ApiParam({ name: "requestId", description: "ID of the expert-initiated file" })
|
||||
// @ApiBody({
|
||||
// description:
|
||||
// "Send ExpertCompleteThirdPartyFormDto for THIRD_PARTY files or ExpertCompleteCarBodyFormDto for CAR_BODY files (according to file type).",
|
||||
// })
|
||||
// @ApiResponse({ status: 200, description: "Blame form completed successfully" })
|
||||
async completeBlameData(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@@ -87,20 +81,20 @@ export class ExpertInitiatedController {
|
||||
);
|
||||
}
|
||||
|
||||
@ApiOperation({ deprecated: true })
|
||||
// @ApiOperation({ deprecated: true })
|
||||
@Post("complete-claim-data/:claimRequestId")
|
||||
@ApiOperation({
|
||||
summary: "Submit claim-needed data",
|
||||
description:
|
||||
"Field expert fills claim data for expert-initiated IN_PERSON files (car part damage, sheba, national code, other parts). " +
|
||||
"Only the initiating expert can call this.",
|
||||
})
|
||||
@ApiParam({
|
||||
name: "claimRequestId",
|
||||
description: "ID of the claim file (created from the expert-initiated blame file)",
|
||||
})
|
||||
@ApiBody({ type: ExpertCompleteClaimDataDto })
|
||||
@ApiResponse({ status: 200, description: "Claim data updated successfully" })
|
||||
// @ApiOperation({
|
||||
// summary: "Submit claim-needed data",
|
||||
// description:
|
||||
// "Field expert fills claim data for expert-initiated IN_PERSON files (car part damage, sheba, national code, other parts). " +
|
||||
// "Only the initiating expert can call this.",
|
||||
// })
|
||||
// @ApiParam({
|
||||
// name: "claimRequestId",
|
||||
// description: "ID of the claim file (created from the expert-initiated blame file)",
|
||||
// })
|
||||
// @ApiBody({ type: ExpertCompleteClaimDataDto })
|
||||
// @ApiResponse({ status: 200, description: "Claim data updated successfully" })
|
||||
async completeClaimData(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("claimRequestId") claimRequestId: string,
|
||||
@@ -141,24 +135,11 @@ export class ExpertInitiatedController {
|
||||
// );
|
||||
// }
|
||||
|
||||
@ApiOperation({ deprecated: true })
|
||||
// @ApiOperation({ deprecated: true })
|
||||
@Post("complete-form-third-party/:requestId")
|
||||
@ApiOperation({
|
||||
summary: "Expert completes all information for IN_PERSON THIRD_PARTY file",
|
||||
description:
|
||||
"Expert fills all information at once for IN_PERSON THIRD_PARTY files. " +
|
||||
"Includes first party, second party, and guilty party selection. " +
|
||||
"Video and voice uploads are handled separately.",
|
||||
})
|
||||
@ApiParam({
|
||||
name: "requestId",
|
||||
description: "ID of the expert-initiated IN_PERSON THIRD_PARTY file",
|
||||
})
|
||||
@ApiBody({ type: ExpertCompleteThirdPartyFormDto })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: "Form completed successfully. File is now ready for user signatures.",
|
||||
})
|
||||
// @ApiParam({ name: "requestId" })
|
||||
// @ApiBody({ type: ExpertCompleteThirdPartyFormDto })
|
||||
// @ApiResponse({ status: 200, description: "Form completed successfully. File is now ready for user signatures." })
|
||||
async completeThirdPartyForm(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@@ -171,24 +152,15 @@ export class ExpertInitiatedController {
|
||||
);
|
||||
}
|
||||
|
||||
@ApiOperation({ deprecated: true })
|
||||
// @ApiOperation({ deprecated: true })
|
||||
@Post("complete-form-car-body/:requestId")
|
||||
@ApiOperation({
|
||||
summary: "Expert completes all information for IN_PERSON CAR_BODY file",
|
||||
description:
|
||||
"Expert fills all information at once for IN_PERSON CAR_BODY files. " +
|
||||
"Includes first party data and carBodyForm. " +
|
||||
"Video and voice uploads are handled separately.",
|
||||
})
|
||||
@ApiParam({
|
||||
name: "requestId",
|
||||
description: "ID of the expert-initiated IN_PERSON CAR_BODY file",
|
||||
})
|
||||
@ApiBody({ type: ExpertCompleteCarBodyFormDto })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: "Form completed successfully. File is now ready for user signature.",
|
||||
})
|
||||
// @ApiOperation({
|
||||
// summary: "Expert completes all information for IN_PERSON CAR_BODY file",
|
||||
// description:
|
||||
// "Expert fills all information at once for IN_PERSON CAR_BODY files. " +
|
||||
// "Includes first party data and carBodyForm. " +
|
||||
// "Video and voice uploads are handled separately.",
|
||||
// })
|
||||
async completeCarBodyForm(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@@ -201,31 +173,16 @@ export class ExpertInitiatedController {
|
||||
);
|
||||
}
|
||||
|
||||
@ApiOperation({ deprecated: true })
|
||||
@Post("upload-video/:requestId")
|
||||
@ApiOperation({
|
||||
summary: "Expert uploads video for expert-initiated file",
|
||||
description:
|
||||
"Expert uploads a single video file for the entire blame file. " +
|
||||
"Only one video is needed per file (not per party). " +
|
||||
"Only works for expert-initiated files.",
|
||||
})
|
||||
@ApiParam({
|
||||
name: "requestId",
|
||||
description: "ID of the expert-initiated file",
|
||||
})
|
||||
@ApiConsumes("multipart/form-data")
|
||||
@ApiBody({
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
file: {
|
||||
type: "string",
|
||||
format: "binary",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
// @ApiOperation({ deprecated: true })
|
||||
@Post("upload-video/:requestId")
|
||||
// @ApiParam({ name: "requestId" })
|
||||
// @ApiConsumes("multipart/form-data")
|
||||
// @ApiBody({
|
||||
// schema: {
|
||||
// type: "object",
|
||||
// properties: { file: { type: "string", format: "binary" } },
|
||||
// },
|
||||
// })
|
||||
@UseInterceptors(
|
||||
FileInterceptor("file", {
|
||||
limits: {
|
||||
@@ -242,10 +199,10 @@ export class ExpertInitiatedController {
|
||||
}),
|
||||
}),
|
||||
)
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: "Video uploaded successfully",
|
||||
})
|
||||
// @ApiResponse({
|
||||
// status: 200,
|
||||
// description: "Video uploaded successfully",
|
||||
// })
|
||||
async uploadVideo(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@@ -258,31 +215,28 @@ export class ExpertInitiatedController {
|
||||
);
|
||||
}
|
||||
|
||||
@ApiOperation({ deprecated: true })
|
||||
// @ApiOperation({ deprecated: true })
|
||||
@Post("upload-voice/:requestId")
|
||||
@ApiOperation({
|
||||
summary: "Expert uploads voice for expert-initiated file",
|
||||
description:
|
||||
"Expert uploads a single voice file for the entire blame file. " +
|
||||
"Only one voice is needed per file (not per party). " +
|
||||
"Only works for expert-initiated files.",
|
||||
})
|
||||
@ApiParam({
|
||||
name: "requestId",
|
||||
description: "ID of the expert-initiated file",
|
||||
})
|
||||
@ApiConsumes("multipart/form-data")
|
||||
@ApiBody({
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
voice: {
|
||||
type: "string",
|
||||
format: "binary",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
// @ApiOperation({
|
||||
// summary: "Expert uploads voice for expert-initiated file",
|
||||
// description:
|
||||
// "Expert uploads a single voice file for the entire blame file. " +
|
||||
// "Only one voice is needed per file (not per party). " +
|
||||
// "Only works for expert-initiated files.",
|
||||
// })
|
||||
// @ApiParam({ name: "requestId" })
|
||||
// @ApiConsumes("multipart/form-data")
|
||||
// @ApiBody({
|
||||
// schema: {
|
||||
// type: "object",
|
||||
// properties: {
|
||||
// voice: {
|
||||
// type: "string",
|
||||
// format: "binary",
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// })
|
||||
@UseInterceptors(
|
||||
FileInterceptor("voice", {
|
||||
limits: {
|
||||
@@ -300,10 +254,7 @@ export class ExpertInitiatedController {
|
||||
}),
|
||||
}),
|
||||
)
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: "Voice uploaded successfully",
|
||||
})
|
||||
// @ApiResponse({ status: 200, description: "Voice uploaded successfully" })
|
||||
async uploadVoice(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@@ -316,24 +267,18 @@ export class ExpertInitiatedController {
|
||||
);
|
||||
}
|
||||
|
||||
@ApiOperation({ deprecated: true })
|
||||
// @ApiOperation({ deprecated: true })
|
||||
@Post("add-accident-fields/:requestId")
|
||||
@ApiOperation({
|
||||
summary: "Expert adds accident fields to expert-initiated file",
|
||||
description:
|
||||
"Expert adds accident way, reason, and type fields to an expert-initiated file. " +
|
||||
"Can be used for both IN_PERSON and LINK-based files. " +
|
||||
"If expertSubmitReply already exists, updates the fields. Otherwise, creates a new expertSubmitReply.",
|
||||
})
|
||||
@ApiParam({
|
||||
name: "requestId",
|
||||
description: "ID of the expert-initiated file",
|
||||
})
|
||||
@ApiBody({ type: ExpertAccidentFieldsDto })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: "Accident fields added successfully",
|
||||
})
|
||||
// @ApiOperation({
|
||||
// summary: "Expert adds accident fields to expert-initiated file",
|
||||
// description:
|
||||
// "Expert adds accident way, reason, and type fields to an expert-initiated file. " +
|
||||
// "Can be used for both IN_PERSON and LINK-based files. " +
|
||||
// "If expertSubmitReply already exists, updates the fields. Otherwise, creates a new expertSubmitReply.",
|
||||
// })
|
||||
// @ApiParam({ name: "requestId" })
|
||||
// @ApiBody({ type: ExpertAccidentFieldsDto })
|
||||
// @ApiResponse({ status: 200, description: "Accident fields added successfully" })
|
||||
async addAccidentFields(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
|
||||
@@ -46,7 +46,7 @@ import { PartyRole } from "./entities/schema/partyRole.enum";
|
||||
* Field experts create files via LINK (send link to user) or IN_PERSON (expert fills on-site).
|
||||
* Only the initiating field expert can see/review these files.
|
||||
*/
|
||||
@ApiTags("expert-initiated-blame (v2)")
|
||||
// @ApiTags("expert-initiated-blame (v2)")
|
||||
@Controller("v2/expert-initiated-blame")
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(LocalActorAuthGuard, RolesGuard)
|
||||
@@ -59,23 +59,23 @@ export class ExpertInitiatedV2Controller {
|
||||
) {}
|
||||
|
||||
@Get("my-files")
|
||||
@ApiOperation({
|
||||
summary: "[V2] List my expert-initiated blame files",
|
||||
description:
|
||||
"Returns all BlameRequest (workflow) files created by the current field expert.",
|
||||
})
|
||||
@ApiResponse({ status: 200, description: "List of expert-initiated files" })
|
||||
// @ApiOperation({
|
||||
// summary: "[V2] List my expert-initiated blame files",
|
||||
// description:
|
||||
// "Returns all BlameRequest (workflow) files created by the current field expert.",
|
||||
// })
|
||||
// @ApiResponse({ status: 200, description: "List of expert-initiated files" })
|
||||
async getMyFilesV2(@CurrentUser() expert: any) {
|
||||
return this.requestManagementService.getMyExpertInitiatedFilesV2(expert);
|
||||
}
|
||||
|
||||
@Get("blame/:requestId")
|
||||
@ApiOperation({
|
||||
summary: "[V2] Get one expert-initiated blame request",
|
||||
description: "Returns a single blame request. Only the initiating field expert can access.",
|
||||
})
|
||||
@ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
@ApiResponse({ status: 200, description: "Blame request" })
|
||||
// @ApiOperation({
|
||||
// summary: "[V2] Get one expert-initiated blame request",
|
||||
// description: "Returns a single blame request. Only the initiating field expert can access.",
|
||||
// })
|
||||
// @ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
// @ApiResponse({ status: 200, description: "Blame request" })
|
||||
async getBlameRequestV2(
|
||||
@Param("requestId") requestId: string,
|
||||
@CurrentUser() expert: any,
|
||||
@@ -84,68 +84,45 @@ export class ExpertInitiatedV2Controller {
|
||||
}
|
||||
|
||||
@Post("create")
|
||||
@ApiOperation({
|
||||
summary: "[V2] Create expert-initiated blame file",
|
||||
description:
|
||||
"Creates a BlameRequest with workflow. LINK: parties identified by phone, expert sends link. IN_PERSON: expert fills form later.",
|
||||
})
|
||||
@ApiBody({
|
||||
type: CreateExpertInitiatedFileDto,
|
||||
examples: {
|
||||
thirdPartyInPerson: {
|
||||
summary: "Third-party, IN_PERSON (both parties)",
|
||||
description:
|
||||
"Expert fills form on-site for both parties.",
|
||||
value: {
|
||||
type: "THIRD_PARTY",
|
||||
creationMethod: "IN_PERSON",
|
||||
firstPartyPhoneNumber: "09123456789",
|
||||
secondPartyPhoneNumber: "09187654321",
|
||||
},
|
||||
},
|
||||
thirdPartyLink: {
|
||||
summary: "Third-party, LINK",
|
||||
description:
|
||||
"Expert sends link to first and second party by phone.",
|
||||
value: {
|
||||
type: "THIRD_PARTY",
|
||||
creationMethod: "LINK",
|
||||
firstPartyPhoneNumber: "09123456789",
|
||||
},
|
||||
},
|
||||
carBodyInPerson: {
|
||||
summary: "Car-body, IN_PERSON",
|
||||
description: "Expert fills form on-site for single party (car body).",
|
||||
value: {
|
||||
type: "CAR_BODY",
|
||||
creationMethod: "IN_PERSON",
|
||||
firstPartyPhoneNumber: "09123456789",
|
||||
},
|
||||
},
|
||||
carBodyLink: {
|
||||
summary: "Car-body, LINK",
|
||||
description:
|
||||
"Expert sends link to party by phone. Only first party phone needed.",
|
||||
value: {
|
||||
type: "CAR_BODY",
|
||||
creationMethod: "LINK",
|
||||
firstPartyPhoneNumber: "09123456789",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@ApiResponse({
|
||||
status: 201,
|
||||
description: "File created",
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
requestId: { type: "string" },
|
||||
publicId: { type: "string" },
|
||||
linkUrl: { type: "string", description: "Present for LINK method" },
|
||||
},
|
||||
},
|
||||
})
|
||||
// @ApiOperation({
|
||||
// summary: "[V2] Create expert-initiated blame file",
|
||||
// description:
|
||||
// "Creates a BlameRequest with workflow. LINK: parties identified by phone, expert sends link. IN_PERSON: expert fills form later.",
|
||||
// })
|
||||
// @ApiBody({
|
||||
// type: CreateExpertInitiatedFileDto,
|
||||
// examples: {
|
||||
// thirdPartyInPerson: {
|
||||
// summary: "Third-party, IN_PERSON (both parties)",
|
||||
// description:
|
||||
// "Expert fills form on-site for both parties.",
|
||||
// value: {
|
||||
// type: "THIRD_PARTY",
|
||||
// creationMethod: "LINK",
|
||||
// firstPartyPhoneNumber: "09123456789",
|
||||
// },
|
||||
// },
|
||||
// carBodyInPerson: {
|
||||
// summary: "Car-body, IN_PERSON",
|
||||
// description: "Expert fills form on-site for single party (car body).",
|
||||
// value: {
|
||||
// type: "CAR_BODY",
|
||||
// creationMethod: "IN_PERSON",
|
||||
// firstPartyPhoneNumber: "09123456789",
|
||||
// },
|
||||
// },
|
||||
// carBodyLink: {
|
||||
// summary: "Car-body, LINK",
|
||||
// description:
|
||||
// "Expert sends link to party by phone. Only first party phone needed.",
|
||||
// value: {
|
||||
// type: "CAR_BODY",
|
||||
// creationMethod: "LINK",
|
||||
// firstPartyPhoneNumber: "09123456789",
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// })
|
||||
async createV2(
|
||||
@CurrentUser() expert: any,
|
||||
@Body() dto: CreateExpertInitiatedFileDto,
|
||||
@@ -157,13 +134,13 @@ export class ExpertInitiatedV2Controller {
|
||||
}
|
||||
|
||||
@Post("send-link/:requestId")
|
||||
@ApiOperation({
|
||||
summary: "[V2] Send blame link to first party (LINK)",
|
||||
description:
|
||||
"For expert-initiated LINK files only. Provide the first party phone number; the service stores it, registers the user if needed, and sends the invite link via SMS.",
|
||||
})
|
||||
@ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
@ApiBody({ type: SendExpertInitiatedLinkV2Dto })
|
||||
// @ApiOperation({
|
||||
// summary: "[V2] Send blame link to first party (LINK)",
|
||||
// description:
|
||||
// "For expert-initiated LINK files only. Provide the first party phone number; the service stores it, registers the user if needed, and sends the invite link via SMS.",
|
||||
// })
|
||||
// @ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
// @ApiBody({ type: SendExpertInitiatedLinkV2Dto })
|
||||
async sendLinkV2(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@@ -173,14 +150,14 @@ export class ExpertInitiatedV2Controller {
|
||||
}
|
||||
|
||||
@Post("send-party-otps/:requestId")
|
||||
@ApiOperation({
|
||||
summary: "[V2] Send OTP to party/parties (IN_PERSON)",
|
||||
description:
|
||||
"Sends OTP via SMS to first party (and second party for THIRD_PARTY) using the same flow as /user/send-otp. Parties receive the code; collect it from them and call verify-party-otps. Call this before filling the blame form.",
|
||||
})
|
||||
@ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
@ApiBody({ type: SendPartyOtpsDto })
|
||||
@ApiResponse({ status: 200, description: "OTP(s) sent; collect codes and call verify-party-otps" })
|
||||
// @ApiOperation({
|
||||
// summary: "[V2] Send OTP to party/parties (IN_PERSON)",
|
||||
// description:
|
||||
// "Sends OTP via SMS to first party (and second party for THIRD_PARTY) using the same flow as /user/send-otp. Parties receive the code; collect it from them and call verify-party-otps. Call this before filling the blame form.",
|
||||
// })
|
||||
// @ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
// @ApiBody({ type: SendPartyOtpsDto })
|
||||
// @ApiResponse({ status: 200, description: "OTP(s) sent; collect codes and call verify-party-otps" })
|
||||
async sendPartyOtpsV2(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@@ -190,14 +167,14 @@ export class ExpertInitiatedV2Controller {
|
||||
}
|
||||
|
||||
@Post("verify-party-otps/:requestId")
|
||||
@ApiOperation({
|
||||
summary: "[V2] Verify party OTPs (IN_PERSON)",
|
||||
description:
|
||||
"After send-party-otps, parties receive SMS. They tell you the code; submit it here. Required before complete-blame-data.",
|
||||
})
|
||||
@ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
@ApiBody({ type: VerifyPartyOtpsDto })
|
||||
@ApiResponse({ status: 200, description: "OTPs verified; expert can proceed to complete-blame-data" })
|
||||
// @ApiOperation({
|
||||
// summary: "[V2] Verify party OTPs (IN_PERSON)",
|
||||
// description:
|
||||
// "After send-party-otps, parties receive SMS. They tell you the code; submit it here. Required before complete-blame-data.",
|
||||
// })
|
||||
// @ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
// @ApiBody({ type: VerifyPartyOtpsDto })
|
||||
// @ApiResponse({ status: 200, description: "OTPs verified; expert can proceed to complete-blame-data" })
|
||||
async verifyPartyOtpsV2(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@@ -207,99 +184,99 @@ export class ExpertInitiatedV2Controller {
|
||||
}
|
||||
|
||||
@Post("complete-blame-data/:requestId")
|
||||
@ApiOperation({
|
||||
summary: "[V2] Submit all blame data (IN_PERSON)",
|
||||
description:
|
||||
"For IN_PERSON files only. Send THIRD_PARTY or CAR_BODY form EXCEPT location. Use one shared expertDescription (not per-party descriptions). After this, call add-locations once to submit scene lat/lon and move workflow to WAITING_FOR_SIGNATURES.",
|
||||
})
|
||||
@ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
@ApiBody({
|
||||
description: "Choose THIRD_PARTY or CAR_BODY example according to the file type. IN_PERSON v2 uses one shared expertDescription for the scene.",
|
||||
examples: {
|
||||
THIRD_PARTY: {
|
||||
summary: "THIRD_PARTY",
|
||||
description: "Use when the blame file type is THIRD_PARTY",
|
||||
value: {
|
||||
firstPartyPhoneNumber: "09123456789",
|
||||
firstPartyInitialForm: {
|
||||
expertOpinion: false,
|
||||
imDamaged: false,
|
||||
imGuilty: true,
|
||||
},
|
||||
firstPartyPlate: {
|
||||
nationalCodeOfInsurer: "",
|
||||
nationalCodeOfDriver: "",
|
||||
insurerLicense: "",
|
||||
driverLicense: "",
|
||||
plate: { leftDigits: 12, centerAlphabet: "الف", centerDigits: 345, ir: 22 },
|
||||
driverIsInsurer: true,
|
||||
isNewCar: false,
|
||||
userNoCertificate: false,
|
||||
insurerBirthday: 13770624,
|
||||
driverBirthday: "1370-01-01",
|
||||
},
|
||||
expertDescription: { desc: "توضیح حادثه کارشناس (مشترک برای صحنه)" },
|
||||
secondParty: {
|
||||
phoneNumber: "09187654321",
|
||||
initialForm: {
|
||||
expertOpinion: false,
|
||||
imDamaged: true,
|
||||
imGuilty: false,
|
||||
},
|
||||
plate: {
|
||||
nationalCodeOfInsurer: "",
|
||||
nationalCodeOfDriver: "",
|
||||
insurerLicense: "",
|
||||
driverLicense: "",
|
||||
plate: { leftDigits: 91, centerAlphabet: "ن", centerDigits: 174, ir: 79 },
|
||||
driverIsInsurer: true,
|
||||
isNewCar: false,
|
||||
userNoCertificate: false,
|
||||
insurerBirthday: 13700720,
|
||||
driverBirthday: "1370-01-01",
|
||||
},
|
||||
},
|
||||
guiltyPartyPhoneNumber: "09123456789",
|
||||
},
|
||||
},
|
||||
CAR_BODY: {
|
||||
summary: "CAR_BODY",
|
||||
description: "Use when the blame file type is CAR_BODY",
|
||||
value: {
|
||||
firstPartyPhoneNumber: "09123456789",
|
||||
firstPartyInitialForm: {
|
||||
expertOpinion: false,
|
||||
imDamaged: false,
|
||||
imGuilty: true,
|
||||
},
|
||||
carBodyForm: { car: true, object: false },
|
||||
firstPartyPlate: {
|
||||
plateId: "",
|
||||
nationalCodeOfInsurer: "",
|
||||
nationalCodeOfDriver: "",
|
||||
insurerLicense: "",
|
||||
driverLicense: "",
|
||||
plate: { leftDigits: 12, centerAlphabet: "الف", centerDigits: 345, ir: 22 },
|
||||
driverIsInsurer: true,
|
||||
isNewCar: false,
|
||||
userNoCertificate: false,
|
||||
insurerBirthday: 1370,
|
||||
driverBirthday: "1370-01-01",
|
||||
},
|
||||
expertDescription: {
|
||||
desc: "توضیح حادثه",
|
||||
accidentDate: "2025-01-15",
|
||||
accidentTime: "14:30",
|
||||
weatherCondition: "صاف",
|
||||
roadCondition: "خشک",
|
||||
lightCondition: "روز",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
schema: { type: "object" },
|
||||
})
|
||||
@ApiResponse({ status: 200, description: "Blame form completed; next: add-locations" })
|
||||
// @ApiOperation({
|
||||
// summary: "[V2] Submit all blame data (IN_PERSON)",
|
||||
// description:
|
||||
// "For IN_PERSON files only. Send THIRD_PARTY or CAR_BODY form EXCEPT location. Use one shared expertDescription (not per-party descriptions). After this, call add-locations once to submit scene lat/lon and move workflow to WAITING_FOR_SIGNATURES.",
|
||||
// })
|
||||
// @ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
// @ApiBody({
|
||||
// description: "Choose THIRD_PARTY or CAR_BODY example according to the file type. IN_PERSON v2 uses one shared expertDescription for the scene.",
|
||||
// examples: {
|
||||
// THIRD_PARTY: {
|
||||
// summary: "THIRD_PARTY",
|
||||
// description: "Use when the blame file type is THIRD_PARTY",
|
||||
// value: {
|
||||
// firstPartyPhoneNumber: "09123456789",
|
||||
// firstPartyInitialForm: {
|
||||
// expertOpinion: false,
|
||||
// imDamaged: false,
|
||||
// imGuilty: true,
|
||||
// },
|
||||
// firstPartyPlate: {
|
||||
// nationalCodeOfInsurer: "",
|
||||
// nationalCodeOfDriver: "",
|
||||
// insurerLicense: "",
|
||||
// driverLicense: "",
|
||||
// plate: { leftDigits: 12, centerAlphabet: "الف", centerDigits: 345, ir: 22 },
|
||||
// driverIsInsurer: true,
|
||||
// isNewCar: false,
|
||||
// userNoCertificate: false,
|
||||
// insurerBirthday: 13770624,
|
||||
// driverBirthday: "1370-01-01",
|
||||
// },
|
||||
// expertDescription: { desc: "توضیح حادثه کارشناس (مشترک برای صحنه)" },
|
||||
// secondParty: {
|
||||
// phoneNumber: "09187654321",
|
||||
// initialForm: {
|
||||
// expertOpinion: false,
|
||||
// imDamaged: true,
|
||||
// imGuilty: false,
|
||||
// },
|
||||
// plate: {
|
||||
// nationalCodeOfInsurer: "",
|
||||
// nationalCodeOfDriver: "",
|
||||
// insurerLicense: "",
|
||||
// driverLicense: "",
|
||||
// plate: { leftDigits: 91, centerAlphabet: "ن", centerDigits: 174, ir: 79 },
|
||||
// driverIsInsurer: true,
|
||||
// isNewCar: false,
|
||||
// userNoCertificate: false,
|
||||
// insurerBirthday: 13700720,
|
||||
// driverBirthday: "1370-01-01",
|
||||
// },
|
||||
// },
|
||||
// guiltyPartyPhoneNumber: "09123456789",
|
||||
// },
|
||||
// },
|
||||
// CAR_BODY: {
|
||||
// summary: "CAR_BODY",
|
||||
// description: "Use when the blame file type is CAR_BODY",
|
||||
// value: {
|
||||
// firstPartyPhoneNumber: "09123456789",
|
||||
// firstPartyInitialForm: {
|
||||
// expertOpinion: false,
|
||||
// imDamaged: false,
|
||||
// imGuilty: true,
|
||||
// },
|
||||
// carBodyForm: { car: true, object: false },
|
||||
// firstPartyPlate: {
|
||||
// plateId: "",
|
||||
// nationalCodeOfInsurer: "",
|
||||
// nationalCodeOfDriver: "",
|
||||
// insurerLicense: "",
|
||||
// driverLicense: "",
|
||||
// plate: { leftDigits: 12, centerAlphabet: "الف", centerDigits: 345, ir: 22 },
|
||||
// driverIsInsurer: true,
|
||||
// isNewCar: false,
|
||||
// userNoCertificate: false,
|
||||
// insurerBirthday: 1370,
|
||||
// driverBirthday: "1370-01-01",
|
||||
// },
|
||||
// expertDescription: {
|
||||
// desc: "توضیح حادثه",
|
||||
// accidentDate: "2025-01-15",
|
||||
// accidentTime: "14:30",
|
||||
// weatherCondition: "صاف",
|
||||
// roadCondition: "خشک",
|
||||
// lightCondition: "روز",
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// schema: { type: "object" },
|
||||
// })
|
||||
// @ApiResponse({ status: 200, description: "Blame form completed; next: add-locations" })
|
||||
async completeBlameDataV2(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@@ -313,24 +290,24 @@ export class ExpertInitiatedV2Controller {
|
||||
}
|
||||
|
||||
@Post("add-locations/:requestId")
|
||||
@ApiOperation({
|
||||
summary: "[V2] Submit one scene location for expert-initiated IN_PERSON blame",
|
||||
description:
|
||||
"Submit one scene location after complete-blame-data. This transitions workflow to WAITING_FOR_SIGNATURES.",
|
||||
})
|
||||
@ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
@ApiBody({
|
||||
type: ExpertCompleteLocationV2Dto,
|
||||
examples: {
|
||||
scene: {
|
||||
summary: "One scene location (all IN_PERSON types)",
|
||||
value: {
|
||||
location: { lat: 35.6892, lon: 51.389 },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@ApiResponse({ status: 200, description: "Locations saved; next: upload party signature(s)" })
|
||||
// @ApiOperation({
|
||||
// summary: "[V2] Submit one scene location for expert-initiated IN_PERSON blame",
|
||||
// description:
|
||||
// "Submit one scene location after complete-blame-data. This transitions workflow to WAITING_FOR_SIGNATURES.",
|
||||
// })
|
||||
// @ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
// @ApiBody({
|
||||
// type: ExpertCompleteLocationV2Dto,
|
||||
// examples: {
|
||||
// scene: {
|
||||
// summary: "One scene location (all IN_PERSON types)",
|
||||
// value: {
|
||||
// location: { lat: 35.6892, lon: 51.389 },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// })
|
||||
// @ApiResponse({ status: 200, description: "Locations saved; next: upload party signature(s)" })
|
||||
async addLocationsV2(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@@ -344,17 +321,17 @@ export class ExpertInitiatedV2Controller {
|
||||
}
|
||||
|
||||
@Post("upload-video/:requestId")
|
||||
@ApiOperation({
|
||||
summary: "[V2] Expert uploads video for expert-initiated BlameRequest",
|
||||
})
|
||||
@ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
@ApiConsumes("multipart/form-data")
|
||||
@ApiBody({
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: { file: { type: "string", format: "binary" } },
|
||||
},
|
||||
})
|
||||
// @ApiOperation({
|
||||
// summary: "[V2] Expert uploads video for expert-initiated BlameRequest",
|
||||
// })
|
||||
// @ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
// @ApiConsumes("multipart/form-data")
|
||||
// @ApiBody({
|
||||
// schema: {
|
||||
// type: "object",
|
||||
// properties: { file: { type: "string", format: "binary" } },
|
||||
// },
|
||||
// })
|
||||
@UseInterceptors(
|
||||
FileInterceptor("file", {
|
||||
limits: { fileSize: DEFAULT_MEDIA_MAX_BYTES },
|
||||
@@ -368,7 +345,7 @@ export class ExpertInitiatedV2Controller {
|
||||
}),
|
||||
}),
|
||||
)
|
||||
@ApiResponse({ status: 200, description: "Video uploaded" })
|
||||
// @ApiResponse({ status: 200, description: "Video uploaded" })
|
||||
async uploadVideoV2(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@@ -383,17 +360,17 @@ export class ExpertInitiatedV2Controller {
|
||||
}
|
||||
|
||||
@Post("upload-voice/:requestId")
|
||||
@ApiOperation({
|
||||
summary: "[V2] Expert uploads voice for expert-initiated BlameRequest",
|
||||
})
|
||||
@ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
@ApiConsumes("multipart/form-data")
|
||||
@ApiBody({
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: { voice: { type: "string", format: "binary" } },
|
||||
},
|
||||
})
|
||||
// @ApiOperation({
|
||||
// summary: "[V2] Expert uploads voice for expert-initiated BlameRequest",
|
||||
// })
|
||||
// @ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
// @ApiConsumes("multipart/form-data")
|
||||
// @ApiBody({
|
||||
// schema: {
|
||||
// type: "object",
|
||||
// properties: { voice: { type: "string", format: "binary" } },
|
||||
// },
|
||||
// })
|
||||
@UseInterceptors(
|
||||
FileInterceptor("voice", {
|
||||
limits: { fileSize: DEFAULT_MEDIA_MAX_BYTES },
|
||||
@@ -408,7 +385,7 @@ export class ExpertInitiatedV2Controller {
|
||||
}),
|
||||
}),
|
||||
)
|
||||
@ApiResponse({ status: 200, description: "Voice uploaded" })
|
||||
// @ApiResponse({ status: 200, description: "Voice uploaded" })
|
||||
async uploadVoiceV2(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@@ -423,12 +400,12 @@ export class ExpertInitiatedV2Controller {
|
||||
}
|
||||
|
||||
@Post("add-accident-fields/:requestId")
|
||||
@ApiOperation({
|
||||
summary: "[V2] Expert adds accident fields to expert-initiated BlameRequest",
|
||||
})
|
||||
@ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
@ApiBody({ type: ExpertAccidentFieldsDto })
|
||||
@ApiResponse({ status: 200, description: "Accident fields added" })
|
||||
// @ApiOperation({
|
||||
// summary: "[V2] Expert adds accident fields to expert-initiated BlameRequest",
|
||||
// })
|
||||
// @ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
// @ApiBody({ type: ExpertAccidentFieldsDto })
|
||||
// @ApiResponse({ status: 200, description: "Accident fields added" })
|
||||
async addAccidentFieldsV2(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@@ -442,24 +419,24 @@ export class ExpertInitiatedV2Controller {
|
||||
}
|
||||
|
||||
@Post("upload-party-signature/:requestId")
|
||||
@ApiOperation({
|
||||
summary: "[V2] Expert uploads party signature (IN_PERSON)",
|
||||
description:
|
||||
"For IN_PERSON only. Upload a party's signature collected on-site. CAR_BODY: use partyRole FIRST once. THIRD_PARTY: upload FIRST then SECOND. When all required parties have signed, blame case completes.",
|
||||
})
|
||||
@ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
@ApiConsumes("multipart/form-data")
|
||||
@ApiBody({
|
||||
schema: {
|
||||
type: "object",
|
||||
required: ["partyRole", "sign"],
|
||||
properties: {
|
||||
partyRole: { type: "string", enum: ["FIRST", "SECOND"] },
|
||||
isAccept: { type: "boolean", default: true },
|
||||
sign: { type: "string", format: "binary" },
|
||||
},
|
||||
},
|
||||
})
|
||||
// @ApiOperation({
|
||||
// summary: "[V2] Expert uploads party signature (IN_PERSON)",
|
||||
// description:
|
||||
// "For IN_PERSON only. Upload a party's signature collected on-site. CAR_BODY: use partyRole FIRST once. THIRD_PARTY: upload FIRST then SECOND. When all required parties have signed, blame case completes.",
|
||||
// })
|
||||
// @ApiParam({ name: "requestId", description: "Blame request ID" })
|
||||
// @ApiConsumes("multipart/form-data")
|
||||
// @ApiBody({
|
||||
// schema: {
|
||||
// type: "object",
|
||||
// required: ["partyRole", "sign"],
|
||||
// properties: {
|
||||
// partyRole: { type: "string", enum: ["FIRST", "SECOND"] },
|
||||
// isAccept: { type: "boolean", default: true },
|
||||
// sign: { type: "string", format: "binary" },
|
||||
// },
|
||||
// },
|
||||
// })
|
||||
@UseInterceptors(
|
||||
FileInterceptor("sign", {
|
||||
limits: { fileSize: DEFAULT_MEDIA_MAX_BYTES },
|
||||
@@ -473,7 +450,7 @@ export class ExpertInitiatedV2Controller {
|
||||
}),
|
||||
}),
|
||||
)
|
||||
@ApiResponse({ status: 200, description: "Signature recorded" })
|
||||
// @ApiResponse({ status: 200, description: "Signature recorded" })
|
||||
async uploadPartySignatureV2(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@@ -496,13 +473,13 @@ export class ExpertInitiatedV2Controller {
|
||||
}
|
||||
|
||||
@Post("create-claim-from-blame/:blameRequestId")
|
||||
@ApiOperation({
|
||||
summary: "[V2] Create claim from expert-initiated IN_PERSON blame",
|
||||
description:
|
||||
"Field expert creates a claim on behalf of the damaged party. Blame must be COMPLETED (signatures collected). Then use claim v2 endpoints to fill parts, documents, and captures.",
|
||||
})
|
||||
@ApiParam({ name: "blameRequestId", description: "Completed blame request ID" })
|
||||
@ApiResponse({ status: 201, description: "Claim created" })
|
||||
// @ApiOperation({
|
||||
// summary: "[V2] Create claim from expert-initiated IN_PERSON blame",
|
||||
// description:
|
||||
// "Field expert creates a claim on behalf of the damaged party. Blame must be COMPLETED (signatures collected). Then use claim v2 endpoints to fill parts, documents, and captures.",
|
||||
// })
|
||||
// @ApiParam({ name: "blameRequestId", description: "Completed blame request ID" })
|
||||
// @ApiResponse({ status: 201, description: "Claim created" })
|
||||
async createClaimFromBlame(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("blameRequestId") blameRequestId: string,
|
||||
@@ -514,12 +491,12 @@ export class ExpertInitiatedV2Controller {
|
||||
}
|
||||
|
||||
@Post("complete-claim-data/:claimRequestId")
|
||||
@ApiOperation({
|
||||
summary: "Submit claim-needed data (expert-initiated IN_PERSON)",
|
||||
})
|
||||
@ApiParam({ name: "claimRequestId", description: "Claim file ID" })
|
||||
@ApiBody({ type: ExpertCompleteClaimDataDto })
|
||||
@ApiResponse({ status: 200, description: "Claim data updated" })
|
||||
// @ApiOperation({
|
||||
// summary: "Submit claim-needed data (expert-initiated IN_PERSON)",
|
||||
// })
|
||||
// @ApiParam({ name: "claimRequestId", description: "Claim file ID" })
|
||||
// @ApiBody({ type: ExpertCompleteClaimDataDto })
|
||||
// @ApiResponse({ status: 200, description: "Claim data updated" })
|
||||
async completeClaimData(
|
||||
@CurrentUser() expert: any,
|
||||
@Param("claimRequestId") claimRequestId: string,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { extname } from "node:path";
|
||||
import { Body, Controller, Get, Param, Post, UploadedFile, UseGuards, UseInterceptors } from "@nestjs/common";
|
||||
import { FileInterceptor } from "@nestjs/platform-express";
|
||||
import { diskStorage } from "multer";
|
||||
import { ApiBearerAuth, ApiBody, ApiConsumes, ApiOperation, ApiParam, ApiTags } from "@nestjs/swagger";
|
||||
import { ApiBearerAuth, ApiBody, ApiConsumes, ApiOperation, ApiParam, ApiTags, ApiExcludeController } from "@nestjs/swagger";
|
||||
import { LocalActorAuthGuard } from "src/auth/guards/actor-local.guard";
|
||||
import { RolesGuard } from "src/auth/guards/role.guard";
|
||||
import { CurrentUser } from "src/decorators/user.decorator";
|
||||
@@ -16,7 +16,8 @@ import { VerifyPartyOtpsDto } from "./dto/verify-party-otps.dto";
|
||||
import { ExpertAccidentFieldsDto } from "./dto/expert-accident-fields.dto";
|
||||
import { PartyRole } from "./entities/schema/partyRole.enum";
|
||||
|
||||
@ApiTags("registrar-initiated-blame (v1)")
|
||||
@ApiExcludeController()
|
||||
// @ApiTags("registrar-initiated-blame (v1)")
|
||||
@Controller("registrar-initiated-blame")
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(LocalActorAuthGuard, RolesGuard)
|
||||
@@ -25,8 +26,8 @@ export class RegistrarInitiatedController {
|
||||
constructor(private readonly requestManagementService: RequestManagementService) {}
|
||||
|
||||
@Post("create")
|
||||
@ApiOperation({ summary: "Registrar creates IN_PERSON blame file" })
|
||||
@ApiBody({ type: CreateRegistrarInitiatedFileDto })
|
||||
// @ApiOperation({ summary: "Registrar creates IN_PERSON blame file" })
|
||||
// @ApiBody({ type: CreateRegistrarInitiatedFileDto })
|
||||
create(@CurrentUser() registrar: any, @Body() dto: CreateRegistrarInitiatedFileDto) {
|
||||
return this.requestManagementService.createRegistrarInitiatedBlame(registrar, dto);
|
||||
}
|
||||
@@ -42,8 +43,8 @@ export class RegistrarInitiatedController {
|
||||
}
|
||||
|
||||
@Post("send-party-otps/:requestId")
|
||||
@ApiParam({ name: "requestId" })
|
||||
@ApiBody({ type: SendPartyOtpsDto })
|
||||
// @ApiParam({ name: "requestId" })
|
||||
// @ApiBody({ type: SendPartyOtpsDto })
|
||||
sendPartyOtps(
|
||||
@CurrentUser() registrar: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@@ -53,8 +54,8 @@ export class RegistrarInitiatedController {
|
||||
}
|
||||
|
||||
@Post("verify-party-otps/:requestId")
|
||||
@ApiParam({ name: "requestId" })
|
||||
@ApiBody({ type: VerifyPartyOtpsDto })
|
||||
// @ApiParam({ name: "requestId" })
|
||||
// @ApiBody({ type: VerifyPartyOtpsDto })
|
||||
verifyPartyOtps(
|
||||
@CurrentUser() registrar: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@@ -73,7 +74,7 @@ export class RegistrarInitiatedController {
|
||||
}
|
||||
|
||||
@Post("upload-video/:requestId")
|
||||
@ApiConsumes("multipart/form-data")
|
||||
// @ApiConsumes("multipart/form-data")
|
||||
@UseInterceptors(
|
||||
FileInterceptor("file", {
|
||||
limits: { fileSize: DEFAULT_MEDIA_MAX_BYTES },
|
||||
@@ -92,7 +93,7 @@ export class RegistrarInitiatedController {
|
||||
}
|
||||
|
||||
@Post("upload-voice/:requestId")
|
||||
@ApiConsumes("multipart/form-data")
|
||||
// @ApiConsumes("multipart/form-data")
|
||||
@UseInterceptors(
|
||||
FileInterceptor("voice", {
|
||||
limits: { fileSize: DEFAULT_MEDIA_MAX_BYTES },
|
||||
@@ -111,7 +112,7 @@ export class RegistrarInitiatedController {
|
||||
}
|
||||
|
||||
@Post("add-accident-fields/:requestId")
|
||||
@ApiBody({ type: ExpertAccidentFieldsDto })
|
||||
// @ApiBody({ type: ExpertAccidentFieldsDto })
|
||||
addAccidentFields(
|
||||
@CurrentUser() registrar: any,
|
||||
@Param("requestId") requestId: string,
|
||||
@@ -125,7 +126,7 @@ export class RegistrarInitiatedController {
|
||||
}
|
||||
|
||||
@Post("upload-party-signature/:requestId")
|
||||
@ApiConsumes("multipart/form-data")
|
||||
// @ApiConsumes("multipart/form-data")
|
||||
@UseInterceptors(
|
||||
FileInterceptor("sign", {
|
||||
limits: { fileSize: DEFAULT_MEDIA_MAX_BYTES },
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
ApiParam,
|
||||
ApiTags,
|
||||
ApiOperation,
|
||||
ApiExcludeController,
|
||||
} from "@nestjs/swagger";
|
||||
import { Request } from "express";
|
||||
import { diskStorage } from "multer";
|
||||
@@ -43,8 +44,9 @@ import {
|
||||
} from "./dto/create-request-management.dto";
|
||||
import { RequestManagementService } from "./request-management.service";
|
||||
|
||||
@ApiExcludeController()
|
||||
@Controller("blame-request-management")
|
||||
@ApiTags("blame-request-management")
|
||||
// @ApiTags("blame-request-management")
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(GlobalGuard, RolesGuard)
|
||||
@Roles(RoleEnum.USER)
|
||||
|
||||
@@ -42,6 +42,7 @@ import { ExpertInitiatedV2Controller } from "./expert-initiated.v2.controller";
|
||||
import { ExpertInitiatedBlameMirrorController } from "./expert-initiated-blame.mirror.controller";
|
||||
import { RegistrarInitiatedController } from "./registrar-initiated.controller";
|
||||
import { RegistrarBlameMirrorController } from "./registrar-blame.mirror.controller";
|
||||
import { ExpertInitiatedBlameV3MirrorController } from "./expert-initiated-blame-v3.mirror.controller";
|
||||
import { InquiryRefreshController } from "./inquiry-refresh.controller";
|
||||
import { InquiryRefreshService } from "./inquiry-refresh.service";
|
||||
|
||||
@@ -77,6 +78,7 @@ import { InquiryRefreshService } from "./inquiry-refresh.service";
|
||||
ExpertInitiatedController,
|
||||
ExpertInitiatedV2Controller,
|
||||
ExpertInitiatedBlameMirrorController,
|
||||
ExpertInitiatedBlameV3MirrorController,
|
||||
RegistrarInitiatedController,
|
||||
RegistrarBlameMirrorController,
|
||||
InquiryRefreshController,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user