From dfd061b6c53b3848caffd3454df205c0f51112c9 Mon Sep 17 00:00:00 2001 From: jonathangoulding Date: Tue, 20 Aug 2024 11:49:38 +0100 Subject: [PATCH 1/2] Tag where permit is used --- src/modules/ar-analysis/lib/update-licence-row.js | 1 + .../jobs/sync-licence-gauging-stations-from-digitise.js | 3 +++ .../sync-licence-version-purpose-conditions-from-digitise.js | 4 +++- src/modules/returns-notifications/controller.js | 2 +- src/modules/returns/lib/xml-adapter/mapper.js | 1 + src/modules/service-status/controller.js | 2 ++ 6 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/modules/ar-analysis/lib/update-licence-row.js b/src/modules/ar-analysis/lib/update-licence-row.js index 011cb7f4b..a7315968d 100644 --- a/src/modules/ar-analysis/lib/update-licence-row.js +++ b/src/modules/ar-analysis/lib/update-licence-row.js @@ -88,6 +88,7 @@ const updateLicenceRow = async (licenceRef) => { */ const updateAllLicences = async () => { const filter = getLicenceTypeFilter(abstractionReform) + // TODO: used here - ar analysis const results = await permit.licences.findAll(filter, {}, ['licence_ref']) for (const row of results) { const { licence_ref: licenceNumber } = row diff --git a/src/modules/gauging-stations/jobs/sync-licence-gauging-stations-from-digitise.js b/src/modules/gauging-stations/jobs/sync-licence-gauging-stations-from-digitise.js index e566e6591..978f866bf 100644 --- a/src/modules/gauging-stations/jobs/sync-licence-gauging-stations-from-digitise.js +++ b/src/modules/gauging-stations/jobs/sync-licence-gauging-stations-from-digitise.js @@ -32,6 +32,7 @@ const handler = async () => { // Find out which licences need to be processed // Call the permit repo, and fetch any licence refs plus licence_data_value // where permit.licence.date_licence_version_purpose_conditions_last_copied is either null or before today + // TODO: permit used here const licences = await permitConnector.licences.getWaterLicencesThatHaveGaugingStationLinkagesThatNeedToBeCopiedFromDigitise() logger.info(`Found ${licences.length} candidate licences that have licence gauging station linkages that may be copied from digitise...`) @@ -42,6 +43,7 @@ const handler = async () => { if (edits.status === 'Approved') { logger.info(`Processing ${eachLicence.licence_ref}: Status is approved...`) // Take the permit data, and put it through the Digitise reducer + // TODO: permit used here const originalLicence = await permitConnector.licences.getWaterLicence(eachLicence.licence_ref) const initialState = originalLicence && digitise.getInitialState(originalLicence) const hasData = initialState.licence.data.current_version !== undefined @@ -128,6 +130,7 @@ const handler = async () => { // For the successful records, // mark them as processed by updating the datestamp // in permit.licence.date_licence_version_purpose_conditions_last_copied + // TODO: permit used here await permitConnector.licences.updateOne(eachLicence.licence_id, { date_gauging_station_links_last_copied: new Date() }) diff --git a/src/modules/gauging-stations/jobs/sync-licence-version-purpose-conditions-from-digitise.js b/src/modules/gauging-stations/jobs/sync-licence-version-purpose-conditions-from-digitise.js index bc0c610db..3a060c4df 100644 --- a/src/modules/gauging-stations/jobs/sync-licence-version-purpose-conditions-from-digitise.js +++ b/src/modules/gauging-stations/jobs/sync-licence-version-purpose-conditions-from-digitise.js @@ -33,6 +33,7 @@ const handler = async () => { // Find out which licences need to be processed // Call the permit repo, and fetch any licence refs plus licence_data_value // where permit.licence.date_licence_version_purpose_conditions_last_copied is either null or before today + // TODO: permit used here const licences = await permitConnector.licences.getWaterLicencesThatHaveConditionsThatNeedToBeCopiedFromDigitise() logger.info(`Found ${licences.length} candidate licences that have licence version purpose conditions that may be copied from digitise...`) @@ -44,6 +45,7 @@ const handler = async () => { if (edits.status === 'Approved') { logger.info(`Processing ${eachLicence.licence_ref}: Status is approved...`) // Take the permit data, and put it through the Digitise reducer + // TODO: permit used here const originalLicence = await permitConnector.licences.getWaterLicence(eachLicence.licence_ref) const initialState = originalLicence && digitise.getInitialState(originalLicence) const hasData = initialState.licence.data.current_version !== undefined @@ -71,7 +73,7 @@ const handler = async () => { // For the successful records, // mark them as processed by updating the datestamp // in permit.licence.date_licence_version_purpose_conditions_last_copied - + // TODO: permit used here await permitConnector.licences.updateOne(eachLicence.licence_id, { date_licence_version_purpose_conditions_last_copied: new Date() }) diff --git a/src/modules/returns-notifications/controller.js b/src/modules/returns-notifications/controller.js index 54b9c85d0..ad171a64f 100644 --- a/src/modules/returns-notifications/controller.js +++ b/src/modules/returns-notifications/controller.js @@ -21,7 +21,7 @@ const postPreviewReturnNotification = async (request, h) => { // Create a new set to remove any duplicate values const licenceRefs = [...new Set(data.map(item => item.licence_ref))] - + // TODO: permit used here const licencesEndDates = await permitConnector.getLicenceEndDates(licenceRefs) return { diff --git a/src/modules/returns/lib/xml-adapter/mapper.js b/src/modules/returns/lib/xml-adapter/mapper.js index fc0f00966..278d6f78f 100644 --- a/src/modules/returns/lib/xml-adapter/mapper.js +++ b/src/modules/returns/lib/xml-adapter/mapper.js @@ -263,6 +263,7 @@ const mapXml = async (xmlStr, user, today) => { // Stage 1 - get licence numbers and region codes const permits = getPermitsFromXml(xmlDoc) const licenceNumbers = getLicenceNumbersFromPermits(permits) + // TODO: permit used here const licenceRegionCodes = await permitConnector.getLicenceRegionCodes(licenceNumbers) // Stage 2 - do basic mapping of XML data to returns diff --git a/src/modules/service-status/controller.js b/src/modules/service-status/controller.js index a5c60702a..240e603ad 100644 --- a/src/modules/service-status/controller.js +++ b/src/modules/service-status/controller.js @@ -131,6 +131,7 @@ const getPermitCount = async () => { licence_regime_id: 1, licence_type_id: 8 } + // TODO: permit used here return getCount(permitConnector.licences, filter) } @@ -139,6 +140,7 @@ const getVersions = async () => { waterService: pkg.version, idm: await idmConnector.getServiceVersion(), crm: await crmServiceVersionConnector.getServiceVersion(), + // TODO: permit used here permit: await permitConnector.getServiceVersion(), returns: await returnsConnector.getServiceVersion(), import: await importConnector.getServiceVersion() From a9459656e43748e3a9a593ccef0d31a75172ee4d Mon Sep 17 00:00:00 2001 From: jonathangoulding Date: Tue, 20 Aug 2024 11:53:50 +0100 Subject: [PATCH 2/2] Tag where permit is used --- src/modules/licences/controllers/documents.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/licences/controllers/documents.js b/src/modules/licences/controllers/documents.js index d7a04a015..f9286bc76 100644 --- a/src/modules/licences/controllers/documents.js +++ b/src/modules/licences/controllers/documents.js @@ -66,7 +66,7 @@ const getLicence = async (document, includeExpired, companyId) => { } throwIfUnauthorised(documentHeader, companyId) - + // TODO: permit used here const licenceResponse = await permitClient.licences.findMany({ licence_id: documentHeader.system_internal_id, licence_type_id: typeId,