resolved conflicts

This commit is contained in:
rajesh
2024-10-17 16:05:30 +05:30
23 changed files with 174 additions and 28 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

@@ -22,6 +22,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Validated
public interface UserApi {
@@ -219,8 +221,21 @@ public interface UserApi {
ResponseEntity<Response<UserSamlResponse>> validateNewUserToken(HttpServletRequest request,
@Parameter(description = "The spid token", required = true) @PathVariable("token") String token);
@Operation(summary = "Api to get all users",
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)}))})
@RequestMapping(value = "", produces = {"application/json"}, method = RequestMethod.GET)
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
ResponseEntity<Response<List<UserResponseBean>>> getAllUsers(
@Parameter( required = false)@RequestParam(value ="roleId", required = false) Long roleId);
@RequestMapping("favicon.ico")
@ResponseBody
void returnNoFavicon();

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)));
}
}

View File

@@ -22,6 +22,8 @@ import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("${openapi.gepafin.base-path:/v1/user}")
@@ -139,7 +141,14 @@ public class UserApiController implements UserApi {
UserSamlResponse data = userService.validateNewUserToken(request,token);
return ResponseEntity.ok(new Response<>(data, Status.SUCCESS, Translator.toLocale(GepafinConstant.TOKEN_VALIDATE_SUCCESS_MSE)));
}
@Override
public ResponseEntity<Response<List<UserResponseBean>>> getAllUsers(
Long roleId) {
log.info("Get all Users by Role ID - Role ID: {}", roleId);
List<UserResponseBean> users = userService.getAllUsers(roleId);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(users, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_USERS_SUCCESS_MSG)));
}
@Override
public void returnNoFavicon() {