Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag where permit is used #2618

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/modules/ar-analysis/lib/update-licence-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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...`)
Expand All @@ -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
Expand Down Expand Up @@ -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
Copy link
Collaborator Author

@jonathangoulding jonathangoulding Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This data is pulled from CSV in aws.

We have added seeders to what we have called reference data. This can be reference data.

A discussion need to had if we can store this data in git or needs to handle more securely.

await permitConnector.licences.updateOne(eachLicence.licence_id, {
date_gauging_station_links_last_copied: new Date()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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...`)
Expand All @@ -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
Expand Down Expand Up @@ -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
Copy link
Collaborator Author

@jonathangoulding jonathangoulding Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This work has been tagged to show it is used as part of the Digitize journey (Also known as AR and abstraction reform)

await permitConnector.licences.updateOne(eachLicence.licence_id, {
date_licence_version_purpose_conditions_last_copied: new Date()
})
Expand Down
2 changes: 1 addition & 1 deletion src/modules/licences/controllers/documents.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const getLicence = async (document, includeExpired, companyId) => {
}

throwIfUnauthorised(documentHeader, companyId)

// TODO: permit used here
Copy link
Collaborator Author

@jonathangoulding jonathangoulding Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can not establish where this is called (if it even is).

It is not in the Licence Summary pages as they use the licence module.

As we have migrated all the licence summary pages (tabs), if this call was used on the summary page it will no longer be needed when we remove the summary code, however nothing leads to believe they call this controller.

const licenceResponse = await permitClient.licences.findMany({
licence_id: documentHeader.system_internal_id,
licence_type_id: typeId,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/returns-notifications/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator Author

@jonathangoulding jonathangoulding Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is located in the Returns notification paper forms functionality.

I have created a paper for notification but i can not see this being called.

I could not trigger postPreviewReturnNotification or postReturnNotification using the UI.

This call can be replaced by extracting the REV_DATE, EXPIRY_DATE and LAPSED_DATE from water.licence

        dateRevoked: calendarToIso(row.licence_data_value.REV_DATE),
        dateExpired: calendarToIso(row.licence_data_value.EXPIRY_DATE),
        dateLapsed: calendarToIso(row.licence_data_value.LAPSED_DATE)

const licencesEndDates = await permitConnector.getLicenceEndDates(licenceRefs)

return {
Expand Down
1 change: 1 addition & 0 deletions src/modules/returns/lib/xml-adapter/mapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator Author

@jonathangoulding jonathangoulding Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can get this direct using the water.licences

As discussed. If the XML mapper is used (which we currently believe no customers are) then this code could be removed or updated.

This data can be retrieved from water.licences

const licenceRegionCodes = await permitConnector.getLicenceRegionCodes(licenceNumbers)

// Stage 2 - do basic mapping of XML data to returns
Expand Down
2 changes: 2 additions & 0 deletions src/modules/service-status/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ const getPermitCount = async () => {
licence_regime_id: 1,
licence_type_id: 8
}
// TODO: permit used here
return getCount(permitConnector.licences, filter)
}

Expand All @@ -139,6 +140,7 @@ const getVersions = async () => {
waterService: pkg.version,
idm: await idmConnector.getServiceVersion(),
crm: await crmServiceVersionConnector.getServiceVersion(),
// TODO: permit used here
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

potential dead - mark as dead

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The system repo has it's own implementation for checkign service statues.

This is now obsolete.

permit: await permitConnector.getServiceVersion(),
returns: await returnsConnector.getServiceVersion(),
import: await importConnector.getServiceVersion()
Expand Down
Loading