From 38939db77917c9679311e6a793bd339b5f817a26 Mon Sep 17 00:00:00 2001 From: Audrius Vaitonis Date: Mon, 13 May 2024 09:23:01 +0100 Subject: [PATCH] feat(DTFS2-7052): code style improvements based on PR feedback --- .env.sample | 4 ++-- src/config/informatica.config.test.ts | 2 +- src/config/informatica.config.ts | 2 +- src/config/ordnance-survey.config.test.ts | 2 +- src/config/ordnance-survey.config.ts | 2 +- src/constants/enums/geospatialCountries.ts | 2 +- src/constants/geospatial.constant.ts | 1 + src/helper-modules/ordnance-survey/ordnance-survey.module.ts | 4 ++-- 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.env.sample b/.env.sample index 90bced05..536e7f69 100644 --- a/.env.sample +++ b/.env.sample @@ -38,11 +38,11 @@ APIM_INFORMATICA_URL= APIM_INFORMATICA_USERNAME= APIM_INFORMATICA_PASSWORD= APIM_INFORMATICA_MAX_REDIRECTS= -APIM_INFORMATICA_TIMEOUT= +APIM_INFORMATICA_TIMEOUT= # in milliseconds # ORDNANCE SURVEY # Use .uk domain, instead of .co.uk ORDNANCE_SURVEY_URL= ORDNANCE_SURVEY_KEY= ORDNANCE_SURVEY_MAX_REDIRECTS= -ORDNANCE_SURVEY_TIMEOUT= +ORDNANCE_SURVEY_TIMEOUT= # in milliseconds diff --git a/src/config/informatica.config.test.ts b/src/config/informatica.config.test.ts index 97cf8d24..84a59cad 100644 --- a/src/config/informatica.config.test.ts +++ b/src/config/informatica.config.test.ts @@ -31,7 +31,7 @@ describe('informaticaConfig', () => { { configPropertyName: 'timeout', environmentVariableName: 'APIM_INFORMATICA_TIMEOUT', - defaultConfigValue: 30000, + defaultConfigValue: 30000, // in milliseconds }, ]; diff --git a/src/config/informatica.config.ts b/src/config/informatica.config.ts index fdf9dc67..6860bddb 100644 --- a/src/config/informatica.config.ts +++ b/src/config/informatica.config.ts @@ -18,6 +18,6 @@ export default registerAs( username: process.env.APIM_INFORMATICA_USERNAME, password: process.env.APIM_INFORMATICA_PASSWORD, maxRedirects: getIntConfig(process.env.APIM_INFORMATICA_MAX_REDIRECTS, 5), - timeout: getIntConfig(process.env.APIM_INFORMATICA_TIMEOUT, 30000), + timeout: getIntConfig(process.env.APIM_INFORMATICA_TIMEOUT, 30000), // in milliseconds }), ); diff --git a/src/config/ordnance-survey.config.test.ts b/src/config/ordnance-survey.config.test.ts index 5b22020e..f077012d 100644 --- a/src/config/ordnance-survey.config.test.ts +++ b/src/config/ordnance-survey.config.test.ts @@ -27,7 +27,7 @@ describe('ordnanceSurveyConfig', () => { { configPropertyName: 'timeout', environmentVariableName: 'ORDNANCE_SURVEY_TIMEOUT', - defaultConfigValue: 30000, + defaultConfigValue: 30000, // in milliseconds }, ]; diff --git a/src/config/ordnance-survey.config.ts b/src/config/ordnance-survey.config.ts index e30acf8b..13da5637 100644 --- a/src/config/ordnance-survey.config.ts +++ b/src/config/ordnance-survey.config.ts @@ -16,6 +16,6 @@ export default registerAs( baseUrl: process.env.ORDNANCE_SURVEY_URL, key: process.env.ORDNANCE_SURVEY_KEY, maxRedirects: getIntConfig(process.env.ORDNANCE_SURVEY_MAX_REDIRECTS, 5), - timeout: getIntConfig(process.env.ORDNANCE_SURVEY_TIMEOUT, 30000), + timeout: getIntConfig(process.env.ORDNANCE_SURVEY_TIMEOUT, 30000), // in milliseconds }), ); diff --git a/src/constants/enums/geospatialCountries.ts b/src/constants/enums/geospatialCountries.ts index f181289d..d6a4df1f 100644 --- a/src/constants/enums/geospatialCountries.ts +++ b/src/constants/enums/geospatialCountries.ts @@ -1,6 +1,6 @@ export enum GeospatialCountriesEnum { E = 'England', + N = 'Northern Ireland', S = 'Scotland', W = 'Wales', - N = 'Northern Ireland', } diff --git a/src/constants/geospatial.constant.ts b/src/constants/geospatial.constant.ts index 567b89d2..d4d3102f 100644 --- a/src/constants/geospatial.constant.ts +++ b/src/constants/geospatial.constant.ts @@ -11,6 +11,7 @@ export const GEOSPATIAL = { }, REGEX: { // UK postcode regex is from DTFS project and slightly optimised by lint. + // https://github.com/UK-Export-Finance/dtfs2/blob/main/portal-api/src/constants/regex.js UK_POSTCODE: /^[A-Za-z]{1,2}[\dRr][\dA-Za-z]?\s?\d[ABD-HJLNP-UW-Zabd-hjlnp-uw-z]{2}$/, }, }; diff --git a/src/helper-modules/ordnance-survey/ordnance-survey.module.ts b/src/helper-modules/ordnance-survey/ordnance-survey.module.ts index 2afb21df..dc5f11ce 100644 --- a/src/helper-modules/ordnance-survey/ordnance-survey.module.ts +++ b/src/helper-modules/ordnance-survey/ordnance-survey.module.ts @@ -11,9 +11,9 @@ import { OrdnanceSurveyService } from './ordnance-survey.service'; imports: [ConfigModule], inject: [ConfigService], useFactory: (configService: ConfigService) => { - const { baseUrl, maxRedirects, timeout } = configService.get(ORDNANCE_SURVEY_CONFIG_KEY); + const { baseUrl: baseURL, maxRedirects, timeout } = configService.get(ORDNANCE_SURVEY_CONFIG_KEY); return { - baseURL: baseUrl, + baseURL, maxRedirects, timeout, };