diff --git a/restservice/src/main/java/com/plannaplan/controllers/CommisionController.java b/restservice/src/main/java/com/plannaplan/controllers/CommisionController.java index 4819440..bcdc56c 100755 --- a/restservice/src/main/java/com/plannaplan/controllers/CommisionController.java +++ b/restservice/src/main/java/com/plannaplan/controllers/CommisionController.java @@ -6,6 +6,7 @@ import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import java.util.List; @@ -49,7 +50,9 @@ public class CommisionController extends TokenBasedController { @PostMapping("/user") @ApiOperation("Create commision with assignents to given groups. If group doesn't exist error will be thrown") - public ResponseEntity addCommision(@RequestBody List groups) throws UserNotFoundException { + public ResponseEntity addCommision( + @RequestBody @ApiParam(value = "List of groups ids user want to assign to. If group doesnt exisit error will be thrown", example = "[12,7,3]") List groups) + throws UserNotFoundException { User user = this.getCurrentUser().orElseThrow(() -> new NullPointerException()); Commision com = new Commision(user); diff --git a/restservice/src/main/java/com/plannaplan/controllers/ConfigController.java b/restservice/src/main/java/com/plannaplan/controllers/ConfigController.java index cb46e85..58b94e1 100755 --- a/restservice/src/main/java/com/plannaplan/controllers/ConfigController.java +++ b/restservice/src/main/java/com/plannaplan/controllers/ConfigController.java @@ -21,6 +21,7 @@ import org.springframework.web.multipart.MultipartFile; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; @RestController @CrossOrigin @@ -35,7 +36,8 @@ public class ConfigController { @PostMapping("/config") @PreAuthorize("hasRole('ROLE_ADMIN')") @ApiOperation("Imports data to system. To call you need to provide ADMIN token") - public ResponseEntity configApp(@RequestParam("file") MultipartFile file) { + public ResponseEntity configApp( + @RequestParam("file") @ApiParam(value = "file .xlsx that contains courses and groups with apoinnted rules") MultipartFile file) { try { final ConfigData data = new ConfigData(null, null, file.getInputStream()); this.contrl.config(data); diff --git a/restservice/src/main/java/com/plannaplan/controllers/CoursesController.java b/restservice/src/main/java/com/plannaplan/controllers/CoursesController.java index 62c4286..f6ef2c5 100755 --- a/restservice/src/main/java/com/plannaplan/controllers/CoursesController.java +++ b/restservice/src/main/java/com/plannaplan/controllers/CoursesController.java @@ -17,6 +17,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,7 @@ public class CoursesController { @GetMapping("/all") @ApiOperation(value = "Return all courses") public ResponseEntity> getMethodName( - @RequestParam(name = "groups", defaultValue = "false") Boolean groups) { + @RequestParam(name = "groups", defaultValue = "false") @ApiParam(value = "Boolean if you want to have resopnse with associated groups or without") Boolean groups) { List courses = this.courseService.getAllCourses(); if (groups) { final List response = CoursesResponseMappers diff --git a/restservice/src/main/java/com/plannaplan/controllers/GroupController.java b/restservice/src/main/java/com/plannaplan/controllers/GroupController.java index 759a7bf..0e5dca9 100755 --- a/restservice/src/main/java/com/plannaplan/controllers/GroupController.java +++ b/restservice/src/main/java/com/plannaplan/controllers/GroupController.java @@ -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> 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 = this.groupService.getGroupsByCourse(id); if (capacity) { return new ResponseEntity<>(GroupsMappers.mapToGetCourseGroupsWithCapacityResponse(groups), HttpStatus.OK); diff --git a/restservice/src/main/java/com/plannaplan/controllers/TokenController.java b/restservice/src/main/java/com/plannaplan/controllers/TokenController.java index b56966e..a66c9f7 100755 --- a/restservice/src/main/java/com/plannaplan/controllers/TokenController.java +++ b/restservice/src/main/java/com/plannaplan/controllers/TokenController.java @@ -15,6 +15,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 @@ -28,7 +29,8 @@ public class TokenController { @GetMapping("/token") @ApiOperation(value = "Endpoint to access token required to call secured endpoints. In order to access token we need to provide access token comming from unviersity CAS system") - public ResponseEntity getToken(@RequestParam("ticket") final String ticket) { + public ResponseEntity getToken( + @RequestParam("ticket") @ApiParam(value = "Ticket get from CAS system", example = "ST-1376572-wo41gty5R0JCZFKMMie2-cas.amu.edu.pl") final String ticket) { final CasValidator validator = new CasValidator(SERVICE_URL, ticket); try { diff --git a/restservice/src/main/java/com/plannaplan/controllers/UsersController.java b/restservice/src/main/java/com/plannaplan/controllers/UsersController.java index b25671d..51e27ce 100755 --- a/restservice/src/main/java/com/plannaplan/controllers/UsersController.java +++ b/restservice/src/main/java/com/plannaplan/controllers/UsersController.java @@ -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> configApp(@RequestParam("query") String query) { + public ResponseEntity> configApp( + @RequestParam("query") @ApiParam(value = "Query to filter all students. If empty will match everyone") String query) { final List searches = this.userService.searchForStudents(query); final List response = UserResponseMappers.mapToDefaultResponse(searches); return new ResponseEntity<>(response, HttpStatus.OK);