Вновь небольшое продвижение.
This commit is contained in:
parent
53911bccf8
commit
b3f016eca3
@ -22,7 +22,7 @@ function App() {
|
|||||||
{ path: 'levels', element: <AddLevel />, label: 'Обзор уровней', userGroup: "AUTH" },
|
{ path: 'levels', element: <AddLevel />, label: 'Обзор уровней', userGroup: "AUTH" },
|
||||||
{ path: 'nations', element: <AddNation />, label: 'Обзор наций', userGroup: "AUTH" },
|
{ path: 'nations', element: <AddNation />, label: 'Обзор наций', userGroup: "AUTH" },
|
||||||
{ path: 'tanks', element: <AddTank />, label: 'Обзор танков', userGroup: "AUTH"},
|
{ path: 'tanks', element: <AddTank />, label: 'Обзор танков', userGroup: "AUTH"},
|
||||||
{ path: 'clients', element: <AddClient />, label: 'Обзор клиентов', userGroup: "AUTH"},
|
{ path: 'clients', element: <AddClient />, label: 'Обзор клиентов', userGroup: "ADMIN"},
|
||||||
{ path: 'checkPage', element: <PageForChecking />, label: 'Фильтр по танкам', userGroup: "AUTH"}
|
{ path: 'checkPage', element: <PageForChecking />, label: 'Фильтр по танкам', userGroup: "AUTH"}
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -42,13 +42,11 @@ function App() {
|
|||||||
<Route element={<SingupPage />} path="/singup" />
|
<Route element={<SingupPage />} path="/singup" />
|
||||||
<Route element={<PrivateRoutes userGroup="AUTH" />}>
|
<Route element={<PrivateRoutes userGroup="AUTH" />}>
|
||||||
<Route element={<AddTank />} path="/tanks" />
|
<Route element={<AddTank />} path="/tanks" />
|
||||||
|
<Route element={<AddLevel />} path="/levels" />
|
||||||
<Route element={<PageForChecking />} path="/checkPage" />
|
<Route element={<PageForChecking />} path="/checkPage" />
|
||||||
<Route element={<AddNation />} path="/nations" exact />
|
<Route element={<AddNation />} path="/nations" exact />
|
||||||
<Route element={<AddNation />} path="*" />
|
<Route element={<AddNation />} path="*" />
|
||||||
</Route>
|
</Route>
|
||||||
<Route element={<PrivateRoutes userGroup="USER" />}>
|
|
||||||
<Route element={<AddLevel />} path="/levels" />
|
|
||||||
</Route>
|
|
||||||
<Route element={<PrivateRoutes userGroup="ADMIN" />}>
|
<Route element={<PrivateRoutes userGroup="ADMIN" />}>
|
||||||
<Route element={<AddClient />} path="/clients" />
|
<Route element={<AddClient />} path="/clients" />
|
||||||
</Route>
|
</Route>
|
||||||
|
@ -4,6 +4,9 @@ import '../styles/App.css';
|
|||||||
import ClientList from './items/GameClient/ClientList';
|
import ClientList from './items/GameClient/ClientList';
|
||||||
import './AddClient.css';
|
import './AddClient.css';
|
||||||
|
|
||||||
|
const hostURL = "http://localhost:8080";
|
||||||
|
const host = hostURL + "/api/1.0";
|
||||||
|
|
||||||
export default function AddClient() {
|
export default function AddClient() {
|
||||||
const [clientItems, setClientItems] = useState([]);
|
const [clientItems, setClientItems] = useState([]);
|
||||||
|
|
||||||
@ -14,45 +17,41 @@ export default function AddClient() {
|
|||||||
|
|
||||||
const [clientBalance, setClientBalance] = useState();
|
const [clientBalance, setClientBalance] = useState();
|
||||||
|
|
||||||
|
const [pageNumbers, setPageNumbers] = useState([]);
|
||||||
|
|
||||||
|
const [pageNumber, setPageNumber] = useState();
|
||||||
|
|
||||||
//загрузка всех имеющихся уровней при старте
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('Обращение к БД');
|
getUsers(1);
|
||||||
axios.get('http://localhost:8080/api/1.0/client/')
|
}, []);
|
||||||
.then((responce) => {
|
|
||||||
console.log(responce.data);
|
const pageButtonOnClick = function (page) {
|
||||||
setClientItems(responce.data)
|
getUsers(page);
|
||||||
})
|
}
|
||||||
}, [])
|
|
||||||
|
const getTokenForHeader = function () {
|
||||||
|
return "Bearer " + localStorage.getItem("token");
|
||||||
|
}
|
||||||
|
|
||||||
|
//загрузка всех имеющихся клиентов при старте
|
||||||
|
const getUsers = async function (page) {
|
||||||
|
const requestParams = {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Authorization": getTokenForHeader(),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const requestUrl = host + `/users?page=${page}`;
|
||||||
|
const response = await fetch(requestUrl, requestParams);
|
||||||
|
const data = await response.json();
|
||||||
|
setClientItems(data.first.content);
|
||||||
|
setPageNumber(data.first.number);
|
||||||
|
setPageNumbers(data.second);
|
||||||
|
}
|
||||||
|
|
||||||
//обновить список уровней
|
//обновить список уровней
|
||||||
function CheckArray(){
|
function CheckArray(){
|
||||||
console.log('Обращение к БД');
|
getUsers(1);
|
||||||
axios.get('http://localhost:8080/api/1.0/client/')
|
|
||||||
.then((responce) => {
|
|
||||||
console.log(responce.data);
|
|
||||||
setClientItems(responce.data)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//добавление нового уровня
|
|
||||||
function addNewClient(){
|
|
||||||
console.log(clientNickName);
|
|
||||||
console.log(clientEmail);
|
|
||||||
console.log(clientBalance);
|
|
||||||
|
|
||||||
if(clientNickName === ''){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
axios.post('http://localhost:8080/api/1.0/client/?nickName=' + clientNickName + '&email=' + clientEmail + '&balance=' + clientBalance)
|
|
||||||
.then((response) => {
|
|
||||||
CheckArray();
|
|
||||||
setClientNickName('');
|
|
||||||
setClientEmail('');
|
|
||||||
setClientBalance('');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//добавили условную отрисовку
|
//добавили условную отрисовку
|
||||||
@ -87,11 +86,6 @@ export default function AddClient() {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button className='add-level-button'
|
|
||||||
onClick={addNewClient}
|
|
||||||
>
|
|
||||||
Создать клиента
|
|
||||||
</button>
|
|
||||||
<button className='add-level-button'
|
<button className='add-level-button'
|
||||||
onClick={CheckArray}
|
onClick={CheckArray}
|
||||||
>
|
>
|
||||||
|
@ -4,6 +4,9 @@ import '../styles/App.css';
|
|||||||
import NationList from './items/Nation/NationList';
|
import NationList from './items/Nation/NationList';
|
||||||
import './AddNation.css';
|
import './AddNation.css';
|
||||||
|
|
||||||
|
const hostURL = "http://localhost:8080";
|
||||||
|
const host = hostURL + "/api/1.0/nation";
|
||||||
|
|
||||||
//компонент для просмотра, создания и удаления уровней
|
//компонент для просмотра, создания и удаления уровней
|
||||||
const AddNation = () => {
|
const AddNation = () => {
|
||||||
const [nationItems, setNationItems] = useState([]);
|
const [nationItems, setNationItems] = useState([]);
|
||||||
@ -13,27 +16,35 @@ const AddNation = () => {
|
|||||||
|
|
||||||
//загрузка всех имеющихся уровней при старте
|
//загрузка всех имеющихся уровней при старте
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('Обращение к БД');
|
getNations();
|
||||||
axios.get('http://localhost:8080/nation/')
|
|
||||||
.then((responce) => {
|
|
||||||
console.log(responce.data);
|
|
||||||
setNationItems(responce.data)
|
|
||||||
})
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
//обновить список уровней
|
//обновить список уровней
|
||||||
function CheckArray(){
|
function CheckArray(){
|
||||||
console.log('Обращение к БД');
|
getNations();
|
||||||
axios.get('http://localhost:8080/nation/')
|
}
|
||||||
.then((responce) => {
|
|
||||||
console.log(responce.data);
|
const getTokenForHeader = function () {
|
||||||
setNationItems(responce.data)
|
return "Bearer " + localStorage.getItem("token");
|
||||||
})
|
}
|
||||||
|
|
||||||
|
const getNations = async function () {
|
||||||
|
const requestParams = {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Authorization": getTokenForHeader(),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const requestUrl = host + `/getNations`;
|
||||||
|
const response = await fetch(requestUrl, requestParams);
|
||||||
|
const data = await response.json();
|
||||||
|
console.log(data);
|
||||||
|
setNationItems(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//добавление нового уровня
|
//добавление нового уровня
|
||||||
function addNewNation(){
|
function addNewNation(){
|
||||||
if(nation.nation === ''){
|
/*if(nation.nation === ''){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -42,7 +53,7 @@ const AddNation = () => {
|
|||||||
CheckArray();
|
CheckArray();
|
||||||
setNation({nation: ''});
|
setNation({nation: ''});
|
||||||
});
|
});
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//добавили условную отрисовку
|
//добавили условную отрисовку
|
||||||
|
@ -2,6 +2,7 @@ export default class UserSignupDto {
|
|||||||
constructor(args) {
|
constructor(args) {
|
||||||
this.login = args.login;
|
this.login = args.login;
|
||||||
this.email = args.email;
|
this.email = args.email;
|
||||||
|
this.balance = args.balance;
|
||||||
this.password = args.password;
|
this.password = args.password;
|
||||||
this.passwordConfirm = args.passwordConfirm;
|
this.passwordConfirm = args.passwordConfirm;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,9 @@ import './ClientItem.css';
|
|||||||
import ModalClient from './ModalClient';
|
import ModalClient from './ModalClient';
|
||||||
import ModalTankNation from '../Nation/ModalTankNation';
|
import ModalTankNation from '../Nation/ModalTankNation';
|
||||||
|
|
||||||
|
const hostURL = "http://localhost:8080";
|
||||||
|
const host = hostURL + "/api/1.0";
|
||||||
|
|
||||||
const ClientItem = (data) => {
|
const ClientItem = (data) => {
|
||||||
|
|
||||||
const [client, setClient] = useState(null);
|
const [client, setClient] = useState(null);
|
||||||
@ -14,19 +17,29 @@ const ClientItem = (data) => {
|
|||||||
//состояние для вызова окна показа списка танков нации
|
//состояние для вызова окна показа списка танков нации
|
||||||
const[modalNation, setModalNation] = useState(false);
|
const[modalNation, setModalNation] = useState(false);
|
||||||
|
|
||||||
function deleteClient(){
|
const getTokenForHeader = function () {
|
||||||
axios.delete('http://localhost:8080/client/' + data.clientItem.id)
|
return "Bearer " + localStorage.getItem("token");
|
||||||
.then((response) => {
|
}
|
||||||
console.log("Удаление уровня с id " + data.clientItem.id)
|
|
||||||
});
|
const deleteClient = async function (id) {
|
||||||
|
const requestParams = {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"Authorization": getTokenForHeader(),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const requestUrl = host + `/user/${id}`;
|
||||||
|
await fetch(requestUrl, requestParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="client-card">
|
<div className="client-card">
|
||||||
<p className="client-attribute"> id: {data.clientItem.id} </p>
|
<p className="client-attribute"> id: {data.clientItem.id} </p>
|
||||||
<p className="client-attribute"> Никнейм: {data.clientItem.nickName} </p>
|
<p className="client-attribute"> Никнейм: {data.clientItem.login} </p>
|
||||||
<p className="client-attribute"> Баланс: {data.clientItem.balance} </p>
|
<p className="client-attribute"> Баланс: {data.clientItem.balance} </p>
|
||||||
<p className="client-attribute"> Почта: {data.clientItem.email} </p>
|
<p className="client-attribute"> Почта: {data.clientItem.email} </p>
|
||||||
|
<p className="client-attribute"> Роль: {data.clientItem.role} </p>
|
||||||
<div className='client-button-group'>
|
<div className='client-button-group'>
|
||||||
<button className="client-button" type="button"
|
<button className="client-button" type="button"
|
||||||
onClick={() => setModal(true)}
|
onClick={() => setModal(true)}
|
||||||
@ -34,7 +47,7 @@ const ClientItem = (data) => {
|
|||||||
Редактировать
|
Редактировать
|
||||||
</button>
|
</button>
|
||||||
<button className="client-button" type="button"
|
<button className="client-button" type="button"
|
||||||
onClick={deleteClient}
|
onClick={deleteClient(data.clientItem.id)}
|
||||||
>
|
>
|
||||||
Удалить
|
Удалить
|
||||||
</button>
|
</button>
|
||||||
|
@ -6,12 +6,14 @@ import '../../AddClient.css';
|
|||||||
const ModalClient = ({data, visible, setVisible}) => {
|
const ModalClient = ({data, visible, setVisible}) => {
|
||||||
|
|
||||||
//для обновления уровня
|
//для обновления уровня
|
||||||
const [clientNickName, setClientNickName] = useState(data.nickName);
|
const [clientNickName, setClientNickName] = useState(data.login);
|
||||||
|
|
||||||
const [clientEmail, setClientEmail] = useState(data.email);
|
const [clientEmail, setClientEmail] = useState(data.email);
|
||||||
|
|
||||||
const [clientBalance, setClientBalance] = useState(data.balance);
|
const [clientBalance, setClientBalance] = useState(data.balance);
|
||||||
|
|
||||||
|
const [clientPassword, setClientPassword] = useState(data.password);
|
||||||
|
|
||||||
const [clientTank, setClientTank] = useState(null);
|
const [clientTank, setClientTank] = useState(null);
|
||||||
|
|
||||||
const [tankItems, setTankItems] = useState([]);
|
const [tankItems, setTankItems] = useState([]);
|
||||||
@ -35,8 +37,8 @@ const ModalClient = ({data, visible, setVisible}) => {
|
|||||||
|
|
||||||
//добавление нового уровня
|
//добавление нового уровня
|
||||||
function updateLevel(){
|
function updateLevel(){
|
||||||
axios.put('http://localhost:8080/client/' + data.id + '?nickName='
|
axios.put('http://localhost:8080/client/' + data.id + '?login='
|
||||||
+ clientNickName + '&email=' + clientEmail + '&balance=' + clientBalance + '&tankId=' + clientTank)
|
+ clientNickName + '&email=' + clientEmail + '&password=' + clientPassword + + '&balance=' + clientBalance + '&tankId=' + clientTank)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log("Обновление клиента с id " + data.id)
|
console.log("Обновление клиента с id " + data.id)
|
||||||
});
|
});
|
||||||
@ -90,6 +92,14 @@ const ModalClient = ({data, visible, setVisible}) => {
|
|||||||
)}
|
)}
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
|
<p style={{marginTop: "10px"}}>
|
||||||
|
Пароль:
|
||||||
|
<input
|
||||||
|
className="add-client-input"
|
||||||
|
value={clientPassword}
|
||||||
|
onChange={e => setClientPassword(e.target.value)}
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
<button
|
<button
|
||||||
style={{marginTop: "10px"}}
|
style={{marginTop: "10px"}}
|
||||||
className={cl.modalButton}
|
className={cl.modalButton}
|
||||||
|
@ -46,7 +46,7 @@ const LoginPage = function () {
|
|||||||
const result = await response.text();
|
const result = await response.text();
|
||||||
localStorage.setItem("role", result);
|
localStorage.setItem("role", result);
|
||||||
window.dispatchEvent(new Event("storage"));
|
window.dispatchEvent(new Event("storage"));
|
||||||
navigate("/main");
|
navigate("/index");
|
||||||
}
|
}
|
||||||
|
|
||||||
const loginFormOnSubmit = function (event) {
|
const loginFormOnSubmit = function (event) {
|
||||||
|
@ -10,12 +10,12 @@ const PrivateRoutes = (props) => {
|
|||||||
let token = localStorage.getItem("token");
|
let token = localStorage.getItem("token");
|
||||||
if (token) {
|
if (token) {
|
||||||
getRole(token).then((role) => {
|
getRole(token).then((role) => {
|
||||||
if (localStorage.getItem("role") != role) {
|
if (localStorage.getItem("role") !== role) {
|
||||||
localStorage.removeItem("token");
|
localStorage.removeItem("token");
|
||||||
localStorage.removeItem("user");
|
localStorage.removeItem("user");
|
||||||
localStorage.removeItem("role");
|
localStorage.removeItem("role");
|
||||||
window.dispatchEvent(new Event("storage"));
|
window.dispatchEvent(new Event("storage"));
|
||||||
navigate("/main");
|
navigate("/index");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ const SingupPage = function () {
|
|||||||
const emailInput = useRef();
|
const emailInput = useRef();
|
||||||
const passwordInput = useRef();
|
const passwordInput = useRef();
|
||||||
const passwordConfirmInput = useRef();
|
const passwordConfirmInput = useRef();
|
||||||
|
const balanceInput = useRef();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
}, []);
|
}, []);
|
||||||
@ -32,6 +33,7 @@ const SingupPage = function () {
|
|||||||
const userSinginDto = {
|
const userSinginDto = {
|
||||||
login: loginInput.current.value,
|
login: loginInput.current.value,
|
||||||
email: emailInput.current.value,
|
email: emailInput.current.value,
|
||||||
|
balance: balanceInput.current.value,
|
||||||
password: passwordInput.current.value,
|
password: passwordInput.current.value,
|
||||||
passwordConfirm: passwordConfirmInput.current.value
|
passwordConfirm: passwordConfirmInput.current.value
|
||||||
}
|
}
|
||||||
@ -54,6 +56,12 @@ const SingupPage = function () {
|
|||||||
type="text" required
|
type="text" required
|
||||||
ref={emailInput} />
|
ref={emailInput} />
|
||||||
</div>
|
</div>
|
||||||
|
<div className="mb-3">
|
||||||
|
<p className="mb-1">Balance</p>
|
||||||
|
<input className="form-control"
|
||||||
|
type="text" required minlength="3" maxlength="64"
|
||||||
|
ref={balanceInput} />
|
||||||
|
</div>
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<p className="mb-1">Password</p>
|
<p className="mb-1">Password</p>
|
||||||
<input className="form-control"
|
<input className="form-control"
|
||||||
|
@ -14,7 +14,7 @@ public class ClientDTO {
|
|||||||
private String password;
|
private String password;
|
||||||
private String email;
|
private String email;
|
||||||
private Integer balance;
|
private Integer balance;
|
||||||
private List<TankDTO> tanks;
|
private List<TankDTO> tanks = new ArrayList<>();
|
||||||
private UserRole role;
|
private UserRole role;
|
||||||
|
|
||||||
public ClientDTO(){ }
|
public ClientDTO(){ }
|
||||||
|
@ -19,8 +19,6 @@ import java.util.List;
|
|||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@CrossOrigin
|
|
||||||
@RequestMapping("/client")
|
|
||||||
public class GameClientController {
|
public class GameClientController {
|
||||||
public static final String URL_LOGIN = "/jwt/login";
|
public static final String URL_LOGIN = "/jwt/login";
|
||||||
public static final String URL_SING_UP = "/sing_up";
|
public static final String URL_SING_UP = "/sing_up";
|
||||||
@ -52,28 +50,11 @@ public class GameClientController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//аннотация PathVariable связывает значения id из URL и Long id
|
//аннотация PathVariable связывает значения id из URL и Long id
|
||||||
@GetMapping(OpenAPI30Configuration.API_PREFIX + "/{id}")
|
@GetMapping(OpenAPI30Configuration.API_PREFIX + "/")
|
||||||
public ClientDTO getClient(@PathVariable Long id) {
|
public ClientDTO getClient(@PathVariable Long id) {
|
||||||
return new ClientDTO(gameClientService.findClient(id));
|
return new ClientDTO(gameClientService.findClient(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
//с помощью Java Stream преобразуем набор пришедших данных в объекты StudentDto
|
|
||||||
@GetMapping(OpenAPI30Configuration.API_PREFIX + "/")
|
|
||||||
@Secured({UserRole.AsString.ADMIN})
|
|
||||||
public List<ClientDTO> getClients() {
|
|
||||||
return gameClientService.findAllClients().stream()
|
|
||||||
.map(ClientDTO::new)
|
|
||||||
.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping(OpenAPI30Configuration.API_PREFIX + "/")
|
|
||||||
public ClientDTO createClient(@RequestParam("login") String login,
|
|
||||||
@RequestParam("password") String password,
|
|
||||||
@RequestParam("email") String email,
|
|
||||||
@RequestParam("balance") Integer balance) {
|
|
||||||
return new ClientDTO(gameClientService.addClient(login, email, password, balance, password, UserRole.USER));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping(OpenAPI30Configuration.API_PREFIX + "/{id}")
|
@PutMapping(OpenAPI30Configuration.API_PREFIX + "/{id}")
|
||||||
@Secured({UserRole.AsString.USER})
|
@Secured({UserRole.AsString.USER})
|
||||||
public ClientDTO updateClient(@PathVariable Long id,
|
public ClientDTO updateClient(@PathVariable Long id,
|
||||||
@ -85,7 +66,7 @@ public class GameClientController {
|
|||||||
return new ClientDTO(gameClientService.updateClient(id, login, password, email, balance, tankService.findTank(tankId)));
|
return new ClientDTO(gameClientService.updateClient(id, login, password, email, balance, tankService.findTank(tankId)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping(OpenAPI30Configuration.API_PREFIX + "/{id}")
|
@PostMapping(OpenAPI30Configuration.API_PREFIX + "/{id}")
|
||||||
@Secured({UserRole.AsString.USER})
|
@Secured({UserRole.AsString.USER})
|
||||||
public ClientDTO deleteClient(@PathVariable Long id) {
|
public ClientDTO deleteClient(@PathVariable Long id) {
|
||||||
return new ClientDTO(gameClientService.deleteClient(id));
|
return new ClientDTO(gameClientService.deleteClient(id));
|
||||||
@ -93,7 +74,7 @@ public class GameClientController {
|
|||||||
|
|
||||||
@GetMapping(OpenAPI30Configuration.API_PREFIX + "/users")
|
@GetMapping(OpenAPI30Configuration.API_PREFIX + "/users")
|
||||||
@Secured({UserRole.AsString.ADMIN})
|
@Secured({UserRole.AsString.ADMIN})
|
||||||
public Pair<Page<ClientDTO>, List<Integer>> getUsers(@RequestParam(defaultValue = "1") int page,
|
public Pair<Page<ClientDTO>, List<Integer>> getClients(@RequestParam(defaultValue = "1") int page,
|
||||||
@RequestParam(defaultValue = "5") int size) {
|
@RequestParam(defaultValue = "5") int size) {
|
||||||
final Page<ClientDTO> users = gameClientService.findAllPages(page, size)
|
final Page<ClientDTO> users = gameClientService.findAllPages(page, size)
|
||||||
.map(ClientDTO::new);
|
.map(ClientDTO::new);
|
||||||
|
@ -31,7 +31,7 @@ public class NationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//с помощью Java Stream преобразуем набор пришедших данных в объекты StudentDto
|
//с помощью Java Stream преобразуем набор пришедших данных в объекты StudentDto
|
||||||
@GetMapping("/")
|
@GetMapping("/getNations")
|
||||||
public List<FullNationDTO> getNations() {
|
public List<FullNationDTO> getNations() {
|
||||||
return nationService.findAllNations().stream()
|
return nationService.findAllNations().stream()
|
||||||
.map(FullNationDTO::new)
|
.map(FullNationDTO::new)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user