feat: switched from String to ProjectDecisionValues
All checks were successful
Format / formatting (push) Successful in 6s
Build / build (push) Successful in 30s
CI / build (push) Successful in 15s

This commit is contained in:
Pierre Tellier
2025-03-12 10:21:08 +01:00
parent ef964c4d35
commit e011a5534e
6 changed files with 37 additions and 17 deletions

View File

@ -1,7 +1,10 @@
package enseirb.myinpulse.service.database;
import static enseirb.myinpulse.model.ProjectDecisionValue.PENDING;
import enseirb.myinpulse.model.Administrator;
import enseirb.myinpulse.model.Project;
import enseirb.myinpulse.model.ProjectDecisionValue;
import enseirb.myinpulse.repository.ProjectRepository;
import org.apache.logging.log4j.LogManager;
@ -54,7 +57,7 @@ public class ProjectService {
String projectName,
byte[] logo,
LocalDate creationDate,
String projectStatus,
ProjectDecisionValue projectStatus,
Administrator administrator) {
Optional<Project> project = this.projectRepository.findById(id);
@ -76,11 +79,14 @@ public class ProjectService {
}
if (projectStatus != null) {
// TODO: check if this is really useful
/*
if (!validateStatus(projectStatus)) {
logger.error("updateProjectStatus: Invalid status {}", projectStatus);
throw new ResponseStatusException(
HttpStatus.NOT_ACCEPTABLE, "Ce status n'est pas accepté");
}
*/
project.get().setProjectStatus(projectStatus);
}
@ -96,7 +102,7 @@ public class ProjectService {
}
public Iterable<Project> getPendingProjects() {
return this.projectRepository.findByProjectStatus("PENDING");
return this.projectRepository.findByProjectStatus((long) PENDING.ordinal());
}
public void deleteProjectById(Long id) {