Commit e6e2f1c7 authored by shishir suman's avatar shishir suman
Browse files

bug fixes

Showing with 5 additions and 5 deletions
+5 -5
......@@ -114,7 +114,7 @@ public class UserController {
}
@GetMapping("/info")
public ResponseEntity<User> getUsersById(@RequestParam("id") long id) throws RuntimeException{
public ResponseEntity<UserResponseDto> getUsersById(@RequestParam("id") long id) throws RuntimeException{
return integrationService.getUserById(id);
}
......
package org.upsmf.grievance.service;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.api.gax.rpc.NotFoundException;
import org.springframework.http.ResponseEntity;
import org.upsmf.grievance.dto.CreateUserDto;
import org.upsmf.grievance.dto.UserDto;
import org.upsmf.grievance.dto.UserResponseDto;
import org.upsmf.grievance.model.User;
public interface IntegrationService {
......@@ -21,7 +21,7 @@ public interface IntegrationService {
ResponseEntity<String> searchUsers(JsonNode payload) throws Exception;
ResponseEntity<User> getUserById(long id) throws RuntimeException;
ResponseEntity<UserResponseDto> getUserById(long id) throws RuntimeException;
void assignRole(Long userId, Long roleId) throws NotFoundException;
......
......@@ -289,11 +289,11 @@ public class IntegrationServiceImpl implements IntegrationService {
}
@Override
public ResponseEntity<User> getUserById(long id) throws RuntimeException {
public ResponseEntity<UserResponseDto> getUserById(long id) throws RuntimeException {
Optional<User> user = userRepository.findById(id);
if(user.isPresent()) {
User userDetails = user.get();
return new ResponseEntity<>(userDetails, HttpStatus.OK);
return new ResponseEntity<>(createUserResponse(userDetails), HttpStatus.OK);
}
throw new RuntimeException("User details not found.");
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment