-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatchAssignmentController.java
More file actions
28 lines (23 loc) · 1.09 KB
/
MatchAssignmentController.java
File metadata and controls
28 lines (23 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package cat.udl.eps.softarch.demo.controller;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cat.udl.eps.softarch.demo.api.dto.AssignRefereeRequest;
import cat.udl.eps.softarch.demo.api.dto.AssignRefereeResponse;
import cat.udl.eps.softarch.demo.service.MatchAssignmentService;
import jakarta.validation.Valid;
@Validated
@RestController
public class MatchAssignmentController {
private final MatchAssignmentService matchAssignmentService;
public MatchAssignmentController(MatchAssignmentService matchAssignmentService) {
this.matchAssignmentService = matchAssignmentService;
}
@PostMapping("/match-assignments")
@PreAuthorize("isAuthenticated()")
public AssignRefereeResponse assignReferee(@Valid @RequestBody AssignRefereeRequest request) {
return matchAssignmentService.assignReferee(request.matchId(), request.refereeId());
}
}