fix: updating foreign keys when adding new entity to the db
All checks were successful
Format / formatting (push) Successful in 7s
Build / build (push) Successful in 31s
CI / build (push) Successful in 11s

This commit is contained in:
Théo Le Lez
2025-03-15 15:23:18 +01:00
parent d5c89bf8f4
commit c94d3654ce
10 changed files with 206 additions and 18 deletions

View File

@ -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);
}
}