Api operations

This commit is contained in:
BuildTools
2020-11-04 16:58:26 +01:00
parent b308373062
commit 4818905422
7 changed files with 15 additions and 3 deletions

View File

@ -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);