Skip to content

Commit

Permalink
Add productName in searchActiveAnnouncements search criteria (#54)
Browse files Browse the repository at this point in the history
* fix: change naming from anncmt products to assignments, adapt controller and tests

* feat: use productName in ActiveAnncmt search

---------

Co-authored-by: Christian Badura <[email protected]>
  • Loading branch information
cbadura and Christian Badura authored Jul 22, 2024
1 parent c9a2b75 commit 44dafcc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ default ActiveAnnouncementsPageResultDTO filterAndSort(ActiveAnnouncementsPageRe
pageResult.setStream(announcementPageResultDTO.getStream().stream()
.filter(announcementAbstractDTO -> announcementAbstractDTO.getWorkspaceName() == null).toList());
}

if (activeAnnouncementsSearchCriteriaDTO.getProductName() != null) {
pageResult.setStream(pageResult.getStream().stream()
.filter(announcementAbstractDTO -> announcementAbstractDTO.getProductName() == null
|| announcementAbstractDTO.getProductName().equals(activeAnnouncementsSearchCriteriaDTO
.getProductName()))
.toList());
} else {
pageResult.setStream(pageResult.getStream().stream()
.filter(announcementAbstractDTO -> announcementAbstractDTO.getProductName() == null).toList());
}
//remove duplicates
HashSet<AnnouncementAbstractDTO> set = new HashSet<>(pageResult.getStream());
pageResult.setStream(sort(set.stream().toList()));
Expand Down
4 changes: 4 additions & 0 deletions src/main/openapi/openapi-bff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,8 @@ components:
$ref: '#/components/schemas/OffsetDateTime'
workspaceName:
type: string
productName:
type: string
pageNumber:
format: int32
description: The number of page.
Expand Down Expand Up @@ -494,6 +496,8 @@ components:
$ref: '#/components/schemas/AnnouncementPriorityType'
workspaceName:
type: string
productName:
type: string
AnnouncementPriorityType:
enum:
- IMPORTANT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ void searchActiveAnnouncements_shouldReturnAnnouncementPageResults() {
// bff call input
ActiveAnnouncementsSearchCriteriaDTO input = new ActiveAnnouncementsSearchCriteriaDTO();
input.setWorkspaceName("w1");
input.setProductName("productName");
input.setCurrentDate(OffsetDateTime.parse("2024-04-24T12:15:50-04:00"));

// bff call
Expand Down

0 comments on commit 44dafcc

Please sign in to comment.