Api operations
This commit is contained in:
parent
b308373062
commit
4818905422
@ -5,6 +5,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@ -37,6 +38,7 @@ public class AssignmentsController extends TokenBasedController {
|
||||
private AssignmentService assignmentService;
|
||||
|
||||
@GetMapping("/user")
|
||||
@ApiOperation(value = "Retrun user current assignemts (from newest commision). STUDENT Token needs to be provided.")
|
||||
public ResponseEntity<List<GetCurrentAssignmentsResponse>> getCurrentAssignments() throws Exception {
|
||||
User user = this.getCurrentUser().orElseThrow(() -> new NullPointerException("User not found"));
|
||||
Optional<Commision> com = this.commisionService.getNewestCommision(user);
|
||||
|
@ -5,6 +5,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -47,6 +48,7 @@ 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<String> addCommision(@RequestBody List<Long> groups) throws UserNotFoundException {
|
||||
|
||||
User user = this.getCurrentUser().orElseThrow(() -> new NullPointerException());
|
||||
@ -63,6 +65,7 @@ public class CommisionController extends TokenBasedController {
|
||||
}
|
||||
|
||||
@GetMapping("/user")
|
||||
@ApiOperation("Return list of user all commisions (history of schedules)")
|
||||
public ResponseEntity<List<CommisionResponse>> getAlCommisions() throws UserNotFoundException {
|
||||
User user = this.getCurrentUser().orElseThrow(() -> new NullPointerException());
|
||||
List<CommisionResponse> result = CommisionResponseMappers
|
||||
|
@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@ -33,7 +34,7 @@ public class ConfigController {
|
||||
|
||||
@PostMapping("/config")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||
|
||||
@ApiOperation("Imports data to system. To call you need to provide ADMIN token")
|
||||
public ResponseEntity<String> configApp(@RequestParam("file") MultipartFile file) {
|
||||
try {
|
||||
final ConfigData data = new ConfigData(null, null, file.getInputStream());
|
||||
|
@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -32,6 +33,7 @@ public class CoursesController {
|
||||
private CourseService courseService;
|
||||
|
||||
@GetMapping("/all")
|
||||
@ApiOperation(value = "Return all courses")
|
||||
public ResponseEntity<List<? extends CoursesResponse>> getMethodName(
|
||||
@RequestParam(name = "groups", defaultValue = "false") Boolean groups) {
|
||||
List<Course> courses = this.courseService.getAllCourses();
|
||||
|
@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@ -32,7 +33,7 @@ public class GroupController {
|
||||
private GroupService groupService;
|
||||
|
||||
@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) {
|
||||
|
@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@ -26,6 +27,7 @@ public class TokenController {
|
||||
private UserService userService;
|
||||
|
||||
@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<String> getToken(@RequestParam("ticket") final String ticket) {
|
||||
final CasValidator validator = new CasValidator(SERVICE_URL, ticket);
|
||||
|
||||
|
@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -33,7 +34,7 @@ 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) {
|
||||
final List<User> searches = this.userService.searchForStudents(query);
|
||||
final List<SearchForStudentsResponse> response = UserResponseMappers.mapToDefaultResponse(searches);
|
||||
|
Loading…
Reference in New Issue
Block a user