updated code

This commit is contained in:
harish
2024-10-20 13:30:37 +05:30
parent dffb17bb4c
commit 0f056d237f
8 changed files with 35 additions and 60 deletions

View File

@@ -194,21 +194,6 @@ public interface UserApi {
produces = { "application/json" })
ResponseEntity<Response<UserResponseBean>> getValidUser(HttpServletRequest request);
@Operation(summary = "Api to get user by hubId",
responses = {
@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "404", description = "User not found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE)})),
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE)}))
})
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
@RequestMapping(value = "/hub/{hubId}",
produces = {"application/json"},
method = RequestMethod.GET)
ResponseEntity<Response<List<UserResponseBean>>> getUserByHubId(
@Parameter(description = "The hubId", required = true) @PathVariable("hubId") String hubId);
@Operation(summary = "Api to validate existing user from saml token",
responses = {
@@ -250,7 +235,7 @@ public interface UserApi {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE)}))})
@RequestMapping(value = "", produces = {"application/json"}, method = RequestMethod.GET)
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
ResponseEntity<Response<List<UserResponseBean>>> getAllUsers(
ResponseEntity<Response<List<UserResponseBean>>> getAllUsers(HttpServletRequest request,
@Parameter( required = false)@RequestParam(value ="roleId", required = false) Long roleId);

View File

@@ -128,14 +128,6 @@ public class UserApiController implements UserApi {
}
@Override
public ResponseEntity<Response<List<UserResponseBean>>> getUserByHubId(String hubId) {
log.info("Get User by Hub ID - Hub ID: {}", hubId);
List<UserResponseBean> user = userService.getUserByHubId(hubId);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(user, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_USER_SUCCESS_MSG)));
}
@Override
public ResponseEntity<Response<JWTToken>> validateExistingUserToken(HttpServletRequest request, String token) {
log.info("User login attempt via spid token");
@@ -150,10 +142,10 @@ public class UserApiController implements UserApi {
return ResponseEntity.ok(new Response<>(data, Status.SUCCESS, Translator.toLocale(GepafinConstant.TOKEN_VALIDATE_SUCCESS_MSE)));
}
@Override
public ResponseEntity<Response<List<UserResponseBean>>> getAllUsers(
public ResponseEntity<Response<List<UserResponseBean>>> getAllUsers(HttpServletRequest request,
Long roleId) {
log.info("Get all Users by Role ID - Role ID: {}", roleId);
List<UserResponseBean> users = userService.getAllUsers(roleId);
List<UserResponseBean> users = userService.getAllUsers(request, roleId);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(users, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_USERS_SUCCESS_MSG)));
}