fix : tests
Some checks failed
CI / build (push) Waiting to run
Format / formatting (push) Successful in 5s
Build / build (push) Has been cancelled

This commit is contained in:
Théo Le Lez
2025-04-16 11:26:25 +02:00
parent 6029457735
commit 7df2c768c8
3 changed files with 94 additions and 92 deletions

View File

@ -112,9 +112,17 @@ public class EntrepreneurApiService {
mail,
sectionCellId,
this.sectionCellService.getProjectId(sectionCellId));
SectionCell removedSectionCell = new SectionCell(null, -1L, "", LocalDateTime.now(), null);
removedSectionCell.setIdReference(editSectionCell.getIdReference());
SectionCell removedSectionCell =
new SectionCell(
null,
-1L,
"",
LocalDateTime.now(),
this.projectService.getProjectById(
editSectionCell.getProjectSectionCell().getIdProject()));
sectionCellService.addNewSectionCell(removedSectionCell);
this.sectionCellService.updateSectionCellReferenceId(
removedSectionCell.getIdSectionCell(), editSectionCell.getIdReference());
projectService.updateProjectListSectionCell(
sectionCellService.getProjectId(sectionCellId), removedSectionCell);
// sectionCellService.removeSectionCellById(sectionCellId);
@ -132,19 +140,19 @@ public class EntrepreneurApiService {
HttpStatus.BAD_REQUEST, "La cellule de section fournie n'est pas valide");
}
if (!utilsService.isAllowedToCheckProject(
mail, this.sectionCellService.getProjectId(sectionCell.getIdSectionCell()))) {
mail, sectionCell.getProjectSectionCell().getIdProject())) {
logger.warn(
"User {} tried to add a section cell to the project {} but is not allowed to.",
mail,
this.sectionCellService.getProjectId(sectionCell.getIdSectionCell()));
sectionCell.getProjectSectionCell().getIdProject());
throw new ResponseStatusException(
HttpStatus.UNAUTHORIZED, "You're not allowed to check this project");
}
logger.info(
"User {} added a new section cell {} to the project with id {}",
"User {} added a new section cell {} to the project {}",
mail,
sectionCell.getIdSectionCell(),
this.sectionCellService.getProjectId(sectionCell.getIdSectionCell()));
sectionCell.getProjectSectionCell().getIdProject());
SectionCell newSectionCell =
sectionCellService.addNewSectionCell(
sectionCell); // if here, logger fails cause id is null (not added yet)
@ -173,11 +181,18 @@ public class EntrepreneurApiService {
project.setEntrepreneurProposed((Entrepreneur) this.userService.getUserByEmail(mail));
projectService.addNewProject(project);
project.getProjectAdministrator().updateListProject(project);
project.getEntrepreneurProposed().setProjectProposed(project);
this.entrepreneurService.updateEntrepreneurProjectProposed(
this.userService.getUserByEmail(mail).getIdUser(), project);
project.getListEntrepreneurParticipation()
.forEach(entrepreneur -> entrepreneur.setProjectParticipation(project));
.forEach(
entrepreneur ->
this.entrepreneurService.updateEntrepreneurProjectParticipation(
entrepreneur.getIdUser(), project));
project.getListSectionCell()
.forEach(sectionCell -> sectionCell.setProjectSectionCell(project));
.forEach(
sectionCell ->
this.sectionCellService.updateSectionCellProject(
sectionCell.getIdSectionCell(), project));
}
public void createAccount(Entrepreneur e) {