Beneficiary must be able to Delete Company

This commit is contained in:
nisha
2024-10-16 14:22:31 +05:30
parent edd9c1cb1a
commit 8e73074a88
13 changed files with 85 additions and 20 deletions

View File

@@ -142,5 +142,15 @@ public interface CompanyApi {
@DeleteMapping(value = "{companyId}/delegation", produces = { "application/json" })
ResponseEntity<Response<Void>> deleteCompanyDelegation(HttpServletRequest request,
@Parameter(description = "The company id", required = true) @PathVariable("companyId") Long companyId);
@Operation(summary = "Api to remove a company from user ", 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) })) })
@DeleteMapping(value = "user/{companyId}", produces = { "application/json" })
ResponseEntity<Response<Void>> removeCompanyFromList(HttpServletRequest request,
@Parameter(description = "The company id", required = true) @PathVariable("companyId") Long companyId);
}

View File

@@ -128,4 +128,12 @@ public class CompanyApiController implements CompanyApi{
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.DELEGATION_DELETE_SUCCESS)));
}
@Override
public ResponseEntity<Response<Void>> removeCompanyFromList(HttpServletRequest request, Long companyId) {
log.info("Api to remove a company from user's list");
companyService.removeCompanyFromList(request, companyId);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMPANY_DELETE_SUCCESS_MSG)));
}
}