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

bug fixes

1 merge request!61Uphrh 7903 mobile otp
Showing with 15 additions and 5 deletions
+15 -5
......@@ -144,10 +144,19 @@ public class UserController {
@PostMapping("/activate")
public ResponseEntity activateUser(@RequestBody JsonNode payload) {
try {
ResponseEntity<?> response = integrationService.activateUser(payload);
ResponseEntity<Response> response = integrationService.activateUser(payload);
if(response.getStatusCode().value() == HttpStatus.OK.value()) {
User user = (User) response.getBody();
return createUserResponse(user);
log.info("activating user - {}", response);
Response responseBody = response.getBody();
log.info("activating user - response body {}", responseBody);
if(responseBody != null
&& responseBody.getBody() != null
&& responseBody.getStatus() == HttpStatus.OK.value()) {
User user = (User)responseBody.getBody();
log.info("activating user - response body | user {}", user);
return createUserResponse(user);
}
}
return response;
} catch (Exception e) {
......
......@@ -7,6 +7,7 @@ import org.upsmf.grievance.dto.CreateUserDto;
import org.upsmf.grievance.dto.UpdateUserDto;
import org.upsmf.grievance.dto.UserResponseDto;
import org.upsmf.grievance.model.User;
import org.upsmf.grievance.model.reponse.Response;
import java.util.List;
import java.util.Optional;
......@@ -28,7 +29,7 @@ public interface IntegrationService {
void assignRole(Long userId, Long roleId) throws NotFoundException;
ResponseEntity<?> activateUser(JsonNode payload) throws Exception;
ResponseEntity<Response> activateUser(JsonNode payload) throws Exception;
User deactivateUser(JsonNode payload) throws Exception;
......
......@@ -835,7 +835,7 @@ public class IntegrationServiceImpl implements IntegrationService {
}
@Override
public ResponseEntity<?> activateUser(JsonNode payload) throws Exception {
public ResponseEntity<Response> activateUser(JsonNode payload) throws Exception {
long id = payload.get("id").asLong(-1);
if (id > 0) {
Optional<User> user = userRepository.findById(id);
......
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