New endpints tests
This commit is contained in:
@ -40,7 +40,7 @@ public class AssignmentsController extends TokenBasedController {
|
||||
private AssignmentService assignmentService;
|
||||
|
||||
@GetMapping("/user")
|
||||
@ApiOperation(value = "Return 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. This method is depreaceted. Use `/api/v1/commisions/user/schedule` instead.")
|
||||
@Deprecated
|
||||
public ResponseEntity<List<AssignmentResponse>> getCurrentAssignments() throws Exception {
|
||||
User user = this.getCurrentUser().orElseThrow(() -> new NullPointerException("User not found"));
|
||||
|
@ -158,6 +158,11 @@ public class CommisionController extends TokenBasedController {
|
||||
public ResponseEntity<List<AssignmentResponse>> getCurrentAssignmentsDeanery(
|
||||
@PathVariable(name = "id") Long userId) throws Exception {
|
||||
User user = this.userService.getById(userId).orElseThrow(() -> new NullPointerException());
|
||||
|
||||
if (user.getRole() == UserRoles.DEANERY) {
|
||||
return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
Optional<Commision> com = this.commisionService.getNewestCommision(user);
|
||||
|
||||
if (com.isPresent()) {
|
||||
|
Reference in New Issue
Block a user