mirror of
https://github.com/PaulReichmuth/timekeep-backend.git
synced 2025-12-22 22:41:59 +00:00
first barebones project structure
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package de.pnreichmuth.timekeep_backend.controllers;
|
||||
|
||||
import de.pnreichmuth.timekeep_backend.entities.Team;
|
||||
import de.pnreichmuth.timekeep_backend.repositories.TeamRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/teams")
|
||||
public class TeamRestController {
|
||||
@Autowired
|
||||
private TeamRepository teamRepository;
|
||||
|
||||
@PostMapping("createTeam")
|
||||
public Team createTeam(){
|
||||
Team team = new Team();
|
||||
teamRepository.save(team);
|
||||
return team;
|
||||
}
|
||||
|
||||
@GetMapping("all")
|
||||
public List<Team> findAllTeams(){
|
||||
return teamRepository.findAll();
|
||||
}
|
||||
|
||||
@DeleteMapping("all")
|
||||
public void deleteAllTeams(){
|
||||
teamRepository.deleteAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user