fix: updating foreign keys when adding new entity to the db
This commit is contained in:
@ -1,5 +1,8 @@
|
||||
package enseirb.myinpulse.service;
|
||||
|
||||
import com.itextpdf.text.*;
|
||||
import com.itextpdf.text.pdf.PdfWriter;
|
||||
|
||||
import enseirb.myinpulse.model.*;
|
||||
import enseirb.myinpulse.service.database.*;
|
||||
|
||||
@ -10,9 +13,6 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
|
||||
import com.itextpdf.text.*;
|
||||
import com.itextpdf.text.pdf.PdfWriter;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.time.LocalDateTime;
|
||||
@ -92,7 +92,7 @@ public class SharedApiService {
|
||||
HttpStatus.UNAUTHORIZED, "You're not allowed to check this project");
|
||||
}
|
||||
Project project = this.projectService.getProjectById(projectId);
|
||||
return project.getAdministrator();
|
||||
return project.getProjectAdministrator();
|
||||
}
|
||||
|
||||
// TODO
|
||||
@ -221,6 +221,13 @@ public class SharedApiService {
|
||||
HttpStatus.UNAUTHORIZED, "You're not allowed to check this project");
|
||||
}
|
||||
logger.info("User {} tried to create an appointment for project {}", mail, projectId);
|
||||
this.appointmentService.addNewAppointment(appointment);
|
||||
Appointment newAppointment = this.appointmentService.addNewAppointment(appointment);
|
||||
newAppointment
|
||||
.getAppointmentListSectionCell()
|
||||
.forEach(
|
||||
sectionCell -> {
|
||||
sectionCell.updateAppointmentSectionCell(newAppointment);
|
||||
});
|
||||
newAppointment.getAppointmentReport().setAppointmentReport(newAppointment);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user