-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23c8805
commit 08a3231
Showing
31 changed files
with
180 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
backend/src/main/java/ch/puzzle/okr/repository/CheckInRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
package ch.puzzle.okr.repository; | ||
|
||
import ch.puzzle.okr.models.checkin.CheckIn; | ||
|
||
import java.util.List; | ||
|
||
public interface CheckInRepository extends DeleteRepository<CheckIn, Long> { | ||
List<CheckIn> findCheckInsByKeyResultIdOrderByCreatedOnDesc(Long keyResultId); | ||
List<CheckIn> findCheckInsByKeyResultIdAndIsDeletedFalseOrderByCreatedOnDesc(Long keyResultId); | ||
|
||
CheckIn findFirstByKeyResultIdOrderByCreatedOnDesc(Long keyResultId); | ||
CheckIn findFirstByKeyResultIdAndIsDeletedFalseOrderByCreatedOnDesc(Long keyResultId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
backend/src/main/java/ch/puzzle/okr/service/persistence/customCrud/SoftDelete.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
package ch.puzzle.okr.service.persistence.customCrud; | ||
|
||
import ch.puzzle.okr.OkrApplication; | ||
import ch.puzzle.okr.models.Deletable; | ||
import ch.puzzle.okr.repository.DeleteRepository; | ||
import ch.puzzle.okr.specifications.DeleteSpecifications; | ||
|
||
public class SoftDelete<T extends Deletable, I, R extends DeleteRepository<T, I>> extends DeleteMethod<T, I, R> { | ||
@Override | ||
public void deleteById(I id) { | ||
repo.markAsDeleted(id); | ||
repo.markAsDeleted(id); | ||
} | ||
|
||
@Override | ||
public Iterable<T> findAll() { | ||
return repo.findAll(OkrApplication.isNotMarkedAsDeleted()); | ||
return repo.findAll(DeleteSpecifications.isNotMarkedAsDeleted()); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
backend/src/main/java/ch/puzzle/okr/specifications/DeleteSpecifications.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package ch.puzzle.okr.specifications; | ||
|
||
import org.springframework.data.jpa.domain.Specification; | ||
|
||
public class DeleteSpecifications { | ||
private DeleteSpecifications() { | ||
} | ||
|
||
public static <E> Specification<E> isNotMarkedAsDeleted() { | ||
return (root, query, criteriaBuilder) -> criteriaBuilder.isFalse(root.get("isDeleted")); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.