Skip to content

Commit

Permalink
feat(DTFS-7052): added GET /geospatial/addresses/postcode endpoint …
Browse files Browse the repository at this point in the history
…for Ordnance Survey API data (#804)

## Introduction ✏️
We are moving integration with Ordnance Survey API from DTFS to MDM API.

## Resolution ✔️
* Added new helper module `ordnance-survey`
* Added new module `geospatial` with endpoint
`/geospatial/addresses/postcode?postcode=SW1A2AQ`
  * returns same response format as DTFS.
  * returns `country` field, DTFS was always returning `{country: null}`
  * returns 200 [] for empty unsuccessful search.

Response example:
```
[
    {
        "organisationName": "CHURCHILL MUSEUM & CABINET WAR ROOMS",
        "addressLine1": "CLIVE STEPS KING CHARLES STREET",
        "addressLine2": null,
        "addressLine3": null,
        "locality": "LONDON",
        "postalCode": "SW1A 2AQ",
        "country": "England"
    }
]
```


## Miscellaneous ➕
* Refactored `api-tests` to solve typescript type error. Looks like it
started because of `supertest` update.
  • Loading branch information
avaitonis committed May 13, 2024
2 parents 102e5c2 + 0da25c3 commit 4963371
Show file tree
Hide file tree
Showing 52 changed files with 3,625 additions and 2,235 deletions.
14 changes: 13 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,19 @@
"ukef",
"venv",
"VNET",
"CICD"
"CICD",
"DPA",
"UPRN",
"UDPRN",
"BLPU",
"TOID",
"EPSG",
"WOGAN",
"osgb",
"HJLNP",
"Zabd",
"hjlnp",
"BLPUs"
],
"dictionaries": [
"en-gb",
Expand Down
8 changes: 7 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,10 @@ APIM_INFORMATICA_URL=
APIM_INFORMATICA_USERNAME=
APIM_INFORMATICA_PASSWORD=
APIM_INFORMATICA_MAX_REDIRECTS=
APIM_INFORMATICA_TIMEOUT=
APIM_INFORMATICA_TIMEOUT= # in milliseconds

# ORDNANCE SURVEY
ORDNANCE_SURVEY_URL=https://api.os.uk
ORDNANCE_SURVEY_KEY=
ORDNANCE_SURVEY_MAX_REDIRECTS=
ORDNANCE_SURVEY_TIMEOUT= # in milliseconds
9 changes: 6 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
"plugin:eslint-comments/recommended",
"plugin:optimize-regex/recommended",
"plugin:switch-case/recommended",
"plugin:security/recommended",
"plugin:security/recommended-legacy",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier"
],
"parserOptions": {
"project": "tsconfig.json",
"ecmaVersion": 2020,
"ecmaVersion": "latest",
"sourceType": "module"
},
"env": {
Expand Down Expand Up @@ -110,7 +110,10 @@
"consistent-return": "off",
"no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": "error",
"unused-imports/no-unused-vars": [
"error",
{ "vars": "all", "varsIgnorePattern": "^_", "args": "after-used", "argsIgnorePattern": "^_" }
],
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,7 @@ The most important prefixes you should have in mind are:
1. `fix:` which represents bug fixes, and correlates to a [SemVer](https://semver.org/) **patch**.
2. `feat:` which represents a new feature, and correlates to a [SemVer](https://semver.org/) **minor**.
3. `feat!:`, `fix!:` or `refactor!:`, etc., which represent a breaking change (indicated by the `!`) and will result in a [SemVer](https://semver.org/) **major**.

### Special notes for .env settings

- ORDNANCE_SURVEY_URL - Domain [https://api.os.co.uk](https://api.os.co.uk) redirects to [https://api.os.uk](https://api.os.uk), so please use [https://api.os.uk](https://api.os.uk).
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ services:
APIM_INFORMATICA_PASSWORD:
APIM_INFORMATICA_MAX_REDIRECTS:
APIM_INFORMATICA_TIMEOUT:
ORDNANCE_SURVEY_URL:
ORDNANCE_SURVEY_KEY:
ORDNANCE_SURVEY_MAX_REDIRECTS:
ORDNANCE_SURVEY_TIMEOUT:
API_KEY:
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:${PORT}"]
Expand Down
1 change: 1 addition & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const defaultSettings = {
'@ukef/config/(.*)': '<rootDir>/../src/config/$1',
'@ukef/database/(.*)': '<rootDir>/../src/modules/database/$1',
'@ukef/helpers/(.*)': '<rootDir>/../src/helpers/$1',
'@ukef/helper-modules/(.*)': '<rootDir>/../src/helper-modules/$1',
'@ukef/modules/(.*)': '<rootDir>/../src/modules/$1',
'@ukef/auth/(.*)': '<rootDir>/../src/modules/auth/$1',
'@ukef/(.*)': '<rootDir>/../src/$1',
Expand Down
Loading

0 comments on commit 4963371

Please sign in to comment.