Merge branch 'backend-api' of ssh://gitea.piair.dev:2222/piair/MyINPulse into backend-api
All checks were successful
Format / formatting (push) Successful in 6s
Build / build (push) Successful in 38s
CI / build (push) Successful in 10s
Format / formatting (pull_request) Successful in 5s

This commit is contained in:
Théo Le Lez
2025-03-19 12:06:00 +01:00
7 changed files with 131 additions and 14 deletions

View File

@ -105,7 +105,7 @@ public class AdminApiService {
// TODO: check if tests are sufficient - peer verification required
public void addNewProject(Project project) {
project.setIdProject(null);
// We remove it from the request to be sure that it will be auto generated
// We remove the ID from the request to be sure that it will be auto generated
try {
this.projectService.getProjectByName(project.getProjectName(), true);
throw new ResponseStatusException(HttpStatus.CONFLICT, "Project already exists");
@ -115,8 +115,14 @@ public class AdminApiService {
}
}
Project newProject = projectService.addNewProject(project);
newProject.getProjectAdministrator().updateListProject(newProject);
newProject.getEntrepreneurProposed().setProjectProposed(newProject);
if (project.getProjectAdministrator() != null) {
newProject.getProjectAdministrator().updateListProject(newProject);
}
if (newProject.getEntrepreneurProposed() != null) {
Entrepreneur proposed = newProject.getEntrepreneurProposed();
proposed.setProjectProposed(newProject);
proposed.setProjectParticipation(newProject);
}
newProject
.getListEntrepreneurParticipation()
.forEach(