From 1d382f5efc38378bf2575ae94ebac0aa464ba2c1 Mon Sep 17 00:00:00 2001 From: Remy van der Wereld Date: Tue, 9 Jul 2024 09:52:48 +0200 Subject: [PATCH 1/8] Initial commit --- src/app/state/rest/bagPdok.ts | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/app/state/rest/bagPdok.ts diff --git a/src/app/state/rest/bagPdok.ts b/src/app/state/rest/bagPdok.ts new file mode 100644 index 000000000..45daae5ea --- /dev/null +++ b/src/app/state/rest/bagPdok.ts @@ -0,0 +1,38 @@ +import type { Options } from "." +import { useErrorHandler } from "./hooks/utils/errorHandler" +import useApiRequest from "./hooks/useApiRequest" +import qs from "qs" + +const PDOK_URL = "https://api.pdok.nl/bzk/locatieserver/search/v3_1/free" +// Filters for pdok search api +const MUNICIPALITY_FILTER = "fq=(gemeentenaam:(amsterdam)) " +const ADDRESS_FILTER = "AND (type:adres)" +const ADDRESS_SORT = "straatnaam asc, huisnummer asc, huisletter asc, huisnummertoevoeging asc" +const DEFAULT_SORT = "score desc, weergavenaam asc" +const AREA_CODE_FILTER = "AND (type:postcode)" + +const FIELD_LIST = "weergavenaam,adrestype,gemeentenaam,nummeraanduiding_id,adresseerbaarobject_id,straatnaam,huisnummer,huisletter,huisnummertoevoeging,postcode,woonplaatsnaam,centroide_ll,score" +const START = 0 +const RESULTS_PER_PAGE = 20 + + +export const useBagPdok = (searchString?: string, options?: Options) => { + const handleError = useErrorHandler() + const query = qs.stringify({ + q: searchString, + fq: `${ MUNICIPALITY_FILTER }${ ADDRESS_FILTER }`, + fl: FIELD_LIST, + start: START.toString(), + rows: RESULTS_PER_PAGE.toString(), + sort: DEFAULT_SORT + }, { + addQueryPrefix: true + }) + return useApiRequest({ + url: `${ PDOK_URL }${ query }`, + lazy: searchString === undefined, + ...options, + groupName: "dataPunt", + handleError + }) +} From b232818180f71890afbc8d3b12c8ffd90b0e02a4 Mon Sep 17 00:00:00 2001 From: Remy van der Wereld Date: Tue, 9 Jul 2024 16:53:07 +0200 Subject: [PATCH 2/8] 116361 Changed BAG API --- src/__external__/BAGAddressResponse.d.ts | 24 -------- src/__external__/BAGBenkAggResponse.d.ts | 25 +++++++++ src/__external__/BAGPdokResponse.d.ts | 22 ++++++++ .../addresses/AddressHeader/AddressHeader.tsx | 19 +++---- .../OtherAddressesTable.tsx | 2 +- .../AddressSuffixSwitcher/columns.tsx | 4 +- .../addresses/ObjectDetails/ObjectDetails.tsx | 17 ++---- .../ObjectDetails/hooks/useValues.ts | 20 ++++--- .../addresses/utils/getAddressAsString.ts | 9 --- .../utils/getAddressFromBagPdokResponse.ts | 6 ++ .../utils/getAddressFromBagResults.ts | 5 -- .../utils/getAddressFromBenkAggResponse.ts | 4 ++ src/app/components/addresses/utils/index.ts | 2 + .../cases/CreateForm/CreateForm.tsx | 13 ++--- .../search/SearchResults/SearchResults.tsx | 56 +++++++------------ .../search/SearchResults/columns.tsx | 7 +-- .../AddressHeadingByBagId.tsx | 28 +++------- src/app/state/rest/bagPdok.ts | 10 +--- src/app/state/rest/benkAgg.ts | 18 ++++++ .../useOtherAddresses/useOtherAddresses.ts | 15 +++-- .../usePanoramaByBagId/usePanoramaByBagId.ts | 29 ++++++++-- src/app/state/rest/dataPunt.ts | 52 +---------------- src/app/state/rest/index.ts | 3 +- 23 files changed, 179 insertions(+), 211 deletions(-) delete mode 100644 src/__external__/BAGAddressResponse.d.ts create mode 100644 src/__external__/BAGBenkAggResponse.d.ts create mode 100644 src/__external__/BAGPdokResponse.d.ts delete mode 100644 src/app/components/addresses/utils/getAddressAsString.ts create mode 100644 src/app/components/addresses/utils/getAddressFromBagPdokResponse.ts delete mode 100644 src/app/components/addresses/utils/getAddressFromBagResults.ts create mode 100644 src/app/components/addresses/utils/getAddressFromBenkAggResponse.ts create mode 100644 src/app/components/addresses/utils/index.ts create mode 100644 src/app/state/rest/benkAgg.ts diff --git a/src/__external__/BAGAddressResponse.d.ts b/src/__external__/BAGAddressResponse.d.ts deleted file mode 100644 index 31f6d1dd1..000000000 --- a/src/__external__/BAGAddressResponse.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -declare type BAGAddressResponse = { - results: Array<{ - _links: Array - adres: string - adresseerbaar_object_id: string - bag_huisletter: string - bag_toevoeging: string - centroid: number[] - dataset: string - huisnummer: number - landelijk_id: string - postcode: string - status: string - straatnaam: string - subtype: string - subtype_id: string - toevoeging: string - type: string - type_adres: string - vbo_status: string - woonplaats: string - }> - count: number -} diff --git a/src/__external__/BAGBenkAggResponse.d.ts b/src/__external__/BAGBenkAggResponse.d.ts new file mode 100644 index 000000000..c297d067b --- /dev/null +++ b/src/__external__/BAGBenkAggResponse.d.ts @@ -0,0 +1,25 @@ +declare type BAGBenkAggResponse = { + page: { + number: number + size: number + } + _embedded: { + adresseerbareobjecten: Array + } +} + +declare type BAGBenkAggAddress = { + openbareruimteNaam: string + huisnummer: number + huisletter: string + huisnummertoevoeging: string + postcode: string + verblijfsobjectOppervlakte: number + verblijfsobjectAantalBouwlagen: number + verblijfsobjectAantalKamers: number + typeAdres: string + gebiedenStadsdeelNaam: string + gebruiksdoelOmschrijvingen: Array + toegangOmschrijvingen: Array + wozSoortObjectOmschrijving: Array +} diff --git a/src/__external__/BAGPdokResponse.d.ts b/src/__external__/BAGPdokResponse.d.ts new file mode 100644 index 000000000..baec6e37e --- /dev/null +++ b/src/__external__/BAGPdokResponse.d.ts @@ -0,0 +1,22 @@ +declare type BAGPdokResponse = { + response: { + numFound: number + docs: Array + } +} + +declare type BAGPdokAddress = { + woonplaatsnaam: string + weergavenaam: string + adrestype: string + gemeentenaam: string + postcode: string + centroide_ll: string + nummeraanduiding_id: string + adresseerbaarobject_id: string + straatnaam: string + huisnummer: integer + huisletter: string + huisnummertoevoeging: string + score: float +} diff --git a/src/app/components/addresses/AddressHeader/AddressHeader.tsx b/src/app/components/addresses/AddressHeader/AddressHeader.tsx index e47ca567a..1199cf0e9 100644 --- a/src/app/components/addresses/AddressHeader/AddressHeader.tsx +++ b/src/app/components/addresses/AddressHeader/AddressHeader.tsx @@ -1,11 +1,12 @@ import styled from "styled-components" import { breakpoint, themeSpacing, Typography } from "@amsterdam/asc-ui" +import { SmallSkeleton } from "@amsterdam/wonen-ui" -import { useBAG } from "app/state/rest" +import { useBagPdok } from "app/state/rest" import ShowOtherAddressesButton, { Index } from "app/components/addresses/AddressSuffixSwitcher/ShowOtherAddressesButton" import useOtherAddressesByBagId from "app/state/rest/custom/useOtherAddresses/useOtherAddresses" import AddressLink from "./components/AddressLink" -import getAddressFromBagResults from "app/components/addresses/utils/getAddressFromBagResults" +import { getAddressFromBagPdokResponse } from "app/components/addresses/utils" type Props = { bagId: Components.Schemas.Address["bag_id"] @@ -28,14 +29,11 @@ const ButtonWrap = styled.div` ` const AddressHeader: React.FC = ({ bagId, headingSize = "h2", isHeader = false, enableSwitch = true }) => { - const [data] = useBAG(bagId) - const foundAddress = getAddressFromBagResults(data) - const title = foundAddress?.adres ? `${ foundAddress.adres }, ${ foundAddress.postcode }` : undefined - const showTitle = title !== undefined - + const [data, { isBusy }] = useBagPdok(bagId) + const foundAddress = getAddressFromBagPdokResponse(data) const [filteredAddresses] = useOtherAddressesByBagId(bagId) const showButton = enableSwitch && (filteredAddresses?.length ?? 0) > 1 - const isCurrentAddress = (address: { adres: string }) => address.adres.trim() === foundAddress?.adres.trim() + const isCurrentAddress = (address: BAGPdokAddress ) => address.weergavenaam === foundAddress?.weergavenaam const addressIndex = filteredAddresses?.findIndex(isCurrentAddress) ?? -1 let index: Index = undefined if (addressIndex === 0) { @@ -44,10 +42,11 @@ const AddressHeader: React.FC = ({ bagId, headingSize = "h2", isHeader = index = "last" } - // TODO: Show loading status visually + const title = foundAddress?.weergavenaam return (
- { showTitle && } + { isBusy && } + { title && } { showButton && ( diff --git a/src/app/components/addresses/AddressSuffixSwitcher/OtherAddressesTable.tsx b/src/app/components/addresses/AddressSuffixSwitcher/OtherAddressesTable.tsx index 6b8dc08e2..d12ae7ed6 100644 --- a/src/app/components/addresses/AddressSuffixSwitcher/OtherAddressesTable.tsx +++ b/src/app/components/addresses/AddressSuffixSwitcher/OtherAddressesTable.tsx @@ -14,7 +14,7 @@ const OtherAddressesTable: React.FC = ({ bagId, onAddressChosen }) => { const onClickRow = (data: any) => { onAddressChosen() - navigateTo("/adres/:bagId", { bagId: data.adresseerbaar_object_id }) + navigateTo("/adres/:bagId", { bagId: data.adresseerbaarobject_id }) } return ( diff --git a/src/app/components/addresses/AddressSuffixSwitcher/columns.tsx b/src/app/components/addresses/AddressSuffixSwitcher/columns.tsx index 9ede5d12c..7a6926063 100644 --- a/src/app/components/addresses/AddressSuffixSwitcher/columns.tsx +++ b/src/app/components/addresses/AddressSuffixSwitcher/columns.tsx @@ -4,10 +4,10 @@ import to from "app/routing/utils/to" const columns = [ { header: "Adres", - dataIndex: "adres", + dataIndex: "weergavenaam", minWidth: 300 }, { - dataIndex: "adresseerbaar_object_id", + dataIndex: "adresseerbaarobject_id", minWidth: 100, render: (bagId: any) => ( diff --git a/src/app/components/addresses/ObjectDetails/ObjectDetails.tsx b/src/app/components/addresses/ObjectDetails/ObjectDetails.tsx index c2c8267f3..530de55f3 100644 --- a/src/app/components/addresses/ObjectDetails/ObjectDetails.tsx +++ b/src/app/components/addresses/ObjectDetails/ObjectDetails.tsx @@ -1,6 +1,6 @@ -import { useBAG, useBAGLodging } from "app/state/rest" +import { useBenkAgg } from "app/state/rest" import { DefinitionList } from "@amsterdam/wonen-ui" -import getAddressFromBagResults from "app/components/addresses/utils/getAddressFromBagResults" +import { getAddressFromBenkAggResponse } from "app/components/addresses/utils" import useValues from "./hooks/useValues" type Props = { @@ -8,16 +8,9 @@ type Props = { } const ObjectDetails: React.FC = ({ bagId }) => { - - const [BAGAddressResponse, { isBusy: isBusyAddress }] = useBAG(bagId) - const BAGAddress = getAddressFromBagResults(BAGAddressResponse) - - - const { type, subtype_id } = BAGAddress ?? {} - const [BAGObject, { isBusy: isBusyObject }] = useBAGLodging(type, subtype_id) - - const isBusy = isBusyAddress || isBusyObject - const values = useValues(BAGAddress, BAGObject) + const [benkAggResponse, { isBusy }] = useBenkAgg(bagId) + const benkAggAddress = getAddressFromBenkAggResponse(benkAggResponse) + const values = useValues(benkAggAddress) return ( { - - if (BAGAddress === undefined || BAGObjectResponse === undefined) return +export default (benkAggAddress?: BAGBenkAggAddress) => { + if (!benkAggAddress) return + + const { + gebruiksdoelOmschrijvingen, verblijfsobjectOppervlakte, verblijfsobjectAantalBouwlagen, + toegangOmschrijvingen, verblijfsobjectAantalKamers + } = benkAggAddress const values = [ - ["Bestemming", BAGAddress?.type ?? "-"], - ["Oppervlakte", BAGObjectResponse.oppervlakte ? `${ BAGObjectResponse.oppervlakte }m²` : "-"], - ["Bouwlagen", BAGObjectResponse.bouwlagen], - ["Aantal kamers", BAGObjectResponse.aantal_kamers] + ["Gebruiksdoel", gebruiksdoelOmschrijvingen ? gebruiksdoelOmschrijvingen.join(", ") : undefined], + ["Oppervlakte", verblijfsobjectOppervlakte ? `${ verblijfsobjectOppervlakte }m²` : undefined], + ["Bouwlagen", verblijfsobjectAantalBouwlagen], + ["Toegang", toegangOmschrijvingen ? toegangOmschrijvingen.join(", ") : undefined], + ["Aantal kamers", verblijfsobjectAantalKamers ] ] + return Object.fromEntries(values) } \ No newline at end of file diff --git a/src/app/components/addresses/utils/getAddressAsString.ts b/src/app/components/addresses/utils/getAddressAsString.ts deleted file mode 100644 index 4a5974b19..000000000 --- a/src/app/components/addresses/utils/getAddressAsString.ts +++ /dev/null @@ -1,9 +0,0 @@ -const getAddressAsString = (address?: BAGAddressResponse["results"][number]) => { - if (!address) return - const { straatnaam, huisnummer, bag_huisletter, bag_toevoeging } = address - return ( - `${ straatnaam } ${ huisnummer }${ bag_huisletter ?? "" }${ bag_toevoeging ? `-${ bag_toevoeging }` : "" }` - ) -} - -export default getAddressAsString diff --git a/src/app/components/addresses/utils/getAddressFromBagPdokResponse.ts b/src/app/components/addresses/utils/getAddressFromBagPdokResponse.ts new file mode 100644 index 000000000..4457d6041 --- /dev/null +++ b/src/app/components/addresses/utils/getAddressFromBagPdokResponse.ts @@ -0,0 +1,6 @@ +export const getAddressFromBagPdokResponse = (data?: BAGPdokResponse): BAGPdokAddress | undefined => { + const docs = data?.response?.docs + return ( + docs?.find((result) => result.adrestype === "hoofdadres") + ) +} diff --git a/src/app/components/addresses/utils/getAddressFromBagResults.ts b/src/app/components/addresses/utils/getAddressFromBagResults.ts deleted file mode 100644 index 619cc0dff..000000000 --- a/src/app/components/addresses/utils/getAddressFromBagResults.ts +++ /dev/null @@ -1,5 +0,0 @@ -const getAddressFromBagResults = (data?: BAGAddressResponse): BAGAddressResponse["results"][number] | undefined => ( - data?.results?.find((result) => result.type_adres === "Hoofdadres") -) - -export default getAddressFromBagResults diff --git a/src/app/components/addresses/utils/getAddressFromBenkAggResponse.ts b/src/app/components/addresses/utils/getAddressFromBenkAggResponse.ts new file mode 100644 index 000000000..e61986379 --- /dev/null +++ b/src/app/components/addresses/utils/getAddressFromBenkAggResponse.ts @@ -0,0 +1,4 @@ +export const getAddressFromBenkAggResponse = (data?: BAGBenkAggResponse): BAGBenkAggAddress | undefined => { + const adresseerbareobjecten = data?._embedded?.adresseerbareobjecten ?? [] + return adresseerbareobjecten?.length > 0 ? adresseerbareobjecten[0] : undefined +} diff --git a/src/app/components/addresses/utils/index.ts b/src/app/components/addresses/utils/index.ts new file mode 100644 index 000000000..4487bc7d8 --- /dev/null +++ b/src/app/components/addresses/utils/index.ts @@ -0,0 +1,2 @@ +export * from "./getAddressFromBagPdokResponse" +export * from "./getAddressFromBenkAggResponse" diff --git a/src/app/components/cases/CreateForm/CreateForm.tsx b/src/app/components/cases/CreateForm/CreateForm.tsx index 77961748b..5a189a1ee 100644 --- a/src/app/components/cases/CreateForm/CreateForm.tsx +++ b/src/app/components/cases/CreateForm/CreateForm.tsx @@ -2,13 +2,12 @@ import { useState, useEffect } from "react" import scaffold from "./scaffold" import { useCaseThemes, useReasons, useCaseCreate, useProjects, - useListing, useSubjects, useCasesByBagId, useCorporations, useBAG + useListing, useSubjects, useCasesByBagId, useCorporations, useBagPdok } from "app/state/rest" import ConfirmScaffoldForm from "app/components/shared/ConfirmScaffoldForm/ConfirmScaffoldForm" import useNavigateWithFlashMessage from "app/state/flashMessages/useNavigateWithFlashMessage" import useScaffoldedFields from "app/components/shared/ConfirmScaffoldForm/hooks/useScaffoldedFields" -import getAddressAsString from "app/components/addresses/utils/getAddressAsString" -import getAddressFromBagResults from "app/components/addresses/utils/getAddressFromBagResults" +import { getAddressFromBagPdokResponse } from "app/components/addresses/utils" import useNavigation from "app/routing/useNavigation" @@ -65,8 +64,8 @@ const CreateForm: React.FC = ({ bagId, tonId }) => { const [listing] = useListing(tonId) const [cases] = useCasesByBagId(bagId) const [corporations] = useCorporations() - const [bagAddressResponse] = useBAG(bagId) - const bagAddress = getAddressFromBagResults(bagAddressResponse) + const [bagAddressResponse] = useBagPdok(bagId) + const bagAddress = getAddressFromBagPdokResponse(bagAddressResponse) const { navigateTo } = useNavigation() @@ -140,9 +139,7 @@ const CreateForm: React.FC = ({ bagId, tonId }) => { } : {} } - const addressString = getAddressAsString(bagAddress) - const title = `${ addressString } - Controleer de gegevens` - + const title = `${ bagAddress?.weergavenaam } - Controleer de gegevens` return ( - type Props = { searchString: string } -const REGEX_ZIP_CODE = /^[1-9][0-9]{3} ?(?!sa|sd|ss)[a-z]{2}/i - const MIN_SEARCH_LENGTH = 3 const isValidSearchString = (s: string) => s.length >= MIN_SEARCH_LENGTH const SearchResults: React.FC = ({ searchString }) => { - const isValid = isValidSearchString(searchString) - const isZipCode = isValid && REGEX_ZIP_CODE.test(searchString) - const searchStringZipcode = isZipCode ? searchString : undefined - const searchStringStreet = isValid && !REGEX_ZIP_CODE.test(searchString) ? searchString : undefined - const [dataZipCode, { isBusy: isBusyZipCode }] = useBAGWithZipCode(searchStringZipcode) - const [dataStreet, { isBusy: isBusyStreet }] = useBAGWithStreet(searchStringStreet) const { navigateTo } = useNavigation() - + const isValid = isValidSearchString(searchString) + const searchStringBagPdok = isValid ? searchString : undefined + const [bagData, { isBusy: loading }] = useBagPdok(searchStringBagPdok) + const onClickRow = (data: any) => { - navigateTo("/adres/:bagId", { bagId: data.adresseerbaar_object_id }) + navigateTo("/adres/:bagId", { bagId: data.adresseerbaarobject_id }) } - const loading = isBusyZipCode || isBusyStreet - const data = isZipCode ? dataZipCode : dataStreet // Only show addresses with a bagId - const dataSource = data?.results?.filter((obj) => obj.adresseerbaar_object_id) || [] + const dataSource = bagData?.response?.docs?.filter((obj) => obj.adresseerbaarobject_id) || [] return ( - <> - { data && data?.count > 100 && ( - - Er zijn meer dan 100 resultaten voor deze zoekopdracht. Specificeer je zoekterm. - - )} - { isValid ? ( - - ) : null - } - + isValid ? ( +
+ ) : null ) } diff --git a/src/app/components/search/SearchResults/columns.tsx b/src/app/components/search/SearchResults/columns.tsx index 7a4d42efa..99a0f32d1 100644 --- a/src/app/components/search/SearchResults/columns.tsx +++ b/src/app/components/search/SearchResults/columns.tsx @@ -4,15 +4,14 @@ import to from "app/routing/utils/to" const columns = [ { header: "Adres", - dataIndex: "adres", + dataIndex: "weergavenaam", minWidth: 100, render: (adres: any, obj: any) => ( - `${ adres } ${ obj.type_adres === "Nevenadres" ? "(Nevenadres)" : "" }` + `${ adres } ${ obj.adrestype === "nevenadres" ? "(Nevenadres)" : "" }` ) }, - { header: "Postcode", dataIndex: "postcode", minWidth: 100 }, { - dataIndex: "adresseerbaar_object_id", + dataIndex: "adresseerbaarobject_id", minWidth: 140, render: (bagId: any) => ( diff --git a/src/app/components/shared/AddressHeadingByBagId/AddressHeadingByBagId.tsx b/src/app/components/shared/AddressHeadingByBagId/AddressHeadingByBagId.tsx index dc2183f7b..6b45d5644 100644 --- a/src/app/components/shared/AddressHeadingByBagId/AddressHeadingByBagId.tsx +++ b/src/app/components/shared/AddressHeadingByBagId/AddressHeadingByBagId.tsx @@ -1,32 +1,18 @@ -import styled from "styled-components" -import { Heading, themeSpacing } from "@amsterdam/asc-ui" -import { useBAG } from "app/state/rest" -import AddressDisplay from "app/components/addresses/AddressDisplay/AddressDisplay" -import getAddressFromBagResults from "app/components/addresses/utils/getAddressFromBagResults" +import { Heading } from "@amsterdam/asc-ui" +import { useBagPdok } from "app/state/rest" +import { getAddressFromBagPdokResponse } from "app/components/addresses/utils" type Props = { bagId: Components.Schemas.Address["bag_id"] } -const Div = styled.div` - margin-bottom: ${ themeSpacing(8) } -` - const AddressHeadingByBagId: React.FC = ({ bagId }) => { - const [data] = useBAG(bagId) - const address = getAddressFromBagResults(data) + const [data] = useBagPdok(bagId) + const address = getAddressFromBagPdokResponse(data) return ( - <> - Adres - { address && ( -
-

-

{ address.postcode } { address.woonplaats }

-
- )} - + { address?.weergavenaam } ) } -export default AddressHeadingByBagId \ No newline at end of file +export default AddressHeadingByBagId diff --git a/src/app/state/rest/bagPdok.ts b/src/app/state/rest/bagPdok.ts index 45daae5ea..eb32996d7 100644 --- a/src/app/state/rest/bagPdok.ts +++ b/src/app/state/rest/bagPdok.ts @@ -4,17 +4,13 @@ import useApiRequest from "./hooks/useApiRequest" import qs from "qs" const PDOK_URL = "https://api.pdok.nl/bzk/locatieserver/search/v3_1/free" -// Filters for pdok search api const MUNICIPALITY_FILTER = "fq=(gemeentenaam:(amsterdam)) " -const ADDRESS_FILTER = "AND (type:adres)" -const ADDRESS_SORT = "straatnaam asc, huisnummer asc, huisletter asc, huisnummertoevoeging asc" +const ADDRESS_FILTER = "AND (type:adres) AND (adrestype: hoofdadres)" +// const ADDRESS_SORT = "straatnaam asc, huisnummer asc, huisletter asc, huisnummertoevoeging asc" const DEFAULT_SORT = "score desc, weergavenaam asc" -const AREA_CODE_FILTER = "AND (type:postcode)" - const FIELD_LIST = "weergavenaam,adrestype,gemeentenaam,nummeraanduiding_id,adresseerbaarobject_id,straatnaam,huisnummer,huisletter,huisnummertoevoeging,postcode,woonplaatsnaam,centroide_ll,score" const START = 0 -const RESULTS_PER_PAGE = 20 - +const RESULTS_PER_PAGE = 25 export const useBagPdok = (searchString?: string, options?: Options) => { const handleError = useErrorHandler() diff --git a/src/app/state/rest/benkAgg.ts b/src/app/state/rest/benkAgg.ts new file mode 100644 index 000000000..3041fe31d --- /dev/null +++ b/src/app/state/rest/benkAgg.ts @@ -0,0 +1,18 @@ +import qs from "qs" +import type { Options } from "." +import { useErrorHandler } from "./hooks/utils/errorHandler" +import useApiRequest from "./hooks/useApiRequest" + +const BENKAGG_URL = "https://api.data.amsterdam.nl/v1/benkagg/adresseerbareobjecten" + +export const useBenkAgg = (bagId?: Components.Schemas.Address["bag_id"], options?: Options) => { + const handleError = useErrorHandler() + const queryString = qs.stringify({ adresseertVerblijfsobjectIdentificatie: bagId }, { addQueryPrefix: true }) + return useApiRequest({ + url: `${ BENKAGG_URL }${ queryString }`, + lazy: bagId === undefined, + ...options, + groupName: "dataPunt", + handleError + }) +} diff --git a/src/app/state/rest/custom/useOtherAddresses/useOtherAddresses.ts b/src/app/state/rest/custom/useOtherAddresses/useOtherAddresses.ts index 99e02d21d..aff5d7baf 100644 --- a/src/app/state/rest/custom/useOtherAddresses/useOtherAddresses.ts +++ b/src/app/state/rest/custom/useOtherAddresses/useOtherAddresses.ts @@ -1,15 +1,18 @@ -import { useBAG, useBAGWithStreet } from "app/state/rest/index" -import getAddressFromBagResults from "app/components/addresses/utils/getAddressFromBagResults" +import { useBagPdok } from "app/state/rest/index" +import { getAddressFromBagPdokResponse } from "app/components/addresses/utils" /** * Returns other addresses with the same postcode + huisnummer * @param bagId */ const useOtherAddressesByBagId = (bagId: Components.Schemas.Address["bag_id"]) => { - const [data] = useBAG(bagId) - const foundAddress = getAddressFromBagResults(data) + const [data] = useBagPdok(bagId) + const foundAddress = getAddressFromBagPdokResponse(data) const searchQuery = `${ foundAddress?.postcode } ${ foundAddress?.huisnummer }` - const [otherAddresses, otherAddressesMethods] = useBAGWithStreet(searchQuery, { lazy: data === undefined }) - return [otherAddresses?.results?.filter(({ huisnummer }) => huisnummer === foundAddress?.huisnummer), otherAddressesMethods] as const + const [moreAddresses, otherAddressesMethods] = useBagPdok(searchQuery, { lazy: data === undefined }) + const otherAddresses = moreAddresses?.response?.docs?.filter(({ huisnummer, postcode }) => ( + huisnummer === foundAddress?.huisnummer && postcode === foundAddress?.postcode + )) + return [otherAddresses, otherAddressesMethods] as const } export default useOtherAddressesByBagId diff --git a/src/app/state/rest/custom/usePanoramaByBagId/usePanoramaByBagId.ts b/src/app/state/rest/custom/usePanoramaByBagId/usePanoramaByBagId.ts index 53e4e5c59..4cfbcbc52 100644 --- a/src/app/state/rest/custom/usePanoramaByBagId/usePanoramaByBagId.ts +++ b/src/app/state/rest/custom/usePanoramaByBagId/usePanoramaByBagId.ts @@ -1,13 +1,30 @@ -import { useBAG, usePanorama } from "app/state/rest/index" -import getAddressFromBagResults from "app/components/addresses/utils/getAddressFromBagResults" +import { useBagPdok, usePanorama } from "app/state/rest/index" +import { getAddressFromBagPdokResponse } from "app/components/addresses/utils" + +const extractLatLng = (point?: BAGPdokAddress["centroide_ll"]) => { + // Ensure the string starts with "POINT(" and ends with ")" + if (point && point.startsWith("POINT(") && point.endsWith(")")) { + // Remove "POINT(" from the start and ")" from the end + const coordinates = point.slice(6, -1) + // Split the coordinates by space + const [lng, lat] = coordinates.split(" ") + // Parse the coordinates to floats + return { + lat: parseFloat(lat), + lng: parseFloat(lng) + } + } + return null +} const usePanoramaByBagId = (bagId: string, width: number | undefined, aspect: number | undefined, radius: number, fov: number | undefined) => { - const [data] = useBAG(bagId) - const foundAddress = getAddressFromBagResults(data) + const [data] = useBagPdok(bagId) + const foundAddress = getAddressFromBagPdokResponse(data) + const latLng = extractLatLng(foundAddress?.centroide_ll) return usePanorama( - foundAddress?.centroid?.[1], - foundAddress?.centroid?.[0], + latLng?.lat, + latLng?.lng, width, aspect, radius, diff --git a/src/app/state/rest/dataPunt.ts b/src/app/state/rest/dataPunt.ts index 1b69b3267..d4bde5d8f 100644 --- a/src/app/state/rest/dataPunt.ts +++ b/src/app/state/rest/dataPunt.ts @@ -1,58 +1,8 @@ import qs from "qs" -import slashSandwich from "../../routing/utils/slashSandwich" - import type { Options } from "./" -import { useErrorHandler, useSuppressErrorHandler } from "./hooks/utils/errorHandler" +import { useSuppressErrorHandler } from "./hooks/utils/errorHandler" import useApiRequest from "./hooks/useApiRequest" -export const useBAG = (bagId?: Components.Schemas.Address["bag_id"], options?: Options) => { - const handleError = useErrorHandler() - const queryString = bagId !== undefined ? qs.stringify({ q: bagId }, { addQueryPrefix: true }) : "" - return useApiRequest({ - url: `https://api.data.amsterdam.nl/atlas/search/adres/${ queryString }`, - lazy: bagId === undefined, - ...options, - groupName: "dataPunt", - handleError - }) -} - -export const useBAGWithStreet = (searchString?: string, options?: Options) => { - const handleError = useErrorHandler() - const queryString = qs.stringify({ q: searchString }, { addQueryPrefix: true }) - return useApiRequest({ - url: `https://api.data.amsterdam.nl/atlas/search/adres/${ queryString }`, - ...options, - groupName: "dataPunt", - handleError - }) -} - -export const useBAGWithZipCode = (bagId?: Components.Schemas.Address["bag_id"], options?: Options) => { - const handleError = useErrorHandler() - const queryString = qs.stringify({ q: bagId }, { addQueryPrefix: true }) - return useApiRequest({ - url: `https://api.data.amsterdam.nl/atlas/search/postcode/${ queryString }`, - lazy: bagId === undefined, - ...options, - groupName: "dataPunt", - handleError - }) -} - -export const useBAGLodging = (type?: string, subTypeId?: string, options?: Options) => { - const handleError = useErrorHandler() - const url = slashSandwich(["https://api.data.amsterdam.nl/bag/v1.1", type, subTypeId], { trailingSlash: true }) - - return useApiRequest({ - url: url, - lazy: type === undefined || subTypeId === undefined, - ...options, - groupName: "dataPunt", - handleError - }) -} - export const usePanorama = (lat?: number, lon?: number, width?: number, aspect?: number, radius?: number, fov?: number, options?: Options) => { const handleError = useSuppressErrorHandler() const queryString = qs.stringify({ lat, lon, width, fov, aspect, radius }, { addQueryPrefix: true }) diff --git a/src/app/state/rest/index.ts b/src/app/state/rest/index.ts index fdc1804bf..c89c3e4c3 100644 --- a/src/app/state/rest/index.ts +++ b/src/app/state/rest/index.ts @@ -37,4 +37,5 @@ export * from "./roles" export * from "./permissions" export * from "./listing" export * from "./reasons" - +export * from "./bagPdok" +export * from "./benkAgg" From 1b33325d8cc128898ad285ceb79f7e6a264289d1 Mon Sep 17 00:00:00 2001 From: Remy van der Wereld Date: Tue, 9 Jul 2024 17:07:49 +0200 Subject: [PATCH 3/8] Updated workflow --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0b6edc5d5..8547e96c7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,10 +10,10 @@ jobs: main: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 20 - name: Install run: npm install @@ -26,7 +26,7 @@ jobs: - name: Cypress run if: ${{ github.actor != 'dependabot[bot]' }} - uses: cypress-io/github-action@v4 + uses: cypress-io/github-action@v6 with: record: false # Run test against acc, otherwise a local backend is needed. From 1813bbc5054237f48afbb80c54be16decbcb8fe9 Mon Sep 17 00:00:00 2001 From: Remy van der Wereld Date: Tue, 9 Jul 2024 17:11:14 +0200 Subject: [PATCH 4/8] Updated dependencies --- package-lock.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index c9d38fe2c..a8166e253 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5959,11 +5959,11 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -6101,9 +6101,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001587", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001587.tgz", - "integrity": "sha512-HMFNotUmLXn71BQxg8cijvqxnIAofforZOwGsxyXJ0qugTdspUF4sPSJ2vhgprHCB996tIDzEq1ubumPDV8ULA==", + "version": "1.0.30001640", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001640.tgz", + "integrity": "sha512-lA4VMpW0PSUrFnkmVuEKBUovSWKhj7puyCg8StBChgu298N1AtuF1sKWEvfDuimSEDbhlb/KqPKC3fs1HbuQUA==", "funding": [ { "type": "opencollective", @@ -8219,9 +8219,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -15079,9 +15079,9 @@ } }, "node_modules/ws": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", - "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", "dev": true, "engines": { "node": ">=10.0.0" From c576807dc7ab0e479859878ca83d2eeb604f1e38 Mon Sep 17 00:00:00 2001 From: Remy van der Wereld Date: Wed, 10 Jul 2024 14:49:46 +0200 Subject: [PATCH 5/8] Updated Cypress tests --- cypress.config.ts | 1 - cypress/README.md | 13 ++++- .../visit.plan.authorization.spec.js | 6 +-- cypress/e2e/020_visit/visit.plan.spec.js | 10 ++-- .../visit.result.access.granted.spec.js | 8 +-- .../visit.result.nobody.present.hold.spec.js | 8 +-- .../visit.result.nobody.present.spec.js | 8 +-- .../025_taskOverview/01-select.task.spec.js | 4 +- .../01-debrief.no.violation.spec.js | 4 +- .../01a-debrief.other.theme.spec.js | 6 +-- .../030_debrief/01b-debrief.violation.spec.js | 6 +-- .../01c-debrief.authorization.spec.js | 4 +- .../030_debrief/02-feedback.reporter.spec.js | 4 +- .../e2e/030_debrief/03-report.short.spec.js | 2 +- cypress/e2e/030_debrief/03-report.spec.js | 4 +- .../debrief.additional.research.spec.js | 6 +-- .../040_summon/01.summon.warning.vv.spec.js | 6 +-- .../e2e/040_summon/02.summon.closing.spec.js | 6 +-- .../050_nextStep/next.step.close.case.spec.js | 6 +-- .../050_nextStep/next.step.recheck.spec.js | 6 +-- .../1.close.case.handhaver.spec.js | 4 +- .../2.close.case.handhavingsjurist.spec.js | 4 +- .../3.close.case.toezichthouder.spec.js | 4 +- .../4.close.case.no.violation.spec.js | 8 +-- .../070_extra_tasks/01.correspondence.spec.js | 10 ++-- .../02.callback.request.spec.js | 10 ++-- .../070_extra_tasks/03.objection.file.spec.js | 10 ++-- .../e2e/070_extra_tasks/04.new.signal.spec.js | 6 +-- .../05.extra.information.spec.js | 6 +-- cypress/fixtures/address.json | 2 +- cypress/support/address.js | 9 ++-- cypress/support/case.js | 2 +- cypress/support/kcLogin.js | 4 +- cypress/support/login.js | 2 +- cypress_testflow_complete.json | 54 ------------------- 35 files changed, 101 insertions(+), 152 deletions(-) delete mode 100644 cypress_testflow_complete.json diff --git a/cypress.config.ts b/cypress.config.ts index 66cd17539..d5e169ce9 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -10,7 +10,6 @@ export default defineConfig({ defaultCommandTimeout: 10000, requestTimeout: 10000, env: { - baseUrlAcc: "https://acc.api.wonen.zaken.amsterdam.nl/api/v1/", baseUrlData: "https://api.data.amsterdam.nl/", userHh: "handhaver-noreply@amsterdam.nl", userHhj: "handhavingsjurist-noreply@amsterdam.nl", diff --git a/cypress/README.md b/cypress/README.md index 300ad037a..2ac066771 100644 --- a/cypress/README.md +++ b/cypress/README.md @@ -1,16 +1,25 @@ # Zaken frontend - Cypress integration ## Local testing + +Start your local env: + +```JavaScript +npm run acc +``` + To open the Cypress UI, enter the following command after installing dependencies: - `npx cypress open` or `npm run cy` ## Run specific tests -- `npm run cy:run -- --spec "cypress/integration/my-spec.js"` +```JavaScript +npm run cy:run -- --spec "cypress/integration/my-spec.js" +``` ## Global variables -Global Cypress variables can be found in `cypress.json` in the root of the project. You can acces them by using: `Cypress.env("emailPm")`. +Global Cypress variables can be found in `cypress.config.ts` in the root of the project. You can acces them by using: `Cypress.env("emailPm")`. ## Credentials or secrets diff --git a/cypress/e2e/020_visit/visit.plan.authorization.spec.js b/cypress/e2e/020_visit/visit.plan.authorization.spec.js index 0577a0684..c3c980151 100644 --- a/cypress/e2e/020_visit/visit.plan.authorization.spec.js +++ b/cypress/e2e/020_visit/visit.plan.authorization.spec.js @@ -4,7 +4,7 @@ import visit from "../../fixtures/visit.json" describe('Plan "huisbezoek"', () => { it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { @@ -29,7 +29,7 @@ describe('Plan "huisbezoek"', () => { describe('Go to "Bezoek inplannen" form', () => { it("Click on task Bezoek inplannen", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as("getTasks") cy.wait("@getTasks").then(() => { cy.get("tbody>tr") @@ -39,7 +39,7 @@ describe('Plan "huisbezoek"', () => { }) it("Bezoek inplannen page is visible", () => { - const url = `${Cypress.env("baseUrlAcc")}themes/*/schedule-types/` + const url = `**/themes/*/schedule-types/` cy.intercept(url).as("getScheduleTypes") cy.wait("@getScheduleTypes").then(() => { cy.get("h1") diff --git a/cypress/e2e/020_visit/visit.plan.spec.js b/cypress/e2e/020_visit/visit.plan.spec.js index b64bd439f..0d332926f 100644 --- a/cypress/e2e/020_visit/visit.plan.spec.js +++ b/cypress/e2e/020_visit/visit.plan.spec.js @@ -10,7 +10,7 @@ beforeEach(() => { describe('Test visit.plan.spec', () => { it("Go to Adresoverzicht and select address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`; + const url = `**/addresses/*/cases/`; cy.intercept(url).as("getCases"); cy.visit(`/adres/${address.bagId}`); cy.wait("@getCases").then(() => { @@ -40,7 +40,7 @@ describe('Test visit.plan.spec', () => { cy.get(`[data-testid="submit"]`).click(); - const urlCases = `${Cypress.env("baseUrlAcc")}cases/*/`; + const urlCases = `**/cases/*/`; cy.intercept(urlCases).as("getCase"); cy.wait("@getCase").then(() => { cy.get("tbody>tr").contains("td", "Bezoek inplannen"); @@ -50,9 +50,7 @@ describe('Test visit.plan.spec', () => { it("Schedule `Huisbezoek`", () => { cy.goToCaseDetailPage(); - const urlScheduleTypes = `${Cypress.env( - "baseUrlAcc" - )}themes/*/schedule-types/`; + const urlScheduleTypes = "**/themes/*/schedule-types/"; cy.intercept(urlScheduleTypes).as("getScheduleTypes"); cy.get("tbody>tr").contains("td", "Bezoek inplannen").click(); @@ -88,7 +86,7 @@ describe('Test visit.plan.spec', () => { .contains("Bezoek inplannen") .click(); - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/`; + const url = `**/cases/*/events/`; cy.intercept(url).as("getEvents"); cy.wait("@getEvents").then(() => { cy.history("Bezoek ingepland", "Datum"); diff --git a/cypress/e2e/020_visit/visit.result.access.granted.spec.js b/cypress/e2e/020_visit/visit.result.access.granted.spec.js index fb91a96ae..ce2a016bf 100644 --- a/cypress/e2e/020_visit/visit.result.access.granted.spec.js +++ b/cypress/e2e/020_visit/visit.result.access.granted.spec.js @@ -12,14 +12,14 @@ beforeEach(() => { describe("Test visit.result.access.granted.spec", () => { it("Mock TOP result for visit", () => { - const urlCases = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`; + const urlCases = `**/addresses/*/cases/`; cy.intercept(urlCases).as("getCases"); cy.visit(`/adres/${address.bagId}`); cy.wait("@getCases").then(() => { cy.get("h1").contains(`${address.street}, ${address.zipCode}`); }); - const urlCase = `${Cypress.env("baseUrlAcc")}cases/*/`; + const urlCase = `**/cases/*/`; cy.intercept(urlCase).as("getCase"); cy.scrollTo(0, 400); @@ -42,7 +42,7 @@ describe("Test visit.result.access.granted.spec", () => { cy.testDueDate("tbody>tr>td", 0); - const url = `${Cypress.env("baseUrlAcc")}users/`; + const url = `**/users/`; cy.intercept(url).as("getUsers"); cy.visit(`/zaken/${caseId}/huisbezoek/${taskId}`); @@ -73,7 +73,7 @@ describe("Test visit.result.access.granted.spec", () => { cy.get('[data-testid="notes"').type(visit.notes); - const url = `${Cypress.env("baseUrlAcc")}cases/*/`; + const url = `**/cases/*/`; cy.intercept(url).as("getDebriefTask"); cy.get('button[data-testid="submit"]').contains("Toevoegen").click(); diff --git a/cypress/e2e/020_visit/visit.result.nobody.present.hold.spec.js b/cypress/e2e/020_visit/visit.result.nobody.present.hold.spec.js index 3f3f5cf01..be1ed6c93 100644 --- a/cypress/e2e/020_visit/visit.result.nobody.present.hold.spec.js +++ b/cypress/e2e/020_visit/visit.result.nobody.present.hold.spec.js @@ -13,7 +13,7 @@ describe('Result "huisbezoek" with nobody present and hold', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -33,7 +33,7 @@ describe('Result "huisbezoek" with nobody present and hold', () => { it('Intercept TOP URL and load page', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getTasks') cy.wait('@getTasks').then(({ response }) => { @@ -49,7 +49,7 @@ describe('Result "huisbezoek" with nobody present and hold', () => { // check dueDate cy.testDueDate("tbody>tr>td", 0) - const url = `${Cypress.env("baseUrlAcc")}users/` + const url = `**/users/` cy.intercept(url).as('getUsers') cy.visit(`/zaken/${caseId}/huisbezoek/${taskId}`) @@ -105,7 +105,7 @@ describe('Result "huisbezoek" with nobody present and hold', () => { }) it('Submit form and check for plan new visit', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as('getEvents') cy.get('button[data-testid="submit"]') diff --git a/cypress/e2e/020_visit/visit.result.nobody.present.spec.js b/cypress/e2e/020_visit/visit.result.nobody.present.spec.js index 0b4c53b9c..431b29cc1 100644 --- a/cypress/e2e/020_visit/visit.result.nobody.present.spec.js +++ b/cypress/e2e/020_visit/visit.result.nobody.present.spec.js @@ -13,7 +13,7 @@ describe('Result "huisbezoek" with nobody present', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -33,7 +33,7 @@ describe('Result "huisbezoek" with nobody present', () => { it('Intercept TOP URL and load page', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getTasks') cy.wait('@getTasks').then(({ response }) => { @@ -50,7 +50,7 @@ describe('Result "huisbezoek" with nobody present', () => { cy.testDueDate("tbody>tr>td", 0) - const url = `${Cypress.env("baseUrlAcc")}users/` + const url = `**/users/` cy.intercept(url).as('getUsers') cy.visit(`/zaken/${caseId}/huisbezoek/${taskId}`) @@ -121,7 +121,7 @@ describe('Result "huisbezoek" with nobody present', () => { }) it('Submit form and check for plan new visit', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as('getEvents') cy.get('button[data-testid="submit"]') diff --git a/cypress/e2e/025_taskOverview/01-select.task.spec.js b/cypress/e2e/025_taskOverview/01-select.task.spec.js index 0efe76453..64651f1bf 100644 --- a/cypress/e2e/025_taskOverview/01-select.task.spec.js +++ b/cypress/e2e/025_taskOverview/01-select.task.spec.js @@ -10,14 +10,14 @@ beforeEach(() => { describe("Test select.task.spec", () => { it("Pick up task and put away in Takenoverzicht", () => { - const urlTasks = `${Cypress.env("baseUrlAcc")}tasks/*`; + const urlTasks = `**/tasks/*`; cy.intercept(urlTasks).as("getTasks"); cy.visit("/taken"); cy.wait("@getTasks").then(() => { cy.get("h1").contains("Takenoverzicht"); }); - const urlTasksUpdate = `${Cypress.env("baseUrlAcc")}tasks/*/`; + const urlTasksUpdate = `**/tasks/*/`; cy.intercept(urlTasksUpdate).as("updateTask"); const checkBox = cy.get('[type="checkbox"][title="Beschikbaar"]').first(); checkBox.check(); diff --git a/cypress/e2e/030_debrief/01-debrief.no.violation.spec.js b/cypress/e2e/030_debrief/01-debrief.no.violation.spec.js index 5e508188f..53ca085b8 100644 --- a/cypress/e2e/030_debrief/01-debrief.no.violation.spec.js +++ b/cypress/e2e/030_debrief/01-debrief.no.violation.spec.js @@ -20,7 +20,7 @@ describe("Test debrief.no.violation.spec", () => { cy.get('[data-testid="feedback"]').type(debrief.descriptionNoViolation); - const url = `${Cypress.env("baseUrlAcc")}cases/*/`; + const url = `**/cases/*/`; cy.intercept(url).as("getNextTask"); cy.get('button[data-testid="submit"]') @@ -58,7 +58,7 @@ describe("Test debrief.no.violation.spec", () => { .contains("Taak afronden") .click(); - const urlEvents = `${Cypress.env("baseUrlAcc")}cases/*/events/`; + const urlEvents = `**/cases/*/events/`; cy.intercept(urlEvents).as("getEvents"); cy.wait("@getEvents").then(() => { cy.history(debrief.noViolationNextTask, roles.PM); diff --git a/cypress/e2e/030_debrief/01a-debrief.other.theme.spec.js b/cypress/e2e/030_debrief/01a-debrief.other.theme.spec.js index cdcf41829..2b0c7a75b 100644 --- a/cypress/e2e/030_debrief/01a-debrief.other.theme.spec.js +++ b/cypress/e2e/030_debrief/01a-debrief.other.theme.spec.js @@ -11,7 +11,7 @@ describe('Process Debrief - Other Theme"', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -33,7 +33,7 @@ describe('Process Debrief - Other Theme"', () => { it('Intercept Debrief URL and load page', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getTasks') cy.wait('@getTasks').then(({ response }) => { @@ -72,7 +72,7 @@ describe('Process Debrief - Other Theme"', () => { }) it('Submit form and check debrief status', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.get('button[data-testid="submit"]') diff --git a/cypress/e2e/030_debrief/01b-debrief.violation.spec.js b/cypress/e2e/030_debrief/01b-debrief.violation.spec.js index c25936162..b9622c28c 100644 --- a/cypress/e2e/030_debrief/01b-debrief.violation.spec.js +++ b/cypress/e2e/030_debrief/01b-debrief.violation.spec.js @@ -11,7 +11,7 @@ describe('Process Debrief - Violation"', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -31,7 +31,7 @@ describe('Process Debrief - Violation"', () => { it('Intercept Debrief URL and load page', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getTasks') cy.wait('@getTasks').then(({ response }) => { @@ -68,7 +68,7 @@ describe('Process Debrief - Violation"', () => { }) it('Submit form and check debrief status', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.get('button[data-testid="submit"]') diff --git a/cypress/e2e/030_debrief/01c-debrief.authorization.spec.js b/cypress/e2e/030_debrief/01c-debrief.authorization.spec.js index 9da57f4c7..e4ed106f1 100644 --- a/cypress/e2e/030_debrief/01c-debrief.authorization.spec.js +++ b/cypress/e2e/030_debrief/01c-debrief.authorization.spec.js @@ -11,7 +11,7 @@ describe('Process Debrief - Authorization required"', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -33,7 +33,7 @@ describe('Process Debrief - Authorization required"', () => { it('Intercept Debrief URL and load page', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getTasks') cy.wait('@getTasks').then(({ response }) => { diff --git a/cypress/e2e/030_debrief/02-feedback.reporter.spec.js b/cypress/e2e/030_debrief/02-feedback.reporter.spec.js index 907635c4e..a478cd71a 100644 --- a/cypress/e2e/030_debrief/02-feedback.reporter.spec.js +++ b/cypress/e2e/030_debrief/02-feedback.reporter.spec.js @@ -5,7 +5,7 @@ import address from "../../fixtures/address.json" describe('Process Feedback reporter"', () => { it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -48,7 +48,7 @@ describe('Process Feedback reporter"', () => { }) it("Check Terugkoppeling melder event in history", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.wait('@getNextTask').then(() => { diff --git a/cypress/e2e/030_debrief/03-report.short.spec.js b/cypress/e2e/030_debrief/03-report.short.spec.js index c9d4e7455..dda440614 100644 --- a/cypress/e2e/030_debrief/03-report.short.spec.js +++ b/cypress/e2e/030_debrief/03-report.short.spec.js @@ -33,7 +33,7 @@ describe("Test report.short.spec", () => { cy.get(`[role="dialog"]`).find("button").contains("Taak afronden").click(); - const url = `${Cypress.env("baseUrlAcc")}cases/*/`; + const url = `**/cases/*/`; cy.intercept(url).as("getNextTask"); cy.wait("@getNextTask").then(() => { diff --git a/cypress/e2e/030_debrief/03-report.spec.js b/cypress/e2e/030_debrief/03-report.spec.js index 20f1d1d6f..c017b67e3 100644 --- a/cypress/e2e/030_debrief/03-report.spec.js +++ b/cypress/e2e/030_debrief/03-report.spec.js @@ -5,7 +5,7 @@ import address from "../../fixtures/address.json" describe('Process Report Visit"', () => { it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -132,7 +132,7 @@ describe('Process Report Visit"', () => { cy.testDueDate("tbody>tr>td", 2) }) it("Check next task is 'Nakijken aanschrijving(en)'", () => { - // const url = `${Cypress.env("baseUrlAcc")}cases/*/` + // const url = `**/cases/*/` // cy.intercept(url).as('getNextTask') // cy.wait('@getNextTask').then(() => { diff --git a/cypress/e2e/030_debrief/debrief.additional.research.spec.js b/cypress/e2e/030_debrief/debrief.additional.research.spec.js index 24c2e5e63..57670d8d3 100644 --- a/cypress/e2e/030_debrief/debrief.additional.research.spec.js +++ b/cypress/e2e/030_debrief/debrief.additional.research.spec.js @@ -11,7 +11,7 @@ describe('Process Debrief - No violation"', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -33,7 +33,7 @@ describe('Process Debrief - No violation"', () => { it('Intercept Debrief URL and load page', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getTasks') cy.wait('@getTasks').then(({ response }) => { @@ -70,7 +70,7 @@ describe('Process Debrief - No violation"', () => { }) it('Submit form and check debrief status', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.get('button[data-testid="submit"]') diff --git a/cypress/e2e/040_summon/01.summon.warning.vv.spec.js b/cypress/e2e/040_summon/01.summon.warning.vv.spec.js index e4e73d66b..34d11a67d 100644 --- a/cypress/e2e/040_summon/01.summon.warning.vv.spec.js +++ b/cypress/e2e/040_summon/01.summon.warning.vv.spec.js @@ -6,7 +6,7 @@ import summon from "../../fixtures/summon.json" describe('Process Summon"', () => { it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -85,7 +85,7 @@ describe('Process Summon"', () => { }) it('Submit form and check debrief status', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.get('button[data-testid="submit"]') @@ -111,7 +111,7 @@ describe('Process Summon"', () => { }) it("Check next task is 'Uitzetten vervolgstap'", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.wait('@getNextTask').then(() => { diff --git a/cypress/e2e/040_summon/02.summon.closing.spec.js b/cypress/e2e/040_summon/02.summon.closing.spec.js index bdcfc80f0..6f86c2179 100644 --- a/cypress/e2e/040_summon/02.summon.closing.spec.js +++ b/cypress/e2e/040_summon/02.summon.closing.spec.js @@ -6,7 +6,7 @@ import summon from "../../fixtures/summon.json" describe('Process Summon"', () => { it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -76,7 +76,7 @@ describe('Process Summon"', () => { }) it('Submit form and check debrief status', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.get('button[data-testid="submit"]') @@ -99,7 +99,7 @@ describe('Process Summon"', () => { }) it("Check next task is 'Uitzetten vervolgstap'", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.wait('@getNextTask').then(() => { diff --git a/cypress/e2e/050_nextStep/next.step.close.case.spec.js b/cypress/e2e/050_nextStep/next.step.close.case.spec.js index 5d2e92b78..adab1ca73 100644 --- a/cypress/e2e/050_nextStep/next.step.close.case.spec.js +++ b/cypress/e2e/050_nextStep/next.step.close.case.spec.js @@ -4,7 +4,7 @@ import address from "../../fixtures/address.json" describe('Select Next Step - closing case"', () => { it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -23,7 +23,7 @@ describe('Select Next Step - closing case"', () => { }) it("Select to close this case", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.wait('@getNextTask').then(() => { @@ -48,7 +48,7 @@ describe('Select Next Step - closing case"', () => { }) it("Request is successfully processed", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as('getEvents') cy.wait('@getEvents').then(() => { cy.get("h1").contains("Zaakdetails") diff --git a/cypress/e2e/050_nextStep/next.step.recheck.spec.js b/cypress/e2e/050_nextStep/next.step.recheck.spec.js index d4f7a9904..e5336aa75 100644 --- a/cypress/e2e/050_nextStep/next.step.recheck.spec.js +++ b/cypress/e2e/050_nextStep/next.step.recheck.spec.js @@ -4,7 +4,7 @@ import address from "../../fixtures/address.json" describe('Select Next Step - closing case"', () => { it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -23,7 +23,7 @@ describe('Select Next Step - closing case"', () => { }) it("Select to close this case", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.wait('@getNextTask').then(() => { @@ -48,7 +48,7 @@ describe('Select Next Step - closing case"', () => { }) it("Request is successfully processed", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as('getEvents') cy.wait('@getEvents').then(() => { cy.get("h1").contains("Zaakdetails") diff --git a/cypress/e2e/060_closeCase/1.close.case.handhaver.spec.js b/cypress/e2e/060_closeCase/1.close.case.handhaver.spec.js index 30e5d8271..ea0b63927 100644 --- a/cypress/e2e/060_closeCase/1.close.case.handhaver.spec.js +++ b/cypress/e2e/060_closeCase/1.close.case.handhaver.spec.js @@ -10,7 +10,7 @@ beforeEach(() => { describe("Select Next Step - closing case as handhaver", () => { it('Go to Adresoverzicht and case has task "Afsluiten zaak"', () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`; + const url = `**/addresses/*/cases/`; cy.intercept(url).as("getCases"); cy.visit(`/adres/${address.bagId}`); cy.wait("@getCases").then(() => { @@ -28,7 +28,7 @@ describe("Select Next Step - closing case as handhaver", () => { cy.get("tbody>tr>td").eq(2).should("contain", roles.PM); - const url = `${Cypress.env("baseUrlAcc")}themes/*/case-close-reasons/`; + const url = `**/themes/*/case-close-reasons/`; cy.intercept(url).as("getCloseReasons"); cy.get("tbody>tr").contains("td", "Zaak afsluiten").click(); diff --git a/cypress/e2e/060_closeCase/2.close.case.handhavingsjurist.spec.js b/cypress/e2e/060_closeCase/2.close.case.handhavingsjurist.spec.js index 189729216..7168e8c2d 100644 --- a/cypress/e2e/060_closeCase/2.close.case.handhavingsjurist.spec.js +++ b/cypress/e2e/060_closeCase/2.close.case.handhavingsjurist.spec.js @@ -10,7 +10,7 @@ beforeEach(() => { describe("Select Next Step - closing case as handhavingsjurist", () => { it('Go to Adresoverzicht and case has task "Afsluiten zaak"', () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`; + const url = `**/addresses/*/cases/`; cy.intercept(url).as("getCases"); cy.visit(`/adres/${address.bagId}`); cy.wait("@getCases").then(() => { @@ -28,7 +28,7 @@ describe("Select Next Step - closing case as handhavingsjurist", () => { cy.get("tbody>tr>td").eq(2).should("contain", roles.PM); - const url = `${Cypress.env("baseUrlAcc")}themes/*/case-close-reasons/`; + const url = `**/themes/*/case-close-reasons/`; cy.intercept(url).as("getCloseReasons"); cy.get("tbody>tr").contains("td", "Zaak afsluiten").click(); diff --git a/cypress/e2e/060_closeCase/3.close.case.toezichthouder.spec.js b/cypress/e2e/060_closeCase/3.close.case.toezichthouder.spec.js index ee25057c1..aa6236130 100644 --- a/cypress/e2e/060_closeCase/3.close.case.toezichthouder.spec.js +++ b/cypress/e2e/060_closeCase/3.close.case.toezichthouder.spec.js @@ -10,7 +10,7 @@ beforeEach(() => { describe("Select Next Step - closing case as toezichthouder", () => { it('Go to Adresoverzicht and case has task "Afsluiten zaak"', () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`; + const url = `**/addresses/*/cases/`; cy.intercept(url).as("getCases"); cy.visit(`/adres/${address.bagId}`); cy.wait("@getCases").then(() => { @@ -28,7 +28,7 @@ describe("Select Next Step - closing case as toezichthouder", () => { cy.get("tbody>tr>td").eq(2).should("contain", roles.PM); - const url = `${Cypress.env("baseUrlAcc")}themes/*/case-close-reasons/`; + const url = `**/themes/*/case-close-reasons/`; cy.intercept(url).as("getCloseReasons"); cy.get("tbody>tr").contains("td", "Zaak afsluiten").click(); diff --git a/cypress/e2e/060_closeCase/4.close.case.no.violation.spec.js b/cypress/e2e/060_closeCase/4.close.case.no.violation.spec.js index f1e0e8ece..f3e04bc88 100644 --- a/cypress/e2e/060_closeCase/4.close.case.no.violation.spec.js +++ b/cypress/e2e/060_closeCase/4.close.case.no.violation.spec.js @@ -11,7 +11,7 @@ beforeEach(() => { describe('Close case as projectmedwerker"', () => { it('Go to Adresoverzicht and case has task "Afsluiten zaak"', () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`; + const url = `**/addresses/*/cases/`; cy.intercept(url).as("getCases"); cy.visit(`/adres/${address.bagId}`); cy.wait("@getCases").then(() => { @@ -26,7 +26,7 @@ describe('Close case as projectmedwerker"', () => { it("Intercept Afronding URL and load page", () => { cy.goToCaseDetailPage(); - const url = `${Cypress.env("baseUrlAcc")}cases/*/`; + const url = `**/cases/*/`; cy.intercept(url).as("getTasks"); //force intercept @@ -42,7 +42,7 @@ describe('Close case as projectmedwerker"', () => { const caseId = closingTask?.case; const taskId = closingTask.case_user_task_id; - const url = `${Cypress.env("baseUrlAcc")}themes/*/case-close-reasons`; + const url = `**/themes/*/case-close-reasons`; cy.intercept(url).as("getCloseReasons"); cy.get("h4").contains(debrief.closingTask2); cy.get("tbody>tr") @@ -79,7 +79,7 @@ describe('Close case as projectmedwerker"', () => { .contains("Verwerken") .click(); - const urlEvents = `${Cypress.env("baseUrlAcc")}cases/*/events/`; + const urlEvents = `**/cases/*/events/`; cy.intercept(urlEvents).as("getEvents"); cy.wait("@getEvents").then(() => { cy.history("Zaak afgerond", "Projectmedewerker"); diff --git a/cypress/e2e/070_extra_tasks/01.correspondence.spec.js b/cypress/e2e/070_extra_tasks/01.correspondence.spec.js index 4ee2a74e1..10d634206 100644 --- a/cypress/e2e/070_extra_tasks/01.correspondence.spec.js +++ b/cypress/e2e/070_extra_tasks/01.correspondence.spec.js @@ -11,7 +11,7 @@ describe('Add extra task "Correspondentie', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { @@ -40,7 +40,7 @@ describe('Add extra task "Correspondentie', () => { describe("Submit in form 'Taak opvoeren'", () => { it("Select Task Correspondence", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/processes/` + const url = `**/cases/*/processes/` cy.intercept(url).as("getProcesses") cy.wait("@getProcesses").then(() => { cy.get('[data-testid="workflowProcess"]') @@ -59,7 +59,7 @@ describe('Add extra task "Correspondentie', () => { }) it("Request is successfully processed", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as("getEvents") cy.wait("@getEvents").then(() => { cy.get("h4") @@ -77,7 +77,7 @@ describe('Add extra task "Correspondentie', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -129,7 +129,7 @@ describe('Add extra task "Correspondentie', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { diff --git a/cypress/e2e/070_extra_tasks/02.callback.request.spec.js b/cypress/e2e/070_extra_tasks/02.callback.request.spec.js index ce0518c09..8b0618ac6 100644 --- a/cypress/e2e/070_extra_tasks/02.callback.request.spec.js +++ b/cypress/e2e/070_extra_tasks/02.callback.request.spec.js @@ -11,7 +11,7 @@ describe('Add extra task "Callback request', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { @@ -40,7 +40,7 @@ describe('Add extra task "Callback request', () => { describe("Submit in form 'Taak opvoeren'", () => { it("Select Task Terugbelverzoek", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/processes/` + const url = `**/cases/*/processes/` cy.intercept(url).as("getProcesses") cy.wait("@getProcesses").then(() => { cy.get('[data-testid="workflowProcess"]') @@ -59,7 +59,7 @@ describe('Add extra task "Callback request', () => { }) it("Request is successfully processed", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as("getEvents") cy.wait("@getEvents").then(() => { cy.get("h4") @@ -77,7 +77,7 @@ describe('Add extra task "Callback request', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -129,7 +129,7 @@ describe('Add extra task "Callback request', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { diff --git a/cypress/e2e/070_extra_tasks/03.objection.file.spec.js b/cypress/e2e/070_extra_tasks/03.objection.file.spec.js index 57147b1ad..65972f55c 100644 --- a/cypress/e2e/070_extra_tasks/03.objection.file.spec.js +++ b/cypress/e2e/070_extra_tasks/03.objection.file.spec.js @@ -11,7 +11,7 @@ describe('Add extra task "Objection File', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { @@ -40,7 +40,7 @@ describe('Add extra task "Objection File', () => { describe("Submit in form 'Taak opvoeren'", () => { it("Select Task Aanleveren bezwaardossier", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/processes/` + const url = `**/cases/*/processes/` cy.intercept(url).as("getProcesses") cy.wait("@getProcesses").then(() => { cy.get('[data-testid="workflowProcess"]') @@ -59,7 +59,7 @@ describe('Add extra task "Objection File', () => { }) it("Request is successfully processed", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as("getEvents") cy.wait("@getEvents").then(() => { cy.get("h4") @@ -77,7 +77,7 @@ describe('Add extra task "Objection File', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -130,7 +130,7 @@ describe('Add extra task "Objection File', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { diff --git a/cypress/e2e/070_extra_tasks/04.new.signal.spec.js b/cypress/e2e/070_extra_tasks/04.new.signal.spec.js index eefd60494..c345ff2bd 100644 --- a/cypress/e2e/070_extra_tasks/04.new.signal.spec.js +++ b/cypress/e2e/070_extra_tasks/04.new.signal.spec.js @@ -11,7 +11,7 @@ describe('Add extra task "New signal', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { @@ -40,7 +40,7 @@ describe('Add extra task "New signal', () => { describe("Submit in form 'Taak opvoeren'", () => { it("Select Task Verwerken nieuwe melding", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/processes/` + const url = `**/cases/*/processes/` cy.intercept(url).as("getProcesses") cy.wait("@getProcesses").then(() => { cy.get('[data-testid="workflowProcess"]') @@ -59,7 +59,7 @@ describe('Add extra task "New signal', () => { }) it("Request is successfully processed", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as("getEvents") cy.wait("@getEvents").then(() => { cy.get("h4") diff --git a/cypress/e2e/070_extra_tasks/05.extra.information.spec.js b/cypress/e2e/070_extra_tasks/05.extra.information.spec.js index e4e4da59f..66a2b60db 100644 --- a/cypress/e2e/070_extra_tasks/05.extra.information.spec.js +++ b/cypress/e2e/070_extra_tasks/05.extra.information.spec.js @@ -11,7 +11,7 @@ describe('Add extra task "Extra Information', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { @@ -40,7 +40,7 @@ describe('Add extra task "Extra Information', () => { describe("Submit in form 'Taak opvoeren'", () => { it("Select Task Extra informatie", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/processes/` + const url = `**/cases/*/processes/` cy.intercept(url).as("getProcesses") cy.wait("@getProcesses").then(() => { cy.get('[data-testid="workflowProcess"]') @@ -59,7 +59,7 @@ describe('Add extra task "Extra Information', () => { }) it("Request is successfully processed", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as("getEvents") cy.wait("@getEvents").then(() => { cy.get("h4") diff --git a/cypress/fixtures/address.json b/cypress/fixtures/address.json index 9801633bd..c972aab31 100644 --- a/cypress/fixtures/address.json +++ b/cypress/fixtures/address.json @@ -3,6 +3,6 @@ "street": "Weesperstraat 113", "zipCode": "1018VN", "city": "Amsterdam", - "queryString": "1018VN113", + "queryString": "1018VN 113", "bagId": "0363010000864314" } diff --git a/cypress/support/address.js b/cypress/support/address.js index 4a5bb2ebd..cec6d7c72 100644 --- a/cypress/support/address.js +++ b/cypress/support/address.js @@ -1,18 +1,15 @@ +import address from "../fixtures/address.json" /* ** Search address for cases by queryString. ** Select first case. ** Check Adresoverzicht for right address */ Cypress.Commands.add("selectAddress", (queryString, addressString) => { - expect(queryString, "queryString was set").to.be.a("string").and.not.be.empty expect(addressString, "addressString was set").to.be.a("string").and.not.be.empty - const urlAddress = `${Cypress.env("baseUrlData")}atlas/search/postcode/*` - cy.intercept(urlAddress).as("getAddress") - - const urlCases = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` - cy.intercept(urlCases).as("getCases") + cy.intercept(`**${ address.zipCode }**`).as("getAddress") + cy.intercept("**/addresses/*/cases/").as("getCases") cy.visit(`/?query=${queryString}`) diff --git a/cypress/support/case.js b/cypress/support/case.js index 61c983dae..2e93a2aee 100644 --- a/cypress/support/case.js +++ b/cypress/support/case.js @@ -7,7 +7,7 @@ const PATH = "cypress/fixtures/case.json" Cypress.Commands.add("setCaseId", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as("getCase") cy.wait("@getCase", { timeout: 20000 }) diff --git a/cypress/support/kcLogin.js b/cypress/support/kcLogin.js index e319ec977..47ed6b01a 100644 --- a/cypress/support/kcLogin.js +++ b/cypress/support/kcLogin.js @@ -1,6 +1,6 @@ Cypress.Commands.add("kcLogin", (username, password) => { - const kcRoot = "https://iam.amsterdam.nl"; + const kcRoot = "https://acc.iam.amsterdam.nl"; const kcRealm = "datapunt-ad-acc"; const kcClient = "wonen-zaaksysteem-frontend"; const kcRedirectUri = "http://localhost:2999/"; @@ -58,7 +58,7 @@ Cypress.Commands.add("kcLogin", (username, password) => { }); Cypress.Commands.add("kcLogout", () => { - const kcRoot = "https://iam.amsterdam.nl"; + const kcRoot = "https://acc.iam.amsterdam.nl"; const kcRealm = "datapunt-ad-acc"; const kcRedirectUri = "http://localhost:2999/"; return cy.request({ diff --git a/cypress/support/login.js b/cypress/support/login.js index 7f25966a6..81d5dd673 100644 --- a/cypress/support/login.js +++ b/cypress/support/login.js @@ -32,7 +32,7 @@ Cypress.Commands.add("login", (email, password) => { cy.get("#password").should("be.visible").type(password, { log: false }); - const url = `${Cypress.env("baseUrlAcc")}is-authorized/`; + const url = `**/is-authorized/`; cy.intercept(url).as("isAuthorized"); cy.get("#kc-login").click(); diff --git a/cypress_testflow_complete.json b/cypress_testflow_complete.json deleted file mode 100644 index 88dd341a1..000000000 --- a/cypress_testflow_complete.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "projectId": "tbpt8b", - "chromeWebSecurity": false, - "baseUrl": "http://localhost:2999/", - "screenshotOnRunFailure": false, - "video": false, - "viewportWidth": 1280, - "viewportHeight": 1024, - "env": { - "baseUrlAcc": "https://acc.api.wonen.zaken.amsterdam.nl/api/v1/", - "baseUrlData": "https://api.data.amsterdam.nl/", - "userHh": "handhaver-noreply@amsterdam.nl", - "userHhj": "handhavingsjurist-noreply@amsterdam.nl", - "userPm": "projectmedewerker-noreply@amsterdam.nl", - "userTh": "toezichthouder-noreply@amsterdam.nl" - }, - "testFiles": [ - "010_addCase/themes/vakantieverhuur/add.case.anonymous.no.ad.spec.js", - "020_visit/visit.plan.spec.js", - "020_visit/visit.result.nobody.present.spec.js", - "020_visit/visit.plan.spec.js", - "020_visit/visit.result.access.granted.spec.js", - "030_debrief/01-debrief.no.violation.spec.js", - "030_debrief/03-report.short.spec.js", - "050_nextStep/*.js", - "060_closeCase/*.js", - "010_addCase/themes/vakantieverhuur/add.case.not.anonymous.ad.spec.js", - "020_visit/visit.plan.spec.js", - "020_visit/visit.result.access.granted.spec.js", - "030_debrief/01a-debrief.other.theme.spec.js", - "030_debrief/03-report.short.spec.js", - "050_nextStep/*.js", - "060_closeCase/*.js", - "010_addCase/themes/vakantieverhuur/add.case.not.anonymous.ad.spec.js", - "020_visit/visit.plan.spec.js", - "020_visit/visit.result.access.granted.spec.js", - "030_debrief/01b-debrief.violation.spec.js", - "030_debrief/03-report.spec.js", - "040_summon/summon.spec.js", - "050_nextStep/next.step.recheck.spec.js", - "020_visit/visit.plan.spec.js", - "010_addCase/themes/vakantieverhuur/add.case.anonymous.no.ad.spec.js", - "020_visit/visit.plan.spec.js", - "020_visit/visit.result.access.granted.spec.js", - "030_debrief/01c-debrief.authorization.spec.js", - "020_visit/visit.plan.authorization.spec.js", - "010_addCase/themes/vakantieverhuur/add.case.errors.spec.js", - "010_addCase/roles/handhaver/add.case.disabled.spec.js", - "010_addCase/roles/handhavingsjurist/add.case.disabled.spec.js", - "010_addCase/roles/toezichthouder/add.case.disabled.spec.js", - "010_addCase/themes/vakantieverhuur/add.case.anonymous.no.ad.spec.js", - "070_extra_tasks/*" - ] - } From 46c195aa5e0abacbf2ec28951f29eb4158495547 Mon Sep 17 00:00:00 2001 From: Remy van der Wereld Date: Mon, 30 Sep 2024 17:03:52 +0200 Subject: [PATCH 6/8] Removed filtering for nevenadres --- .../addresses/utils/getAddressFromBagPdokResponse.ts | 4 +--- src/app/components/search/SearchResults/columns.tsx | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/app/components/addresses/utils/getAddressFromBagPdokResponse.ts b/src/app/components/addresses/utils/getAddressFromBagPdokResponse.ts index 4457d6041..bc08cdda2 100644 --- a/src/app/components/addresses/utils/getAddressFromBagPdokResponse.ts +++ b/src/app/components/addresses/utils/getAddressFromBagPdokResponse.ts @@ -1,6 +1,4 @@ export const getAddressFromBagPdokResponse = (data?: BAGPdokResponse): BAGPdokAddress | undefined => { const docs = data?.response?.docs - return ( - docs?.find((result) => result.adrestype === "hoofdadres") - ) + return docs && docs[0] ? docs[0] : undefined } diff --git a/src/app/components/search/SearchResults/columns.tsx b/src/app/components/search/SearchResults/columns.tsx index 99a0f32d1..b5e5aa5ba 100644 --- a/src/app/components/search/SearchResults/columns.tsx +++ b/src/app/components/search/SearchResults/columns.tsx @@ -5,10 +5,7 @@ const columns = [ { header: "Adres", dataIndex: "weergavenaam", - minWidth: 100, - render: (adres: any, obj: any) => ( - `${ adres } ${ obj.adrestype === "nevenadres" ? "(Nevenadres)" : "" }` - ) + minWidth: 100 }, { dataIndex: "adresseerbaarobject_id", From 70b411bfe41218568f13eb4a223a29cbdf067eb5 Mon Sep 17 00:00:00 2001 From: Remy van der Wereld Date: Mon, 21 Oct 2024 16:56:09 +0200 Subject: [PATCH 7/8] Updated pdok free / suggest --- .../addresses/AddressHeader/AddressHeader.tsx | 4 +- .../cases/CreateForm/CreateForm.tsx | 4 +- .../AddressHeadingByBagId.tsx | 4 +- src/app/state/rest/bagPdok.ts | 43 +++++++++++++------ .../useOtherAddresses/useOtherAddresses.ts | 4 +- .../usePanoramaByBagId/usePanoramaByBagId.ts | 4 +- 6 files changed, 41 insertions(+), 22 deletions(-) diff --git a/src/app/components/addresses/AddressHeader/AddressHeader.tsx b/src/app/components/addresses/AddressHeader/AddressHeader.tsx index 1199cf0e9..451263642 100644 --- a/src/app/components/addresses/AddressHeader/AddressHeader.tsx +++ b/src/app/components/addresses/AddressHeader/AddressHeader.tsx @@ -2,7 +2,7 @@ import styled from "styled-components" import { breakpoint, themeSpacing, Typography } from "@amsterdam/asc-ui" import { SmallSkeleton } from "@amsterdam/wonen-ui" -import { useBagPdok } from "app/state/rest" +import { useBagPdokByBagId } from "app/state/rest" import ShowOtherAddressesButton, { Index } from "app/components/addresses/AddressSuffixSwitcher/ShowOtherAddressesButton" import useOtherAddressesByBagId from "app/state/rest/custom/useOtherAddresses/useOtherAddresses" import AddressLink from "./components/AddressLink" @@ -29,7 +29,7 @@ const ButtonWrap = styled.div` ` const AddressHeader: React.FC = ({ bagId, headingSize = "h2", isHeader = false, enableSwitch = true }) => { - const [data, { isBusy }] = useBagPdok(bagId) + const [data, { isBusy }] = useBagPdokByBagId(bagId) const foundAddress = getAddressFromBagPdokResponse(data) const [filteredAddresses] = useOtherAddressesByBagId(bagId) const showButton = enableSwitch && (filteredAddresses?.length ?? 0) > 1 diff --git a/src/app/components/cases/CreateForm/CreateForm.tsx b/src/app/components/cases/CreateForm/CreateForm.tsx index 5a189a1ee..0bc34af9c 100644 --- a/src/app/components/cases/CreateForm/CreateForm.tsx +++ b/src/app/components/cases/CreateForm/CreateForm.tsx @@ -2,7 +2,7 @@ import { useState, useEffect } from "react" import scaffold from "./scaffold" import { useCaseThemes, useReasons, useCaseCreate, useProjects, - useListing, useSubjects, useCasesByBagId, useCorporations, useBagPdok + useListing, useSubjects, useCasesByBagId, useCorporations, useBagPdokByBagId } from "app/state/rest" import ConfirmScaffoldForm from "app/components/shared/ConfirmScaffoldForm/ConfirmScaffoldForm" import useNavigateWithFlashMessage from "app/state/flashMessages/useNavigateWithFlashMessage" @@ -64,7 +64,7 @@ const CreateForm: React.FC = ({ bagId, tonId }) => { const [listing] = useListing(tonId) const [cases] = useCasesByBagId(bagId) const [corporations] = useCorporations() - const [bagAddressResponse] = useBagPdok(bagId) + const [bagAddressResponse] = useBagPdokByBagId(bagId) const bagAddress = getAddressFromBagPdokResponse(bagAddressResponse) const { navigateTo } = useNavigation() diff --git a/src/app/components/shared/AddressHeadingByBagId/AddressHeadingByBagId.tsx b/src/app/components/shared/AddressHeadingByBagId/AddressHeadingByBagId.tsx index 6b45d5644..0162f78f7 100644 --- a/src/app/components/shared/AddressHeadingByBagId/AddressHeadingByBagId.tsx +++ b/src/app/components/shared/AddressHeadingByBagId/AddressHeadingByBagId.tsx @@ -1,6 +1,6 @@ import { Heading } from "@amsterdam/asc-ui" -import { useBagPdok } from "app/state/rest" +import { useBagPdokByBagId } from "app/state/rest" import { getAddressFromBagPdokResponse } from "app/components/addresses/utils" type Props = { @@ -8,7 +8,7 @@ type Props = { } const AddressHeadingByBagId: React.FC = ({ bagId }) => { - const [data] = useBagPdok(bagId) + const [data] = useBagPdokByBagId(bagId) const address = getAddressFromBagPdokResponse(data) return ( diff --git a/src/app/state/rest/bagPdok.ts b/src/app/state/rest/bagPdok.ts index eb32996d7..01edd23eb 100644 --- a/src/app/state/rest/bagPdok.ts +++ b/src/app/state/rest/bagPdok.ts @@ -3,8 +3,8 @@ import { useErrorHandler } from "./hooks/utils/errorHandler" import useApiRequest from "./hooks/useApiRequest" import qs from "qs" -const PDOK_URL = "https://api.pdok.nl/bzk/locatieserver/search/v3_1/free" -const MUNICIPALITY_FILTER = "fq=(gemeentenaam:(amsterdam)) " +const PDOK_URL = "https://api.pdok.nl/bzk/locatieserver/search/v3_1" +const MUNICIPALITY_FILTER = "gemeentenaam:(amsterdam)" const ADDRESS_FILTER = "AND (type:adres) AND (adrestype: hoofdadres)" // const ADDRESS_SORT = "straatnaam asc, huisnummer asc, huisletter asc, huisnummertoevoeging asc" const DEFAULT_SORT = "score desc, weergavenaam asc" @@ -12,20 +12,39 @@ const FIELD_LIST = "weergavenaam,adrestype,gemeentenaam,nummeraanduiding_id,adre const START = 0 const RESULTS_PER_PAGE = 25 +// Helper function to construct query +const constructQuery = (searchString?: string): string => qs.stringify({ + q: searchString, + fq: `${ MUNICIPALITY_FILTER }${ ADDRESS_FILTER }`, + fl: FIELD_LIST, + start: START.toString(), + rows: RESULTS_PER_PAGE.toString(), + sort: DEFAULT_SORT +}, { + addQueryPrefix: true +}) + + export const useBagPdok = (searchString?: string, options?: Options) => { const handleError = useErrorHandler() - const query = qs.stringify({ - q: searchString, - fq: `${ MUNICIPALITY_FILTER }${ ADDRESS_FILTER }`, - fl: FIELD_LIST, - start: START.toString(), - rows: RESULTS_PER_PAGE.toString(), - sort: DEFAULT_SORT - }, { - addQueryPrefix: true + const query = constructQuery(searchString) + + return useApiRequest({ + url: `${ PDOK_URL }/suggest${ query }`, + lazy: searchString === undefined, + ...options, + groupName: "dataPunt", + handleError }) +} + + +export const useBagPdokByBagId = (searchString?: string, options?: Options) => { + const handleError = useErrorHandler() + const query = constructQuery(searchString) + return useApiRequest({ - url: `${ PDOK_URL }${ query }`, + url: `${ PDOK_URL }/free${ query }`, lazy: searchString === undefined, ...options, groupName: "dataPunt", diff --git a/src/app/state/rest/custom/useOtherAddresses/useOtherAddresses.ts b/src/app/state/rest/custom/useOtherAddresses/useOtherAddresses.ts index aff5d7baf..2a85b3933 100644 --- a/src/app/state/rest/custom/useOtherAddresses/useOtherAddresses.ts +++ b/src/app/state/rest/custom/useOtherAddresses/useOtherAddresses.ts @@ -1,4 +1,4 @@ -import { useBagPdok } from "app/state/rest/index" +import { useBagPdok, useBagPdokByBagId } from "app/state/rest/index" import { getAddressFromBagPdokResponse } from "app/components/addresses/utils" /** @@ -6,7 +6,7 @@ import { getAddressFromBagPdokResponse } from "app/components/addresses/utils" * @param bagId */ const useOtherAddressesByBagId = (bagId: Components.Schemas.Address["bag_id"]) => { - const [data] = useBagPdok(bagId) + const [data] = useBagPdokByBagId(bagId) const foundAddress = getAddressFromBagPdokResponse(data) const searchQuery = `${ foundAddress?.postcode } ${ foundAddress?.huisnummer }` const [moreAddresses, otherAddressesMethods] = useBagPdok(searchQuery, { lazy: data === undefined }) diff --git a/src/app/state/rest/custom/usePanoramaByBagId/usePanoramaByBagId.ts b/src/app/state/rest/custom/usePanoramaByBagId/usePanoramaByBagId.ts index 4cfbcbc52..059da8b47 100644 --- a/src/app/state/rest/custom/usePanoramaByBagId/usePanoramaByBagId.ts +++ b/src/app/state/rest/custom/usePanoramaByBagId/usePanoramaByBagId.ts @@ -1,4 +1,4 @@ -import { useBagPdok, usePanorama } from "app/state/rest/index" +import { useBagPdokByBagId, usePanorama } from "app/state/rest/index" import { getAddressFromBagPdokResponse } from "app/components/addresses/utils" const extractLatLng = (point?: BAGPdokAddress["centroide_ll"]) => { @@ -18,7 +18,7 @@ const extractLatLng = (point?: BAGPdokAddress["centroide_ll"]) => { } const usePanoramaByBagId = (bagId: string, width: number | undefined, aspect: number | undefined, radius: number, fov: number | undefined) => { - const [data] = useBagPdok(bagId) + const [data] = useBagPdokByBagId(bagId) const foundAddress = getAddressFromBagPdokResponse(data) const latLng = extractLatLng(foundAddress?.centroide_ll) From 87618d0c21f321565fc6ec86bcbd8aca3a0c4d1d Mon Sep 17 00:00:00 2001 From: Remy van der Wereld Date: Thu, 21 Nov 2024 10:40:26 +0100 Subject: [PATCH 8/8] Ignore patch version updates in Dependabot and add documentation for PDOK API custom hook --- .github/dependabot.yml | 3 +++ src/app/state/rest/bagPdok.ts | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0b77a4369..078b78826 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,3 +10,6 @@ updates: schedule: interval: "daily" open-pull-requests-limit: 100 + ignore: + - dependency-name: "*" # This will ignore all dependencies + update-types: ["version-update:semver-patch"] diff --git a/src/app/state/rest/bagPdok.ts b/src/app/state/rest/bagPdok.ts index 01edd23eb..9758ba5ef 100644 --- a/src/app/state/rest/bagPdok.ts +++ b/src/app/state/rest/bagPdok.ts @@ -3,10 +3,15 @@ import { useErrorHandler } from "./hooks/utils/errorHandler" import useApiRequest from "./hooks/useApiRequest" import qs from "qs" +/** + * Custom hook to fetch data from the PDOK API using a search string. + * Difference between /free and /suggest endpoint is the speed and the search criteria + * /suggest is faster but you cannot search on bagId + */ + const PDOK_URL = "https://api.pdok.nl/bzk/locatieserver/search/v3_1" const MUNICIPALITY_FILTER = "gemeentenaam:(amsterdam)" const ADDRESS_FILTER = "AND (type:adres) AND (adrestype: hoofdadres)" -// const ADDRESS_SORT = "straatnaam asc, huisnummer asc, huisletter asc, huisnummertoevoeging asc" const DEFAULT_SORT = "score desc, weergavenaam asc" const FIELD_LIST = "weergavenaam,adrestype,gemeentenaam,nummeraanduiding_id,adresseerbaarobject_id,straatnaam,huisnummer,huisletter,huisnummertoevoeging,postcode,woonplaatsnaam,centroide_ll,score" const START = 0