Updated application contract flow

This commit is contained in:
rajesh
2025-11-13 16:04:14 +05:30
parent 53a9f2ae05
commit 57fcbf15ce
6 changed files with 100 additions and 101 deletions

View File

@@ -36,26 +36,25 @@ public interface ApplicationContractApi {
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
@PostMapping(value = "/application/{applicationId}", produces = "application/json", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')|| hasRole('ROLE_PRE_INSTRUCTOR')")
@PreAuthorize( "hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_BENEFICIARY') || hasRole('ROLE_CONFIDI')")
ResponseEntity<Response<ApplicationContractResponse>> createApplicationContract(HttpServletRequest request,
@Parameter(description = "Application ID", required = true) @PathVariable("applicationId") Long applicationId, @Parameter(description = "List of files to upload", required = true)
@RequestPart(required = true) List<MultipartFile> contractDocuments,
@Parameter(description = "Application Contract Request Body", required = true) @RequestPart ApplicationContractRequest applicationContractRequest);
@RequestPart(required = true) List<MultipartFile> beneficiaryContractDocuments);
@Operation(summary = "Api to update application contract from beneficiary side",
responses = {
@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
@PutMapping(value = "{applicationContractId}", produces = "application/json", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@PreAuthorize( "hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_BENEFICIARY') || hasRole('ROLE_CONFIDI')")
ResponseEntity<Response<ApplicationContractResponse>> updateApplicationContract(HttpServletRequest request,
@Parameter(description = "Application Contract ID", required = true) @PathVariable("applicationContractId") Long applicationContractId, @Parameter(description = "List of files to upload", required = true)
@RequestPart(required = true) List<MultipartFile> beneficiaryContractDocuments);
// @Operation(summary = "Api to update application contract from beneficiary side",
// responses = {
// @ApiResponse(responseCode = "200", description = "OK"),
// @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
// @ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
// @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
// @ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
// @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
// @ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
// @PutMapping(value = "{applicationContractId}", produces = "application/json", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
// @PreAuthorize( "hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_BENEFICIARY') || hasRole('ROLE_CONFIDI')")
// ResponseEntity<Response<ApplicationContractResponse>> updateApplicationContract(HttpServletRequest request,
// @Parameter(description = "Application Contract ID", required = true) @PathVariable("applicationContractId") Long applicationContractId, @Parameter(description = "List of files to upload", required = true)
// @RequestPart(required = true) List<MultipartFile> beneficiaryContractDocuments);
@Operation(summary = "Api to get an application contract by id",
responses = {

View File

@@ -33,25 +33,25 @@ public class ApplicationContractApiController implements ApplicationContractApi
private ApplicationContractService applicationContractService;
@Override
public ResponseEntity<Response<ApplicationContractResponse>> createApplicationContract(HttpServletRequest request, Long applicationId, List<MultipartFile> contractDocuments, ApplicationContractRequest applicationContractRequest) {
public ResponseEntity<Response<ApplicationContractResponse>> createApplicationContract(HttpServletRequest request, Long applicationId, List<MultipartFile> beneficiaryContractDocuments) {
loggingUtil.logUserAction(
UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.INSERT).actionContext(UserActionContextEnum.CREATE_CONTRACT_FOR_APPLICATION).build());
ApplicationContractResponse applicationContractResponse=applicationContractService.createApplicationContract(request,applicationId,contractDocuments,applicationContractRequest);
ApplicationContractResponse applicationContractResponse=applicationContractService.createApplicationContract(request,applicationId,beneficiaryContractDocuments);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(applicationContractResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.CREATE_APPLICATION_CONTRACT)));
}
@Override
public ResponseEntity<Response<ApplicationContractResponse>> updateApplicationContract(HttpServletRequest request, Long applicationId, List<MultipartFile> beneficiaryContractDocuments) {
loggingUtil.logUserAction(
UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPDATE).actionContext(UserActionContextEnum.UPDATE_APPLICATION_CONTRACT).build());
ApplicationContractResponse applicationContractResponse=applicationContractService.updateApplicationContract(request,applicationId,beneficiaryContractDocuments);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(applicationContractResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.APPLICATION_CONTRACT_UPDATED)));
}
// @Override
// public ResponseEntity<Response<ApplicationContractResponse>> updateApplicationContract(HttpServletRequest request, Long applicationId, List<MultipartFile> beneficiaryContractDocuments) {
// loggingUtil.logUserAction(
// UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPDATE).actionContext(UserActionContextEnum.UPDATE_APPLICATION_CONTRACT).build());
// ApplicationContractResponse applicationContractResponse=applicationContractService.updateApplicationContract(request,applicationId,beneficiaryContractDocuments);
//
// return ResponseEntity.status(HttpStatus.OK)
// .body(new Response<>(applicationContractResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.APPLICATION_CONTRACT_UPDATED)));
// }
@Override
public ResponseEntity<Response<ApplicationContractResponse>> getApplicationContractById(HttpServletRequest request, Long id) {