Api params

This commit is contained in:
BuildTools
2020-11-04 17:23:29 +01:00
parent 4818905422
commit 6a7fc03e7c
6 changed files with 18 additions and 7 deletions

View File

@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -35,7 +36,8 @@ public class UsersController {
@GetMapping("/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<SearchForStudentsResponse>> configApp(@RequestParam("query") String query) {
public ResponseEntity<List<SearchForStudentsResponse>> configApp(
@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<SearchForStudentsResponse> response = UserResponseMappers.mapToDefaultResponse(searches);
return new ResponseEntity<>(response, HttpStatus.OK);