Skip to content

Commit

Permalink
use primitive boolean at service layer
Browse files Browse the repository at this point in the history
  • Loading branch information
ncovercash committed Jan 24, 2024
1 parent faf421d commit 7c2c8af
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
12 changes: 11 additions & 1 deletion src/main/java/org/folio/list/controller/ListController.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,17 @@ public ResponseEntity<ListSummaryResultsDTO> getAllLists(List<UUID> ids,
// In the backend, the plus sign (+) that is received through RequestParams within the provided timestamp gets substituted with a blank space.
providedTimestamp = !StringUtils.hasText(updatedAsOf) ? null : OffsetDateTime.parse(updatedAsOf.replace(' ', '+'), formatter);
Pageable pageable = new OffsetRequest(offset, size);
return ResponseEntity.ok(listService.getAllLists(pageable, ids, entityTypeIds, active, isPrivate, includeDeleted, providedTimestamp));
return ResponseEntity.ok(
listService.getAllLists(
pageable,
ids,
entityTypeIds,
active,
isPrivate,
Boolean.TRUE.equals(includeDeleted),
providedTimestamp
)
);
}

@Override
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/folio/list/repository/ListRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public interface ListRepository extends CrudRepository<ListEntity, UUID>, Paging
AND (l.isPrivate = false OR l.updatedBy = :currentUserId OR ( l.updatedBy IS NULL AND l.createdBy = :currentUserId))
AND (:isPrivate IS NULL OR l.isPrivate = :isPrivate)
AND (:active IS NULL OR l.isActive = :active)
AND (:includeDeleted IS NULL OR :includeDeleted = true OR l.isDeleted = false)
AND (:includeDeleted = true OR l.isDeleted = false)
AND (TO_TIMESTAMP(CAST(:updatedAsOf AS text), 'YYYY-MM-DD HH24:MI:SS.MS') IS NULL OR
(l.createdDate>= TO_TIMESTAMP(CAST(:updatedAsOf AS text), 'YYYY-MM-DD HH24:MI:SS.MS') OR
l.updatedDate>= TO_TIMESTAMP(CAST(:updatedAsOf AS text), 'YYYY-MM-DD HH24:MI:SS.MS')))
Expand All @@ -41,7 +41,7 @@ SELECT count(*)
AND (l.isPrivate = false OR l.updatedBy = :currentUserId OR ( l.updatedBy IS NULL AND l.createdBy = :currentUserId))
AND (:isPrivate IS NULL OR l.isPrivate = :isPrivate)
AND (:active IS NULL OR l.isActive = :active)
AND (:includeDeleted IS NULL OR :includeDeleted = true OR l.isDeleted = false)
AND (:includeDeleted = true OR l.isDeleted = false)
AND (TO_TIMESTAMP(CAST(:updatedAsOf AS text), 'YYYY-MM-DD HH24:MI:SS.MS') IS NULL OR
(l.createdDate>= TO_TIMESTAMP(CAST(:updatedAsOf AS text), 'YYYY-MM-DD HH24:MI:SS.MS') OR
l.updatedDate>= TO_TIMESTAMP(CAST(:updatedAsOf AS text), 'YYYY-MM-DD HH24:MI:SS.MS')))
Expand All @@ -54,7 +54,7 @@ Page<ListEntity> searchList(
UUID currentUserId,
Boolean active,
Boolean isPrivate,
Boolean includeDeleted,
boolean includeDeleted,
OffsetDateTime updatedAsOf
);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/folio/list/services/ListService.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class ListService {
private final ListVersionMapper listVersionMapper;

public ListSummaryResultsDTO getAllLists(Pageable pageable, List<UUID> ids, List<UUID> entityTypeIds, Boolean active,
Boolean isPrivate, Boolean includeDeleted, OffsetDateTime updatedAsOf) {
Boolean isPrivate, boolean includeDeleted, OffsetDateTime updatedAsOf) {

log.info("Attempting to get all lists");
UUID currentUserId = executionContext.getUserId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void testGetAllListsWithVariableOffsetAndSize() throws Exception {
.queryParam("private", "false");

when(listService.getAllLists(pageable, null,
null, false, false, null, null)).thenReturn(listSummaryResultsDto);
null, false, false, false, null)).thenReturn(listSummaryResultsDto);

mockMvc.perform(requestBuilder)
.andExpect(status().isOk())
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/folio/list/service/ListServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void testGetAllLists() {
List.of(entity1.getEntityTypeId(), entity2.getEntityTypeId()),
true,
false,
null,
false,
null
);
assertThat(actual.getContent()).isEqualTo(expected.getContent());
Expand Down

0 comments on commit 7c2c8af

Please sign in to comment.