API's met returns van objecten
This commit is contained in:
@@ -34,11 +34,12 @@ public class AppointmentService {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void add(Appointment appointment, Long companyId) {
|
||||
public Appointment add(Appointment appointment, Long companyId) {
|
||||
Company company = companyRepository.findById(companyId);
|
||||
appointment.setCompany(company);
|
||||
appointmentRepository.persist(appointment);
|
||||
emailService.stuurBevestiging(appointment);
|
||||
return appointment;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@@ -59,7 +60,7 @@ public class AppointmentService {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void update(Appointment appointment) {
|
||||
public Appointment update(Appointment appointment) {
|
||||
Appointment appointmentToUpdate = appointmentRepository.findById(appointment.getId());
|
||||
appointmentToUpdate.setTitle(appointment.getTitle());
|
||||
appointmentToUpdate.setStartDate(appointment.getStartDate());
|
||||
@@ -72,6 +73,7 @@ public class AppointmentService {
|
||||
appointmentToUpdate.setDurationInMinutes(appointment.getDurationInMinutes());
|
||||
appointmentRepository.persist(appointmentToUpdate);
|
||||
emailService.stuurBewerking(appointmentToUpdate);
|
||||
return appointmentToUpdate;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
||||
Reference in New Issue
Block a user