Unify adding staff

Co-authored-by: Denis Natusch <denis.natusch@mailbox.tu-dresden.de>
Co-authored-by: Simon Bruder <simon.bruder@mailbox.tu-dresden.de>
This commit is contained in:
Eren Asker 2023-11-23 16:37:30 +01:00 committed by Denis Natusch
parent 403cc56ae0
commit b4dfa72852
No known key found for this signature in database
GPG key ID: 5E57BD8EDACFA985
2 changed files with 3 additions and 7 deletions

View file

@ -17,16 +17,12 @@ public class StaffManagement {
this.staffRepository = staffRepository; this.staffRepository = staffRepository;
} }
public Staff addStaff(Staff staff) {
return staffRepository.save(staff);
}
public Optional<Staff> findById(Long staffID) { public Optional<Staff> findById(Long staffID) {
return staffRepository.findById(staffID); return staffRepository.findById(staffID);
} }
public void save(Staff staff) { public Staff save(Staff staff) {
staffRepository.save(staff); return staffRepository.save(staff);
} }
public Streamable<Staff> findAll() { public Streamable<Staff> findAll() {

View file

@ -39,7 +39,7 @@ class StaffControllerIntegrationTests {
@BeforeEach @BeforeEach
void setup() throws Exception { void setup() throws Exception {
defaultEmployee = staffManagement.addStaff(new Staff("Dieter Baum", JobType.COOK)); defaultEmployee = staffManagement.save(new Staff("Dieter Baum", JobType.COOK));
defaultEmployeeId = defaultEmployee.getId(); defaultEmployeeId = defaultEmployee.getId();
} }