Skip to content
Snippets Groups Projects
Unverified Commit 6576c1a8 authored by Matej Hrica's avatar Matej Hrica
Browse files

Add getAllUsers() which is GET /api/users

parent dd50cb30
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,21 @@ servers:
default: "${server.port}"
paths:
/api/users/:
get:
tags:
- User
summary: List all system users
description: Get an array of all system users
operationId: getAllUsers
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/UserDto'
put:
tags:
- User
......
......@@ -10,6 +10,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class UserController implements UserApiDelegate {
......@@ -45,4 +47,9 @@ public class UserController implements UserApiDelegate {
public ResponseEntity<LoginResponse> login(LoginDto loginDto) {
return ResponseEntity.ok(userService.login(loginDto));
}
@Override
public ResponseEntity<List<UserDto>> getAllUsers() {
return ResponseEntity.ok(userService.getAllUsers());
}
}
......@@ -7,6 +7,8 @@ import cz.muni.fi.pa165.authorization.server.model.UserDto;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UserService {
......@@ -39,4 +41,8 @@ public class UserService {
public LoginResponse login(LoginDto loginDto) {
return new LoginResponse().token("token-for-" + loginDto.getLogin());
}
public List<UserDto> getAllUsers() {
return List.of(getUserById(1L));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment