Skip to content

Commit 08a3231

Browse files
committed
fix tests by fixing view
1 parent 23c8805 commit 08a3231

31 files changed

+180
-182
lines changed
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package ch.puzzle.okr;
22

3-
import ch.puzzle.okr.models.Deletable;
43
import org.springframework.boot.autoconfigure.SpringBootApplication;
54
import org.springframework.boot.builder.SpringApplicationBuilder;
6-
import org.springframework.data.jpa.domain.Specification;
75
import org.springframework.scheduling.annotation.EnableScheduling;
86

97
@SpringBootApplication
@@ -15,9 +13,4 @@ public static void main(String[] args) {
1513
.initializers(new OkrApplicationContextInitializer()) //
1614
.run(args);
1715
}
18-
19-
public static <E> Specification<E> isNotMarkedAsDeleted() {
20-
return (root, query, criteriaBuilder) ->
21-
criteriaBuilder.isFalse(root.get("isDeleted"));
22-
}
2316
}

backend/src/main/java/ch/puzzle/okr/repository/ActionRepository.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@
44
import java.util.List;
55

66
public interface ActionRepository extends DeleteRepository<Action, Long> {
7-
// @Query("select Action from Action a where ")
8-
// TODO rename this
9-
List<Action> getActionsByKeyResultIdOrderByPriorityAsc(Long keyResultId);
7+
List<Action> getActionsByKeyResultIdAndIsDeletedFalseOrderByPriorityAsc(Long keyResultId);
108
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package ch.puzzle.okr.repository;
22

33
import ch.puzzle.okr.models.checkin.CheckIn;
4-
54
import java.util.List;
65

76
public interface CheckInRepository extends DeleteRepository<CheckIn, Long> {
8-
List<CheckIn> findCheckInsByKeyResultIdOrderByCreatedOnDesc(Long keyResultId);
7+
List<CheckIn> findCheckInsByKeyResultIdAndIsDeletedFalseOrderByCreatedOnDesc(Long keyResultId);
98

10-
CheckIn findFirstByKeyResultIdOrderByCreatedOnDesc(Long keyResultId);
9+
CheckIn findFirstByKeyResultIdAndIsDeletedFalseOrderByCreatedOnDesc(Long keyResultId);
1110
}

backend/src/main/java/ch/puzzle/okr/repository/DeleteRepository.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import ch.puzzle.okr.models.Deletable;
44
import java.util.List;
5-
65
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
76
import org.springframework.data.jpa.repository.Modifying;
87
import org.springframework.data.jpa.repository.Query;

backend/src/main/java/ch/puzzle/okr/repository/KeyResultRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
import java.util.List;
55

66
public interface KeyResultRepository extends DeleteRepository<KeyResult, Long> {
7-
List<KeyResult> findByObjectiveId(Long objectiveId);
7+
List<KeyResult> findByObjectiveIdAndIsDeletedFalse(Long objectiveId);
88
}

backend/src/main/java/ch/puzzle/okr/repository/ObjectiveRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@Repository
1010
public interface ObjectiveRepository extends DeleteRepository<Objective, Long> {
1111

12-
Integer countByTeamAndQuarter(Team team, Quarter quarter);
12+
Integer countByTeamAndQuarterAndIsDeletedFalse(Team team, Quarter quarter);
1313

14-
List<Objective> findObjectivesByTeamId(Long id);
14+
List<Objective> findObjectivesByTeamIdAndIsDeletedFalse(Long id);
1515
}

backend/src/main/java/ch/puzzle/okr/repository/TeamRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55

66
public interface TeamRepository extends DeleteRepository<Team, Long> {
77

8-
List<Team> findTeamsByName(String name);
8+
List<Team> findTeamsByNameAndIsDeletedFalse(String name);
99
}

backend/src/main/java/ch/puzzle/okr/repository/UnitRepository.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
@Repository
99
public interface UnitRepository extends DeleteRepository<Unit, Long> {
1010

11-
Optional<Unit> findUnitByUnitName(String name);
11+
Optional<Unit> findUnitByUnitNameAndIsDeletedFalse(String name);
1212

13-
List<Unit> findAllByCreatedById(Long userId);
13+
List<Unit> findAllByCreatedByIdAndIsDeletedFalse(Long userId);
1414

15-
boolean existsUnitByUnitName(String unitName);
15+
boolean existsUnitByUnitNameAndIsDeletedFalse(String unitName);
1616

17-
boolean existsUnitByUnitNameAndIdNot(String unitName, Long id);
17+
boolean existsUnitByUnitNameAndIsDeletedFalseAndIdNot(String unitName, Long id);
1818
}

backend/src/main/java/ch/puzzle/okr/repository/UserRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import java.util.Optional;
66

77
public interface UserRepository extends DeleteRepository<User, Long> {
8-
Optional<User> findByEmail(String email);
8+
Optional<User> findByEmailAndIsDeletedFalse(String email);
99

10-
List<User> findByOkrChampion(boolean isOkrChampion);
10+
List<User> findByOkrChampionAndIsDeletedFalse(boolean isOkrChampion);
1111
}

backend/src/main/java/ch/puzzle/okr/service/persistence/ActionPersistenceService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ public String getModelName() {
2121
}
2222

2323
public List<Action> getActionsByKeyResultIdOrderByPriorityAsc(Long keyResultId) {
24-
return getRepository().getActionsByKeyResultIdOrderByPriorityAsc(keyResultId);
24+
return getRepository().getActionsByKeyResultIdAndIsDeletedFalseOrderByPriorityAsc(keyResultId);
2525
}
2626
}

0 commit comments

Comments
 (0)