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

PO-755 Loaded business units from Legacy GoB into Opal BUSINESS_UNITS… #532

Merged
merged 3 commits into from
Sep 16, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Feature: tests for changes to postedBy and postedByAAD
Given I am testing as the "[email protected]" user
When I make a request to the defendant account add notes api with
| associatedRecordId | 500000010 |
| businessUnitId | 71 |
| businessUnitId | 73 |
| noteText | test postedBy and PostedByAAD Opal user1 |
And the add notes response contains
| associatedRecordId | 500000010 |
Expand All @@ -23,7 +23,7 @@ Feature: tests for changes to postedBy and postedByAAD
Given I am testing as the "[email protected]" user
When I make a request to the defendant account add notes api with
| associatedRecordId | 500000010 |
| businessUnitId | 60 |
| businessUnitId | 26 |
| noteText | test postedBy and PostedByAAD Opal user3 |
And the add notes response contains
| associatedRecordId | 500000010 |
Expand All @@ -34,7 +34,7 @@ Feature: tests for changes to postedBy and postedByAAD
Given I am testing as the "[email protected]" user
When I make a request to the defendant account add notes api with
| associatedRecordId | 500000010 |
| businessUnitId | 43 |
| businessUnitId | 47 |
| noteText | test postedBy and PostedByAAD Opal user4 |
And the add notes response contains
| associatedRecordId | 500000010 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ Feature: tests for notes roles/permissions for accounts dependant on business un
Given I am testing as the "[email protected]" user
When I make a request to the defendant account add notes api with
| associatedRecordId | 500000010 |
| businessUnitId | 71 |
| businessUnitId | 73 |
| noteText | test roles and perms Opal user1 |
And the add notes response contains
| associatedRecordId | 500000010 |
| noteText | test roles and perms Opal user1 |
| postedBy | L073JG |
| postedByUserId | 500000000 |
| businessUnitId | 71 |
| businessUnitId | 73 |


When I make a request to the defendant account add notes api with
| associatedRecordId | 500000010 |
| businessUnitId | 69 |
| businessUnitId | 77 |
| noteText | test roles and perms Opal user1 |
And the add notes response contains
| associatedRecordId | 500000010 |
| noteText | test roles and perms Opal user1 |
| postedBy | L078JG |
| postedBy | L067JG |
| postedByUserId | 500000000 |
| businessUnitId | 69 |
| businessUnitId | 77 |

Scenario: A user cannot add a note to a business unit it is not part of
Given I am testing as the "[email protected]" user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ Feature: Authorisation on endpoints
Given I am testing as the "[email protected]" user
When I make a request to the defendant account add notes api with
| associatedRecordId | 500000010 |
| businessUnitId | 71 |
| businessUnitId | 73 |
| noteText | test roles and perms Opal user1 |
And the add notes response contains
| associatedRecordId | 500000010 |
| noteText | test roles and perms Opal user1 |
| postedBy | L073JG |
| postedByUserId | 500000000 |
| businessUnitId | 71 |
| businessUnitId | 73 |

Given I am testing as the "[email protected]" user
When I make a request to the defendant account add notes api with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Feature: Test the add note endpoint for Opal PO-139
Given I am testing as the "[email protected]" user
When I make a request to the defendant account add notes api with
| associatedRecordId | 500000000 |
| businessUnitId | 71 |
| businessUnitId | 73 |
| noteText | test account note Opal |
Then the add notes response contains
| associatedRecordId | 500000000 |
Expand All @@ -14,7 +14,7 @@ Feature: Test the add note endpoint for Opal PO-139
Given I am testing as the "[email protected]" user
When I make a request to the defendant account add notes api with
| associatedRecordId | 500000001 |
| businessUnitId | 71 |
| businessUnitId | 73 |
| noteText | test account note2 Opal |
And the add notes response contains
| associatedRecordId | 500000001 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Feature: Major Creditors Api returns Business unit level Data
| majorCreditorId | 15 |
| name | CHESTERFIELD BOROUGH COUNCIL |
| majorCreditorCode | CHBC |
| businessUnitId | 49 |
| businessUnitId | 10 |


@Opal @PO-421
Expand All @@ -19,4 +19,4 @@ Feature: Major Creditors Api returns Business unit level Data
| majorCreditorId | 15 |
| name | CHESTERFIELD BOROUGH COUNCIL |
| majorCreditorCode | CHBC |
| businessUnitId | 49 |
| businessUnitId | 10 |
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Feature: PO-559 get draft account
| account_snapshot.DateOfBirth | 01/01/2000 |
| account_snapshot.AccountType | Fine |
| account_snapshot.SubmittedBy | [email protected] |
| account_snapshot.BusinessUnitName | MBEC London |
| account_snapshot.BusinessUnitName | West London |

Then I delete the created draft accounts

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Feature: PO-591 create draft account
| account_snapshot.DateOfBirth | 01/01/2000 |
| account_snapshot.AccountType | Fine |
| account_snapshot.SubmittedBy | [email protected] |
| account_snapshot.BusinessUnitName | MBEC London |
| account_snapshot.BusinessUnitName | West London |

Then I delete the created draft accounts

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/**
* OPAL Program
*
* MODULE : cleanup_for_business_units.sql
*
* DESCRIPTION : Clean up the data in the BUSINESS_UNITS table in order to be able to load Business Units Reference Data from the Legacy GoB environment.
*
* VERSION HISTORY:
*
* Date Author Version Nature of Change
* ---------- ------- -------- -----------------------------------------------------------------------------------------------------------------------------------------------
* 10/09/2024 A Dennis 1.0 PO-755 Clean up the data in the BUSINESS_UNITS table in order to be able to load Business Units Reference Data from the Legacy GoB environment.
*
**/

-- Drop these constraints. They will be restored unsing other scripts after the load.

ALTER TABLE business_unit_users
DROP constraint IF EXISTS buu_business_unit_id_fk;

ALTER TABLE configuration_items
DROP constraint IF EXISTS ci_business_unit_id_fk;

ALTER TABLE courts
DROP constraint IF EXISTS crt_business_unit_id_fk;

ALTER TABLE defendant_accounts
DROP constraint IF EXISTS da_business_unit_id_fk;

ALTER TABLE defendant_accounts
DROP constraint IF EXISTS da_imposing_court_id_fk;

ALTER TABLE defendant_accounts
DROP constraint IF EXISTS da_enforcing_court_id_fk;

ALTER TABLE defendant_accounts
DROP constraint IF EXISTS da_last_hearing_court_id_fk;

ALTER TABLE document_instances
DROP constraint IF EXISTS di_business_unit_id_fk;

ALTER TABLE enforcers
DROP constraint IF EXISTS enf_business_unit_id_fk;

ALTER TABLE prisons
DROP constraint IF EXISTS pri_business_unit_id_fk;

ALTER TABLE tills
DROP constraint IF EXISTS till_business_unit_id_fk;

ALTER TABLE offences
DROP constraint IF EXISTS off_business_unit_id_fk;

ALTER TABLE major_creditors
DROP constraint IF EXISTS mc_business_unit_id_fk;

-- Remove the mocked up data that are not used
DELETE FROM account_transfers;
DELETE FROM document_instances;
DELETE FROM prisons;
DELETE FROM payments_in;
DELETE FROM tills;
DELETE FROM business_units;
Loading