Skip to content

Commit

Permalink
Merge pull request #5 from DiSSCo/bug-fix/include-delete-check
Browse files Browse the repository at this point in the history
Add delete check in query
  • Loading branch information
samleeflang authored Sep 19, 2022
2 parents 86beeca + cebf775 commit d0f6f10
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ public class AnnotationRepository {
private final ObjectMapper mapper;
private final DSLContext context;

public Optional<AnnotationRecord> getAnnotation(JsonNode targetId, JsonNode generator, String motivation) {
public Optional<AnnotationRecord> getAnnotation(JsonNode targetId, JsonNode generator,
String motivation) {
var query = context.select(NEW_ANNOTATION.asterisk())
.distinctOn(NEW_ANNOTATION.ID)
.from(NEW_ANNOTATION)
.where(NEW_ANNOTATION.TARGET_ID.eq(targetId.get("id").asText()))
.and(NEW_ANNOTATION.GENERATOR_ID.eq(generator.get("id").asText()))
.and(NEW_ANNOTATION.MOTIVATION.eq(motivation));
.and(NEW_ANNOTATION.MOTIVATION.eq(motivation))
.and(NEW_ANNOTATION.DELETED.isNull());
if (targetId.get("fieldSet") != null) {
query.and(NEW_ANNOTATION.TARGET_FIELD.eq(targetId.get("fieldSet").asText()));
}
Expand Down

0 comments on commit d0f6f10

Please sign in to comment.