Skip to content
Snippets Groups Projects
Commit e6806d8c authored by Annika Geßmann's avatar Annika Geßmann
Browse files

restart PC, saveMethode Controller

parent 53de956c
No related merge requests found
package thinkTogether.groupManagement.controller; package thinkTogether.groupManagement.controller;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import thinkTogether.groupManagement.model.Learninggroup; import thinkTogether.groupManagement.model.Learninggroup;
import thinkTogether.groupManagement.repo.GroupRepository; import thinkTogether.groupManagement.repo.GroupRepository;
import java.time.LocalDate;
import java.util.List; import java.util.List;
...@@ -32,6 +31,15 @@ public class GroupManagementController { ...@@ -32,6 +31,15 @@ public class GroupManagementController {
return groupRepository.findAll(); return groupRepository.findAll();
} }
@PostMapping("/groups/new")
public Learninggroup save(@RequestBody Learninggroup group){
groupRepository.save(group) {
group.setDatum(LocalDate.now());
group.setStatus("open");
}
return group;
}
// /** // /**
......
...@@ -9,6 +9,7 @@ import java.util.List; ...@@ -9,6 +9,7 @@ import java.util.List;
//Erstellt Zwischenspeicher für die Datenentitäten? "DAO"??? //Erstellt Zwischenspeicher für die Datenentitäten? "DAO"???
public interface GroupRepository extends CrudRepository<Learninggroup, Long> { public interface GroupRepository extends CrudRepository<Learninggroup, Long> {
public List<Learninggroup> findAll(); public List<Learninggroup> findAll();
Learninggroup save(Learninggroup group);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment