fix: bugfix
All checks were successful
Format / formatting (push) Successful in 5s
Build / build (push) Successful in 27s
CI / build (push) Successful in 11s

This commit is contained in:
Pierre Tellier
2025-03-12 12:08:49 +01:00
parent 64da3c9ab0
commit 653f923693
5 changed files with 60 additions and 17 deletions

View File

@ -108,4 +108,17 @@ public class ProjectService {
public void deleteProjectById(Long id) {
this.projectRepository.deleteById(id);
}
public Project getProjectByName(String name, boolean noerror) {
Optional<Project> project = this.projectRepository.findByProjectName(name);
if (project.isEmpty()) {
if (noerror) logger.error("No project found with name {}", name);
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Ce projet n'existe pas");
}
return project.get();
}
public Project getProjectByName(String name) {
return getProjectByName(name, false);
}
}