Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://eaflood.atlassian.net/browse/WATER-4546 > Part of the work to migrate management of return versions to WRLS from NALD During the import from NALD, if a licence end date is changed, for example, it has been revoked in NALD our return versions functionality needs to know about it. This is so we can reissue the return logs for the licence in order to match the changed end date. We are actively trying to move away from the legacy code base, so this work was always going to be done in [water-abstraction-system](https://github.com/DEFRA/water-abstraction-system). Initially, it was going to be triggered by our [own import process that was due to replace the legacy one](https://eaflood.atlassian.net/browse/WATER-4535). But that was when we thought ReSP would be taking over from NALD. Now the plan is WRLS will encompass the final abstraction leg and takeover from NALD. There is little point in replacing a complex import we intend to switch off in the next year. But, knowing we'd need something in the interim we created the `/jobs/licence-changes` job in **water-abstraction-system**. The intent was to schedule this after the first NALD import job had completed (that one that downloads and extracts the NALD data), but before the main licence import job. That way our job could compare the NALD and WRLS licence records in order to determine if an end date has changed. But then we had our 'doh!' moment. Our reissue return logs engine expects to be given a licence ID and date the change applies. But it needs the WRLS licence record to have been updated in order to determine what the new return logs start and end dates should be. If we schedule `/jobs/licence-changes` before the licence import job, it will see the change but won't reissue anything because the WRLS record won't have been updated. If we schedule it after, it won't see any different so won't trigger the reissue. Doh! So, we've needed to completely change tact on this. Now we intend to - _trigger_ `/jobs/licence-changes` (though we'll move the it to a different endpoint as it will no longer be a job) from the [water-abstraction-import](https://github.com/DEFRA/water-abstraction-import) NALD import job rather than schedule it - update `/jobs/licence-changes` to store the details of changed licences in a new table - add a new endpoint that processes these 'licence change' records, and which can be triggered from the **water-abstraction-import** main licence import job This change is needed to create the new table in the `water` schema.
- Loading branch information