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

@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@RestController
@CrossOrigin
@ -35,8 +36,8 @@ public class GroupController {
@GetMapping("/course/{id}")
@ApiOperation(value = "Return list of lectures and classes (if present) given course")
public ResponseEntity<GetCourseGroupsResponse<? extends DefaultGroupResponse>> getCourses(
@PathVariable(name = "id") Long id,
@RequestParam(name = "capacity", defaultValue = "true") Boolean capacity) {
@PathVariable(name = "id") @ApiParam(value = "Id of course") Long id,
@RequestParam(name = "capacity", defaultValue = "true") @ApiParam(value = "Boolean if we want to have capacity field in response") Boolean capacity) {
List<Groups> groups = this.groupService.getGroupsByCourse(id);
if (capacity) {
return new ResponseEntity<>(GroupsMappers.mapToGetCourseGroupsWithCapacityResponse(groups), HttpStatus.OK);