mirror of
https://github.com/PaulReichmuth/timekeep-backend.git
synced 2025-12-22 22:41:59 +00:00
delete debug endpoint from TeamRestController.java
This commit is contained in:
@@ -35,18 +35,6 @@ public class TeamRestController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("createTeamDebug")
|
|
||||||
public ResponseEntity<@NonNull TeamWSTO> createTeam(){
|
|
||||||
Team team = teamService.createTeam();
|
|
||||||
try {
|
|
||||||
team.setTeamName("DEBUG");
|
|
||||||
teamService.updateTeam(team);
|
|
||||||
return new ResponseEntity<>(TeamWSTO.of(team), HttpStatus.CREATED);
|
|
||||||
} catch (TeamExistsException e) {
|
|
||||||
teamService.deleteTeam(team.getId());
|
|
||||||
return ResponseEntity.of(ProblemDetail.forStatusAndDetail(HttpStatus.CONFLICT,"This team already exists")).build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("all")
|
@GetMapping("all")
|
||||||
public ResponseEntity<@NonNull List<TeamWSTO>> getAllTeams(){
|
public ResponseEntity<@NonNull List<TeamWSTO>> getAllTeams(){
|
||||||
|
|||||||
@@ -43,18 +43,6 @@ public class TeamService {
|
|||||||
return teamRepository.findAll();
|
return teamRepository.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Team createTeam() throws TeamExistsException {
|
|
||||||
Team team = new Team();
|
|
||||||
team.setTeamName(String.format("Team %d", teamRepository.count() + 1));
|
|
||||||
Racer racer = new Racer(null,"Paul", "Reichmuth",false,"0");
|
|
||||||
team.addMember(racer);
|
|
||||||
checkTeamIsDuplicate(team);
|
|
||||||
racerRepository.save(racer);
|
|
||||||
teamRepository.save(team);
|
|
||||||
log.info("Team created: {}", team);
|
|
||||||
return team;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void createTeam(Team team) throws TeamExistsException{
|
public void createTeam(Team team) throws TeamExistsException{
|
||||||
checkTeamIsDuplicate(team);
|
checkTeamIsDuplicate(team);
|
||||||
teamRepository.save(team);
|
teamRepository.save(team);
|
||||||
|
|||||||
Reference in New Issue
Block a user