Added controllers description
This commit is contained in:
parent
ba26d67cd4
commit
b308373062
@ -30,8 +30,8 @@ public class Swagger2Config extends WebMvcConfigurationSupport {
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder().title("xxxxx").description("Swagger2 builds RESTful APIs")
|
||||
.termsOfServiceUrl("http://www.baidu.com/")
|
||||
return new ApiInfoBuilder().title("plannaplan").description("Aplikacja do zapisów na zajęcia UAM.")
|
||||
.termsOfServiceUrl("https://plannaplan.pl/")
|
||||
// .contact("")
|
||||
.version("1.0").build();
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@ -24,6 +26,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping("/api/" + App.API_VERSION + "/assignments")
|
||||
@Api(tags = {
|
||||
"Assignments" }, value = "Assignments", description = "Assignment is representation of student willing to join given group (lecture or calss)")
|
||||
public class AssignmentsController extends TokenBasedController {
|
||||
|
||||
@Autowired
|
||||
|
@ -4,6 +4,8 @@ import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.plannaplan.App;
|
||||
@ -28,6 +30,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping("/api/" + App.API_VERSION + "/commisions")
|
||||
@Api(tags = {
|
||||
"Commisions" }, value = "Commisions", description = "Commision is representation of student selected assignments at time. All assignments are attached to some commision so we can see current assignments and also browse histroy of changes for given user")
|
||||
public class CommisionController extends TokenBasedController {
|
||||
|
||||
@Autowired
|
||||
|
@ -19,10 +19,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping("/api/" + App.API_VERSION + "/configurator")
|
||||
@EnableGlobalMethodSecurity(prePostEnabled = true)
|
||||
@Api(tags = { "ConfigController" }, value = "ConfigController", description = "All endpoints to configure an app")
|
||||
public class ConfigController {
|
||||
|
||||
@Autowired
|
||||
|
@ -14,6 +14,9 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@ -22,16 +25,19 @@ import com.plannaplan.responses.models.abstracts.CoursesResponse;
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping("/api/" + App.API_VERSION + "/courses")
|
||||
@Api(tags = {
|
||||
"Course" }, value = "Course", description = "Endpoints to deal with courses. All courses can have classes, lectures or both.")
|
||||
public class CoursesController {
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<List<? extends CoursesResponse>> getMethodName(@RequestParam(name = "groups", defaultValue = "false") Boolean groups) {
|
||||
public ResponseEntity<List<? extends CoursesResponse>> getMethodName(
|
||||
@RequestParam(name = "groups", defaultValue = "false") Boolean groups) {
|
||||
List<Course> courses = this.courseService.getAllCourses();
|
||||
if (groups) {
|
||||
final List<GetCoursesWithGroupsResponse> response = CoursesResponseMappers
|
||||
.mapToGetCoursesWithGroupsResponse(courses);
|
||||
.mapToGetCoursesWithGroupsResponse(courses);
|
||||
return new ResponseEntity<>(response, HttpStatus.OK);
|
||||
}
|
||||
final List<GetCoursesResponse> response = CoursesResponseMappers.mapToGetCoursesResponse(courses);
|
||||
|
@ -19,17 +19,22 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
|
||||
@RequestMapping("/api/" + App.API_VERSION + "/groups")
|
||||
@Api(tags = {
|
||||
"Group" }, value = "Group", description = "Enpoints to deal with gorups. Group is related directly to course and can be either class and lecture")
|
||||
public class GroupController {
|
||||
@Autowired
|
||||
private GroupService groupService;
|
||||
|
||||
@GetMapping("/course/{id}")
|
||||
|
||||
public ResponseEntity<GetCourseGroupsResponse<? extends DefaultGroupResponse>> getCourses(@PathVariable(name = "id") Long id,
|
||||
|
||||
public ResponseEntity<GetCourseGroupsResponse<? extends DefaultGroupResponse>> getCourses(
|
||||
@PathVariable(name = "id") Long id,
|
||||
@RequestParam(name = "capacity", defaultValue = "true") Boolean capacity) {
|
||||
List<Groups> groups = this.groupService.getGroupsByCourse(id);
|
||||
if (capacity) {
|
||||
|
@ -13,8 +13,11 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@Api(tags = { "Token" }, value = "Token", description = "Enpoints to get authorization.")
|
||||
public class TokenController {
|
||||
|
||||
private final static String SERVICE_URL = "http://localhost:3000";
|
||||
|
@ -15,6 +15,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@ -23,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
@CrossOrigin
|
||||
@RequestMapping("/api/" + App.API_VERSION + "/users")
|
||||
@EnableGlobalMethodSecurity(prePostEnabled = true)
|
||||
@Api(tags = { "Users" }, value = "Users", description = "Endpoints to deal with users.")
|
||||
public class UsersController {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
Loading…
Reference in New Issue
Block a user