Merge branch 'backend-api' of ssh://gitea.piair.dev:2222/piair/MyINPulse into backend-api
This commit is contained in:
@ -37,7 +37,6 @@ public class Entrepreneur extends User {
|
||||
public Entrepreneur() {}
|
||||
|
||||
public Entrepreneur(
|
||||
Long idUser,
|
||||
String userSurname,
|
||||
String username,
|
||||
String primaryMail,
|
||||
@ -46,7 +45,7 @@ public class Entrepreneur extends User {
|
||||
String school,
|
||||
String course,
|
||||
boolean sneeStatus) {
|
||||
super(idUser, userSurname, username, primaryMail, secondaryMail, phoneNumber);
|
||||
super(userSurname, username, primaryMail, secondaryMail, phoneNumber);
|
||||
this.school = school;
|
||||
this.course = course;
|
||||
this.sneeStatus = sneeStatus;
|
||||
|
@ -28,6 +28,8 @@ public class User {
|
||||
|
||||
public User() {}
|
||||
|
||||
// TODO: this should be removed as we shouldn't be able to chose the ID. Leaving it for
|
||||
// compatibility purposes, as soon as it's not used anymore, delete it
|
||||
public User(
|
||||
Long idUser,
|
||||
String userSurname,
|
||||
@ -43,6 +45,19 @@ public class User {
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
public User(
|
||||
String userSurname,
|
||||
String userName,
|
||||
String primaryMail,
|
||||
String secondaryMail,
|
||||
String phoneNumber) {
|
||||
this.userSurname = userSurname;
|
||||
this.userName = userName;
|
||||
this.primaryMail = primaryMail;
|
||||
this.secondaryMail = secondaryMail;
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
public Long getIdUser() {
|
||||
return idUser;
|
||||
}
|
||||
|
@ -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(
|
||||
|
Reference in New Issue
Block a user