Merge pull request 'Added empty table' (#21) from ZPI-144 into master

Reviewed-on: http://git.plannaplan.pl/filipizydorczyk/backend/pulls/21
This commit is contained in:
Marcin Woźniak 2020-11-05 16:14:31 +01:00
commit 8ba148617a

View File

@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -38,7 +39,7 @@ public class AssignmentsController extends TokenBasedController {
private AssignmentService assignmentService; private AssignmentService assignmentService;
@GetMapping("/user") @GetMapping("/user")
@ApiOperation(value = "Retrun user current assignemts (from newest commision). STUDENT Token needs to be provided.") @ApiOperation(value = "Return user current assignemts (from newest commision). STUDENT Token needs to be provided.")
public ResponseEntity<List<GetCurrentAssignmentsResponse>> getCurrentAssignments() throws Exception { public ResponseEntity<List<GetCurrentAssignmentsResponse>> getCurrentAssignments() throws Exception {
User user = this.getCurrentUser().orElseThrow(() -> new NullPointerException("User not found")); User user = this.getCurrentUser().orElseThrow(() -> new NullPointerException("User not found"));
Optional<Commision> com = this.commisionService.getNewestCommision(user); Optional<Commision> com = this.commisionService.getNewestCommision(user);
@ -48,6 +49,6 @@ public class AssignmentsController extends TokenBasedController {
return new ResponseEntity<>(AssignmentResponseMappers.mapToResponse(respone), HttpStatus.OK); return new ResponseEntity<>(AssignmentResponseMappers.mapToResponse(respone), HttpStatus.OK);
} }
return new ResponseEntity<>(null, HttpStatus.OK); return new ResponseEntity<>(new ArrayList<>(), HttpStatus.OK);
} }
} }