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

Create chargeVersionNotes table model, helper and view #1240

Merged
merged 27 commits into from
Aug 14, 2024

Conversation

rvsiyad
Copy link
Contributor

@rvsiyad rvsiyad commented Aug 7, 2024

https://eaflood.atlassian.net/browse/WATER-4566

While creating the tests for the Licence History page, we noticed we are missing the model and helper for the notes table. This is being referenced when extracting charge versions for a licence and any relating notes created. As a result, while creating the tests for the fetch-licence-history.service database errors occurred as a result of the unknown relation between the notes and charge versions table.

As well as adding the model and helper for the chargeVersionNotes table, the unit tests will also require the creation of the chargeVersionNotes table in the test database. This also gives us the opportunity to add the view for the chargeVersionNotes table to the public schema.

This PR will add the model, helper and the view for the notes table in the water schema.

While creating the tests for the [Licence History page](#1182),
we noticed we are missing the model and helper for the notes table. This is being referenced when extracting charge versions
for a licence and any relating notes created. As a result, while creating the tests for the `fetch-licence-history.service`
database errors occurred as a result of the unknown relation between the notes and charge versions table.

This PR will add the model and helper for the `notes` table in the water schema.
@rvsiyad rvsiyad added the housekeeping Refactoring, tidying up or other work which supports the project label Aug 7, 2024
@rvsiyad rvsiyad self-assigned this Aug 7, 2024
@rvsiyad rvsiyad changed the title Create notes table model and helper Create notes table view, model and helper Aug 7, 2024
@rvsiyad rvsiyad changed the title Create notes table view, model and helper Create notes table model, helper and view Aug 7, 2024
rvsiyad added a commit to DEFRA/water-abstraction-service that referenced this pull request Aug 12, 2024
* Fix type defaults on the water notes table

https://eaflood.atlassian.net/browse/WATER-4566

During the creation of the licence history page, we noticed we were missing the model and helper for the notes table.
This is being referenced when extracting charge versions for a licence and any relating notes created. This is being worked on
in the [Create notes table model, helper and view](DEFRA/water-abstraction-system#1240) in water-abstraction-system
repo.

While working on the change, we realised the notes table has fields that are unused:

- `licence_id` - is never populated
- `type` - is always set to 'charge-version'
- `type_id` - is set to the charge version's id and is not needed to link the two together

We do not include these fields in the view for the notes table that we will add to [water-abstraction-system](https://github.com/DEFRA/water-abstraction-system).
However, `type` and `type_id` are set as not-nullable. This change defaults type to 'charge-version' and`type_id` will remove the constraint.
@Cruikshanks Cruikshanks removed their request for review August 12, 2024 15:52
test/models/user.model.test.js Dismissed Show dismissed Hide dismissed
test/models/user.model.test.js Dismissed Show dismissed Hide dismissed
@rvsiyad rvsiyad marked this pull request as ready for review August 13, 2024 12:55
@rvsiyad rvsiyad requested a review from Cruikshanks August 13, 2024 12:55
Copy link
Member

@Cruikshanks Cruikshanks left a comment

Choose a reason for hiding this comment

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

Just seem to be some tests got overlooked/missed.

test/models/charge-version-note.model.test.js Outdated Show resolved Hide resolved
@rvsiyad rvsiyad requested a review from Cruikshanks August 14, 2024 10:17
@rvsiyad rvsiyad requested a review from Cruikshanks August 14, 2024 11:54
@rvsiyad rvsiyad changed the title Create notes table model, helper and view Create chargeVersionNotes table model, helper and view Aug 14, 2024
@rvsiyad rvsiyad merged commit 1daa183 into main Aug 14, 2024
6 checks passed
@rvsiyad rvsiyad deleted the add-notes-model-and-helper branch August 14, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Refactoring, tidying up or other work which supports the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants