students endpoint
This commit is contained in:
@ -36,10 +36,19 @@ public class UsersController {
|
||||
@GetMapping("/student/search")
|
||||
@PreAuthorize("hasRole('ROLE_DEANERY')")
|
||||
@ApiOperation(value = "Serch for user by providing query. If query is empty it will return all students. You need token with DEANERY role to call this")
|
||||
public ResponseEntity<List<UserResponse>> configApp(
|
||||
public ResponseEntity<List<UserResponse>> searchForStudent(
|
||||
@RequestParam("query") @ApiParam(value = "Query to filter all students. If empty will match everyone") String query) {
|
||||
final List<User> searches = this.userService.searchForStudents(query);
|
||||
final List<UserResponse> response = UserResponseMappers.mapToDefaultResponse(searches);
|
||||
return new ResponseEntity<>(response, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/students")
|
||||
@PreAuthorize("hasRole('ROLE_DEANERY')")
|
||||
@ApiOperation(value = "Gets all students. You need token with DEANERY role to call this")
|
||||
public ResponseEntity<List<UserResponse>> getAllStudents() {
|
||||
final List<User> searches = this.userService.searchForStudents("");
|
||||
final List<UserResponse> response = UserResponseMappers.mapToDefaultResponse(searches);
|
||||
return new ResponseEntity<>(response, HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user