mirror of
https://github.com/PaulReichmuth/timekeep-backend.git
synced 2025-12-22 14:41:57 +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")
|
||||
public ResponseEntity<@NonNull List<TeamWSTO>> getAllTeams(){
|
||||
|
||||
@@ -43,18 +43,6 @@ public class TeamService {
|
||||
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{
|
||||
checkTeamIsDuplicate(team);
|
||||
teamRepository.save(team);
|
||||
|
||||
Reference in New Issue
Block a user