diff --git a/backend/src/main/java/ch/puzzle/okr/service/business/CompletedBusinessService.java b/backend/src/main/java/ch/puzzle/okr/service/business/CompletedBusinessService.java index 44d16a4981..6b5e65cb1f 100644 --- a/backend/src/main/java/ch/puzzle/okr/service/business/CompletedBusinessService.java +++ b/backend/src/main/java/ch/puzzle/okr/service/business/CompletedBusinessService.java @@ -1,16 +1,15 @@ package ch.puzzle.okr.service.business; +import static org.springframework.http.HttpStatus.NOT_FOUND; + import ch.puzzle.okr.ErrorKey; import ch.puzzle.okr.exception.OkrResponseStatusException; import ch.puzzle.okr.models.Completed; import ch.puzzle.okr.service.persistence.CompletedPersistenceService; import ch.puzzle.okr.service.validation.CompletedValidationService; import jakarta.transaction.Transactional; -import org.springframework.stereotype.Service; - import java.util.List; - -import static org.springframework.http.HttpStatus.NOT_FOUND; +import org.springframework.stereotype.Service; @Service public class CompletedBusinessService { @@ -41,9 +40,12 @@ public void deleteCompletedByObjectiveId(Long objectiveId) { public Completed getCompletedByObjectiveId(Long objectiveId) { validator.validateOnGet(objectiveId); Completed completed = completedPersistenceService.getCompletedByObjectiveId(objectiveId); - // Must exist in business service in order to prevent error while deleting ongoing objectives + // Must exist in business service in order to prevent error while deleting + // ongoing objectives if (completed == null) { - throw new OkrResponseStatusException(NOT_FOUND, ErrorKey.MODEL_WITH_ID_NOT_FOUND, List.of(completedPersistenceService.getModelName(), objectiveId)); + throw new OkrResponseStatusException(NOT_FOUND, + ErrorKey.MODEL_WITH_ID_NOT_FOUND, + List.of(completedPersistenceService.getModelName(), objectiveId)); } return completed; } diff --git a/backend/src/main/java/ch/puzzle/okr/service/persistence/CompletedPersistenceService.java b/backend/src/main/java/ch/puzzle/okr/service/persistence/CompletedPersistenceService.java index 5c59cf6e39..7ee9c0999c 100644 --- a/backend/src/main/java/ch/puzzle/okr/service/persistence/CompletedPersistenceService.java +++ b/backend/src/main/java/ch/puzzle/okr/service/persistence/CompletedPersistenceService.java @@ -19,7 +19,6 @@ public String getModelName() { } public Completed getCompletedByObjectiveId(Long objectiveId) { - return getRepository() - .findByObjectiveId(objectiveId).orElse(null); + return getRepository().findByObjectiveId(objectiveId).orElse(null); } }