Skip to content

Commit

Permalink
[SELC-5389] Feat: Added subunitCode as onboarding get filter (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
flaminiaScarciofolo authored Aug 8, 2024
1 parent 5b398f9 commit 886c33d
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apps/onboarding-ms/src/main/docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@
"schema" : {
"type" : "string"
}
}, {
"name" : "subunitCode",
"in" : "query",
"schema" : {
"type" : "string"
}
}, {
"name" : "taxCode",
"in" : "query",
Expand Down Expand Up @@ -1868,6 +1874,9 @@
"onboardingId" : {
"type" : "string"
},
"subunitCode" : {
"type" : "string"
},
"taxCode" : {
"type" : "string"
},
Expand Down
6 changes: 6 additions & 0 deletions apps/onboarding-ms/src/main/docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ paths:
in: query
schema:
type: string
- name: subunitCode
in: query
schema:
type: string
- name: taxCode
in: query
schema:
Expand Down Expand Up @@ -1318,6 +1322,8 @@ components:
type: string
onboardingId:
type: string
subunitCode:
type: string
taxCode:
type: string
status:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ public Uni<OnboardingGetResponse> getOnboardingWithFilter(@QueryParam(value = "p
@QueryParam(value = "taxCode") String taxCode,
@QueryParam(value = "institutionId") String institutionId,
@QueryParam(value = "onboardingId") String onboardingId,
@QueryParam(value = "subunitCode") String subunitCode,
@QueryParam(value = "from") String from,
@QueryParam(value = "to") String to,
@QueryParam(value = "status") String status,
Expand All @@ -255,6 +256,7 @@ public Uni<OnboardingGetResponse> getOnboardingWithFilter(@QueryParam(value = "p
.taxCode(taxCode)
.institutionId(institutionId)
.onboardingId(onboardingId)
.subunitCode(subunitCode)
.from(from)
.to(to)
.status(status)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class OnboardingGetFilters {
private String productId;
private String institutionId;
private String onboardingId;
private String subunitCode;
private String taxCode;
private String status;
private String from;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public static Map<String, String> createMapForOnboardingQueryParameter(Onboardin
Map<String, String> queryParameterMap = new HashMap<>();
Optional.ofNullable(filters.getProductId()).ifPresent(value -> queryParameterMap.put(PRODUCT, value));
Optional.ofNullable(filters.getTaxCode()).ifPresent(value -> queryParameterMap.put(INSTITUTION_TAX_CODE, value));
Optional.ofNullable(filters.getSubunitCode()).ifPresent(value -> queryParameterMap.put(INSTITUTION_SUBUNIT_CODE, value));
Optional.ofNullable(filters.getStatus()).ifPresent(value -> queryParameterMap.put(STATUS, value));
Optional.ofNullable(filters.getFrom()).ifPresent(value -> queryParameterMap.put(FROM, value));
Optional.ofNullable(filters.getTo()).ifPresent(value -> queryParameterMap.put(TO, value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ void getOnboarding() {
OnboardingGetFilters filters = OnboardingGetFilters.builder()
.productId("prod-io")
.taxCode("taxCode")
.subunitCode("subunitCode")
.from("2023-12-01")
.to("2023-12-31")
.status("ACTIVE")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,30 @@ void testOnboardingGet() {
subscriber.assertCompleted().assertItem(getResponse);
}

@Test
void testOnboardingGet2() {
int page = 0, size = 3;
Onboarding onboarding = createDummyOnboarding();
mockFindOnboarding(onboarding);
OnboardingGetResponse getResponse = getOnboardingGetResponse(onboarding);
OnboardingGetFilters filters = OnboardingGetFilters.builder()
.productId("prod-io")
.taxCode("taxCode")
.subunitCode("subunitCode")
.from("2023-12-01")
.to("2023-12-31")
.status("ACTIVE")
.page(page)
.size(size)
.build();
UniAssertSubscriber<OnboardingGetResponse> subscriber = onboardingService
.onboardingGet(filters)
.subscribe()
.withSubscriber(UniAssertSubscriber.create());

subscriber.assertCompleted().assertItem(getResponse);
}

private OnboardingGetResponse getOnboardingGetResponse(Onboarding onboarding) {
OnboardingGet onboardingGet = onboardingMapper.toGetResponse(onboarding);
OnboardingGetResponse response = new OnboardingGetResponse();
Expand Down

0 comments on commit 886c33d

Please sign in to comment.