Added v3 of field-expert

This commit is contained in:
SepehrYahyaee
2026-06-22 13:05:11 +03:30
parent 89e715b0c9
commit 8f29bb564c
15 changed files with 2988 additions and 622 deletions

View 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,