89.1. Test list - pagination. return list (#10)
This commit is contained in:
@ -8,6 +8,7 @@ import net.shyshkin.study.fullstack.supportportal.backend.domain.User;
|
||||
import net.shyshkin.study.fullstack.supportportal.backend.domain.dto.UserDto;
|
||||
import net.shyshkin.study.fullstack.supportportal.backend.service.UserService;
|
||||
import net.shyshkin.study.fullstack.supportportal.backend.utility.JwtTokenProvider;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
@ -79,8 +80,8 @@ public class UserResource {
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public List<User> getAllUsers() {
|
||||
return userService.findAll();
|
||||
public List<User> getAllUsers(Pageable pageable) {
|
||||
return userService.findAll(pageable);
|
||||
}
|
||||
|
||||
@PostMapping("/resetPassword/{email}")
|
||||
|
||||
@ -2,6 +2,7 @@ package net.shyshkin.study.fullstack.supportportal.backend.service;
|
||||
|
||||
import net.shyshkin.study.fullstack.supportportal.backend.domain.User;
|
||||
import net.shyshkin.study.fullstack.supportportal.backend.domain.dto.UserDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@ -12,7 +13,7 @@ public interface UserService extends UserDetailsService {
|
||||
|
||||
User register(String firstName, String lastName, String username, String email);
|
||||
|
||||
List<User> findAll();
|
||||
List<User> findAll(Pageable pageable);
|
||||
|
||||
User findByUsername(String username);
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ import net.shyshkin.study.fullstack.supportportal.backend.repository.UserReposit
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.RequestEntity;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
@ -126,8 +127,8 @@ public class UserServiceImpl implements UserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<User> findAll() {
|
||||
return userRepository.findAll();
|
||||
public List<User> findAll(Pageable pageable) {
|
||||
return userRepository.findAll(pageable).getContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user