From 85965c1b504b9aa598c3875b5614382c95ccdfcf Mon Sep 17 00:00:00 2001 From: Adam Loup <124325935+adamloup-enquizit@users.noreply.github.com> Date: Wed, 3 Jul 2024 08:54:34 -0500 Subject: [PATCH] Options API Jurisdictions and Program Areas (#1519) * jurisdiction api * Program Areas --- apps/modernization-ui/src/generated/index.ts | 2 + .../services/JurisdictionOptionsService.ts | 32 +++++++ .../services/ProgramAreaOptionsService.ts | 32 +++++++ ...isdictionOptionAutocompleteController.java | 36 +++++++ .../JurisdictionOptionResolver.java | 27 ++++++ ...ogramAreaOptionAutocompleteController.java | 36 +++++++ .../ProgramAreaOptionResolver.java | 27 ++++++ .../cdc/nbs/option/AutocompleteRequester.java | 33 +++++++ .../jurisdiction/JurisdictionMother.java | 94 ++++++++++++++++++ .../jurisdiction/JurisdictionOptionSteps.java | 19 ++++ .../JurisdictionAutocompleteSteps.java | 35 +++++++ .../program/area/ProgramAreaMother.java | 95 +++++++++++++++++++ .../program/area/ProgramAreaOptionSteps.java | 19 ++++ .../ProgramAreaAutocompleteSteps.java | 35 +++++++ .../jurisdictions/JurisdictionOptions.feature | 37 ++++++++ .../program-areas/ProgramAreaOptions.feature | 37 ++++++++ 16 files changed, 596 insertions(+) create mode 100644 apps/modernization-ui/src/generated/services/JurisdictionOptionsService.ts create mode 100644 apps/modernization-ui/src/generated/services/ProgramAreaOptionsService.ts create mode 100644 libs/options-api/src/main/java/gov/cdc/nbs/option/jurisdictions/autocomplete/JurisdictionOptionAutocompleteController.java create mode 100644 libs/options-api/src/main/java/gov/cdc/nbs/option/jurisdictions/autocomplete/JurisdictionOptionResolver.java create mode 100644 libs/options-api/src/main/java/gov/cdc/nbs/option/program/area/autocomplete/ProgramAreaOptionAutocompleteController.java create mode 100644 libs/options-api/src/main/java/gov/cdc/nbs/option/program/area/autocomplete/ProgramAreaOptionResolver.java create mode 100644 libs/options-api/src/test/java/gov/cdc/nbs/option/AutocompleteRequester.java create mode 100644 libs/options-api/src/test/java/gov/cdc/nbs/option/jurisdiction/JurisdictionMother.java create mode 100644 libs/options-api/src/test/java/gov/cdc/nbs/option/jurisdiction/JurisdictionOptionSteps.java create mode 100644 libs/options-api/src/test/java/gov/cdc/nbs/option/jurisdiction/autocomplete/JurisdictionAutocompleteSteps.java create mode 100644 libs/options-api/src/test/java/gov/cdc/nbs/option/program/area/ProgramAreaMother.java create mode 100644 libs/options-api/src/test/java/gov/cdc/nbs/option/program/area/ProgramAreaOptionSteps.java create mode 100644 libs/options-api/src/test/java/gov/cdc/nbs/option/program/area/autocomplete/ProgramAreaAutocompleteSteps.java create mode 100644 libs/options-api/src/test/resources/features/jurisdictions/JurisdictionOptions.feature create mode 100644 libs/options-api/src/test/resources/features/program-areas/ProgramAreaOptions.feature diff --git a/apps/modernization-ui/src/generated/index.ts b/apps/modernization-ui/src/generated/index.ts index 1f4c4a0f7e..f4a40d9b4c 100644 --- a/apps/modernization-ui/src/generated/index.ts +++ b/apps/modernization-ui/src/generated/index.ts @@ -33,8 +33,10 @@ export { ConditionOptionsService } from './services/ConditionOptionsService'; export { ConfigurationControllerService } from './services/ConfigurationControllerService'; export { EncryptionControllerService } from './services/EncryptionControllerService'; export { FacilityOptionsService } from './services/FacilityOptionsService'; +export { JurisdictionOptionsService } from './services/JurisdictionOptionsService'; export { LoginService } from './services/LoginService'; export { PatientRaceService } from './services/PatientRaceService'; +export { ProgramAreaOptionsService } from './services/ProgramAreaOptionsService'; export { ProviderOptionsService } from './services/ProviderOptionsService'; export { ResultedTestOptionsService } from './services/ResultedTestOptionsService'; export { UserService } from './services/UserService'; diff --git a/apps/modernization-ui/src/generated/services/JurisdictionOptionsService.ts b/apps/modernization-ui/src/generated/services/JurisdictionOptionsService.ts new file mode 100644 index 0000000000..7b945ff559 --- /dev/null +++ b/apps/modernization-ui/src/generated/services/JurisdictionOptionsService.ts @@ -0,0 +1,32 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { Option } from '../models/Option'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; +export class JurisdictionOptionsService { + /** + * NBS Jurisdiction Option Autocomplete + * Provides options from Facilities that have a name matching a criteria. + * @returns Option OK + * @throws ApiError + */ + public static jurisdictionAutocomplete({ + criteria, + limit = 15, + }: { + criteria: string, + limit?: number, + }): CancelablePromise> { + return __request(OpenAPI, { + method: 'GET', + url: '/nbs/api/options/jurisdictions/search', + query: { + 'criteria': criteria, + 'limit': limit, + }, + }); + } +} diff --git a/apps/modernization-ui/src/generated/services/ProgramAreaOptionsService.ts b/apps/modernization-ui/src/generated/services/ProgramAreaOptionsService.ts new file mode 100644 index 0000000000..38f9b33cb9 --- /dev/null +++ b/apps/modernization-ui/src/generated/services/ProgramAreaOptionsService.ts @@ -0,0 +1,32 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { Option } from '../models/Option'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; +export class ProgramAreaOptionsService { + /** + * NBS Program Area Option Autocomplete + * Provides options from Facilities that have a name matching a criteria. + * @returns Option OK + * @throws ApiError + */ + public static programAreaAutocomplete({ + criteria, + limit = 15, + }: { + criteria: string, + limit?: number, + }): CancelablePromise> { + return __request(OpenAPI, { + method: 'GET', + url: '/nbs/api/options/program-areas/search', + query: { + 'criteria': criteria, + 'limit': limit, + }, + }); + } +} diff --git a/libs/options-api/src/main/java/gov/cdc/nbs/option/jurisdictions/autocomplete/JurisdictionOptionAutocompleteController.java b/libs/options-api/src/main/java/gov/cdc/nbs/option/jurisdictions/autocomplete/JurisdictionOptionAutocompleteController.java new file mode 100644 index 0000000000..e6888d6f47 --- /dev/null +++ b/libs/options-api/src/main/java/gov/cdc/nbs/option/jurisdictions/autocomplete/JurisdictionOptionAutocompleteController.java @@ -0,0 +1,36 @@ +package gov.cdc.nbs.option.jurisdictions.autocomplete; + +import gov.cdc.nbs.option.Option; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Collection; + +@RestController +@RequestMapping("nbs/api/options/jurisdictions/search") +class JurisdictionOptionAutocompleteController { + + private final JurisdictionOptionResolver resolver; + + JurisdictionOptionAutocompleteController(final JurisdictionOptionResolver finder) { + this.resolver = finder; + } + + @Operation( + operationId = "jurisdiction-autocomplete", + summary = "NBS Jurisdiction Option Autocomplete", + description = "Provides options from Facilities that have a name matching a criteria.", + tags = "JurisdictionOptions" + ) + @GetMapping + Collection