Skip to content

Commit

Permalink
PO-127 Abraham added more table scripts for Discovery plus in opal fi…
Browse files Browse the repository at this point in the history
…nes (#73)

* PO-127 Abraham added more table scripts for Discvery plus in opal fines

* Update suppressions.xml

---------

Co-authored-by: Sabah u Din Irfan <sabah.irfan@gmail.com>
  • Loading branch information
abrahamdennis and sabahirfan authored Dec 6, 2023
1 parent dbfb4ca commit 96547e8
Show file tree
Hide file tree
Showing 42 changed files with 1,608 additions and 1 deletion.
7 changes: 6 additions & 1 deletion config/owasp/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
<!--End of false positives section -->

<!--Please add Temporary suppression here-->


<suppress until="2024-01-14">
<notes>Need a Spring boot update to fix</notes>
<cve>CVE-2023-6378</cve>
</suppress>

<!--End of Temporary suppression section -->

</suppressions>
33 changes: 33 additions & 0 deletions src/main/resources/db/migration/V20231203_008__business_units.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* CGI OPAL Program
*
* MODULE : business_units.sql
*
* DESCRIPTION : Creates the BUSINESS_UNITS table for the Fines model
*
* VERSION HISTORY:
*
* Date Author Version Nature of Change
* ---------- ------- -------- ----------------------------------------------------------------------------
* 03/12/2023 A Dennis 1.0 PO-127 Creates the BUSINESS_UNITS table for the Fines model
*
**/
CREATE TABLE business_units
(
business_unit_id smallint not null
,business_unit_name varchar(200) not null
,business_unit_code varchar(4)
,business_unit_type varchar(20) not null
,account_number_prefix varchar(2)
,parent_business_unit_id smallint
,CONSTRAINT business_unit_id_pk PRIMARY KEY
(
business_unit_id
)
);
COMMENT ON COLUMN business_units.business_unit_id IS 'Unique ID of this record';
COMMENT ON COLUMN business_units.business_unit_name IS 'Business Unit name';
COMMENT ON COLUMN business_units.business_unit_code IS 'Business unit code';
COMMENT ON COLUMN business_units.business_unit_type IS 'Area or Accounting Division';
COMMENT ON COLUMN business_units.account_number_prefix IS 'Accounting division code that appears before account numbers';
COMMENT ON COLUMN business_units.parent_business_unit_id IS 'ID of the business unit that is the parent for this one';
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* OPAL Program
*
* MODULE : business_unit_id_seq.sql
*
* DESCRIPTION : Creates the Sequence to be used to generate the Primary key for the table BUSINESS_UNITS.
*
* VERSION HISTORY:
*
* Date Author Version Nature of Change
* ---------- ------- -------- ---------------------------------------------------------------------------------------------------------
* 03/12/2023 A Dennis 1.0 PO-127 Creates the Sequence to be used to generate the Primary key for the table BUSINESS_UNITS
*
**/
CREATE SEQUENCE IF NOT EXISTS business_unit_id_seq INCREMENT 1 MINVALUE 1 NO MAXVALUE START WITH 1 CACHE 20 OWNED BY business_units.business_unit_id;
72 changes: 72 additions & 0 deletions src/main/resources/db/migration/V20231203_010__courts.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* CGI OPAL Program
*
* MODULE : courts.sql
*
* DESCRIPTION : Creates the COURTS table for the Fines model
*
* VERSION HISTORY:
*
* Date Author Version Nature of Change
* ---------- ------- -------- ----------------------------------------------------------------------------
* 03/12/2023 A Dennis 1.0 PO-127 Creates the COURTS table for the Fines model
*
**/
CREATE TABLE courts
(
court_id bigint not null
,business_unit_id smallint not null
,court_code smallint not null
,parent_court_id bigint
,name varchar(35) not null
,name_cy varchar(35)
,address_line_1 varchar(35)
,address_line_2 varchar(35)
,address_line_3 varchar(35)
,address_line_1_cy varchar(35)
,address_line_2_cy varchar(35)
,address_line_3_cy varchar(35)
,postcode varchar(8)
,local_justice_area_id smallint not null
,national_court_code varchar(7)
,CONSTRAINT court_id_pk PRIMARY KEY
(
court_id
)
);

ALTER TABLE courts
ADD CONSTRAINT crt_business_unit_id_fk FOREIGN KEY
(
business_unit_id
)
REFERENCES business_units
(
business_unit_id
);

ALTER TABLE courts
ADD CONSTRAINT crt_parent_court_id_fk FOREIGN KEY
(
parent_court_id
)
REFERENCES courts
(
court_id
);

COMMENT ON COLUMN courts.court_id IS 'Unique ID of this record';
COMMENT ON COLUMN courts.business_unit_id IS 'ID of the relating till to which this till belongs';
COMMENT ON COLUMN courts.court_code IS 'Court code unique within the business unit';
COMMENT ON COLUMN courts.parent_court_id IS 'ID of parent court for enforcement/admin purposes';
COMMENT ON COLUMN courts.name IS 'Court name';
COMMENT ON COLUMN courts.name_cy IS 'Court name in welsh';
COMMENT ON COLUMN courts.address_line_1 IS 'Court address line 1';
COMMENT ON COLUMN courts.address_line_2 IS 'Court address line 2';
COMMENT ON COLUMN courts.address_line_3 IS 'Court address line 3, not stored in legacy GoB';
COMMENT ON COLUMN courts.address_line_1_cy IS 'Court address line 1 in welsh';
COMMENT ON COLUMN courts.address_line_2_cy IS 'Court address line 2 in welsh';
COMMENT ON COLUMN courts.address_line_3_cy IS 'Court address line 3 in welsh, not stored in legacy GoB';
COMMENT ON COLUMN courts.postcode IS 'Court postcode, not stored in legacy GoB';
COMMENT ON COLUMN courts.local_justice_area_id IS 'Local justice area ID';
COMMENT ON COLUMN courts.national_court_code IS 'National court location code (OU code). New field for future development with Common Platform';
15 changes: 15 additions & 0 deletions src/main/resources/db/migration/V20231203_011__court_id_seq.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* OPAL Program
*
* MODULE : court_id_seq.sql
*
* DESCRIPTION : Creates the Sequence to be used to generate the Primary key for the table COURTS.
*
* VERSION HISTORY:
*
* Date Author Version Nature of Change
* ---------- ------- -------- ---------------------------------------------------------------------------------------------------------
* 03/12/2023 A Dennis 1.0 PO-127 Creates the Sequence to be used to generate the Primary key for the table COURTS
*
**/
CREATE SEQUENCE IF NOT EXISTS court_id_seq INCREMENT 1 MINVALUE 1 NO MAXVALUE START WITH 1 CACHE 20 OWNED BY courts.court_id;
68 changes: 68 additions & 0 deletions src/main/resources/db/migration/V20231203_012__results.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* CGI OPAL Program
*
* MODULE : results.sql
*
* DESCRIPTION : Creates the RESULTS table for the Fines model
*
* VERSION HISTORY:
*
* Date Author Version Nature of Change
* ---------- ------- -------- ----------------------------------------------------------------------------
* 03/12/2023 A Dennis 1.0 PO-127 Creates the RESULTS table for the Fines model
*
**/
CREATE TABLE results
(
result_id varchar(6) not null
,result_title varchar(50) not null
,result_title_cy varchar(50) not null
,result_type varchar(10) not null
,active boolean not null
,imposition boolean not null
,imposition_category varchar(30)
,imposition_allocation_priority smallint
,imposition_accruing boolean
,imposition_creditor varchar(10)
,enforcement boolean not null
,enforcement_override boolean not null
,further_enforcement_warn boolean not null
,further_enforcement_disallow boolean not null
,enforcement_hold boolean not null
,requires_enforcer boolean not null
,generates_hearing boolean not null
,collection_order boolean not null
,extend_ttp_disallow boolean not null
,extend_ttp_preserve_last_enf boolean not null
,prevent_payment_card boolean not null
,lists_monies boolean not null
,user_entries json
,CONSTRAINT result_id_pk PRIMARY KEY
(
result_id
)
);

COMMENT ON COLUMN results.result_id IS 'Unique ID of this result';
COMMENT ON COLUMN results.result_title IS 'Result title';
COMMENT ON COLUMN results.result_title_cy IS 'Result title';
COMMENT ON COLUMN results.result_type IS 'Indicates if this is an acutal result or just an action. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.active IS 'Indicates if this result can be applied to new accounts. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.imposition IS 'Indicates if this result creates an imposition. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.imposition_category IS 'Financial category that monies for this imposition are reported under. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.imposition_allocation_priority IS 'Determines the order in which monies received are allocated to this impsition with respect to other impositions on the same account. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.imposition_accruing IS 'Indicates if this result is an imposition that accrues with time. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.imposition_creditor IS 'Indicates the creditor to be used for the imposition. Can be either Central (Central Fund Account), DPP (Crown Prosection Service), !DPP (a creditor other than DPP) or Any (any creditor). New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.enforcement IS 'Indicates if this result is an enforcement result. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.enforcement_override IS 'Indicates if this result can be used as an enforcement override. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.further_enforcement_warn IS 'Indicates if a warning should be issued when applying an enforcement action while this is the last enforcement on the account. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.further_enforcement_disallow IS 'Indicates if the system should prevent applying an enforcement action while this is the last enforcement on the account. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.enforcement_hold IS 'Indicates if this action places a hold on enforcement which requires it to be explicity removed to continue further enforcement on the account. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.requires_enforcer IS 'Indicates if this result requires the user to also specify an enforcer. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.generates_hearing IS 'Indicates if applying this action should attempt to schedule an enforcement hearing for the account debtor. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.collection_order IS 'Indicates if this result is a collection order result. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.extend_ttp_disallow IS 'Indicates if this result should prevent extension of payment terms. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.extend_ttp_preserve_last_enf IS 'Indicates if this should be preserved as the last enforcement on an account after extending payment instead of clearing it. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.prevent_payment_card IS 'Indicates if this result should prevent requesting a payment card if it is the last enforcement on an account. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.lists_monies IS 'this result cause the account to be reported on List Monies Under Warrant if a payment is received while this is the last enforcement action on the account. New field. Hard-coded in legacy GoB';
COMMENT ON COLUMN results.user_entries IS 'The parameters required to be input by the user when applyig this result. New field. Hard-coded in legacy GoB';
15 changes: 15 additions & 0 deletions src/main/resources/db/migration/V20231203_013__result_id_seq.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* OPAL Program
*
* MODULE : result_id_seq.sql
*
* DESCRIPTION : Creates the Sequence to be used to generate the Primary key for the table RESULTS.
*
* VERSION HISTORY:
*
* Date Author Version Nature of Change
* ---------- ------- -------- ---------------------------------------------------------------------------------------------------------
* 03/12/2023 A Dennis 1.0 PO-127 Creates the Sequence to be used to generate the Primary key for the table RESULTS
*
**/
CREATE SEQUENCE IF NOT EXISTS result_id_seq INCREMENT 1 MINVALUE 1 NO MAXVALUE START WITH 1 CACHE 20 OWNED BY results.result_id;
60 changes: 60 additions & 0 deletions src/main/resources/db/migration/V20231204_014__enforcers.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* CGI OPAL Program
*
* MODULE : enforcers.sql
*
* DESCRIPTION : Creates the ENFORCERS table for the Fines model
*
* VERSION HISTORY:
*
* Date Author Version Nature of Change
* ---------- ------- -------- ----------------------------------------------------------------------------
* 04/12/2023 A Dennis 1.0 PO-127 Creates the ENFORCERS table for the Fines model
*
**/
CREATE TABLE enforcers
(
enforcer_id bigint not null
,business_unit_id smallint not null
,enforcer_code smallint not null
,name varchar(35) not null
,name_cy varchar(35)
,address_line_1 varchar(35)
,address_line_2 varchar(35)
,address_line_3 varchar(35)
,address_line_1_cy varchar(35)
,address_line_2_cy varchar(35)
,address_line_3_cy varchar(35)
,postcode varchar(8)
,warrant_reference_sequence varchar(20)
,warrant_register_sequence integer
,CONSTRAINT enforcer_id_pk PRIMARY KEY
(
enforcer_id
)
);

ALTER TABLE enforcers
ADD CONSTRAINT enf_business_unit_id_fk FOREIGN KEY
(
business_unit_id
)
REFERENCES business_units
(
business_unit_id
);

COMMENT ON COLUMN enforcers.enforcer_id IS 'Unique ID of this record';
COMMENT ON COLUMN enforcers.business_unit_id IS 'ID of the relating till to which this till belongs';
COMMENT ON COLUMN enforcers.enforcer_code IS 'Enforcer code unique within the business unit';
COMMENT ON COLUMN enforcers.name IS 'Enforcer name';
COMMENT ON COLUMN enforcers.name_cy IS 'Enforcer name in welsh';
COMMENT ON COLUMN enforcers.address_line_1 IS 'Enforcer address line 1';
COMMENT ON COLUMN enforcers.address_line_2 IS 'Enforcer address line 2';
COMMENT ON COLUMN enforcers.address_line_3 IS 'Enforcer address line 3';
COMMENT ON COLUMN enforcers.address_line_1_cy IS 'Enforcer address line 1 in welsh';
COMMENT ON COLUMN enforcers.address_line_2_cy IS 'Enforcer address line 2 in welsh';
COMMENT ON COLUMN enforcers.address_line_3_cy IS 'Enforcer address line 3 in welsh';
COMMENT ON COLUMN enforcers.postcode IS 'Enforcer postcode';
COMMENT ON COLUMN enforcers.warrant_reference_sequence IS 'Last generated warrant reference for this enforcer';
COMMENT ON COLUMN enforcers.warrant_register_sequence IS 'Last generated warrant register serial number for this enforcer';
15 changes: 15 additions & 0 deletions src/main/resources/db/migration/V20231204_015__enforcer_id_seq.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* OPAL Program
*
* MODULE : enforcer_id_seq.sql
*
* DESCRIPTION : Creates the Sequence to be used to generate the Primary key for the table ENFORCERS.
*
* VERSION HISTORY:
*
* Date Author Version Nature of Change
* ---------- ------- -------- ---------------------------------------------------------------------------------------------------------
* 04/12/2023 A Dennis 1.0 PO-127 Creates the Sequence to be used to generate the Primary key for the table ENFORCERS
*
**/
CREATE SEQUENCE IF NOT EXISTS enforcer_id_seq INCREMENT 1 MINVALUE 1 NO MAXVALUE START WITH 1 CACHE 20 OWNED BY enforcers.enforcer_id;
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* CGI OPAL Program
*
* MODULE : local_justice_areas.sql
*
* DESCRIPTION : Creates the LOCAL_JUSTICE_AREAS table for the Fines model
*
* VERSION HISTORY:
*
* Date Author Version Nature of Change
* ---------- ------- -------- ----------------------------------------------------------------------------
* 04/12/2023 A Dennis 1.0 PO-127 Creates the LOCAL_JUSTICE_AREAS table for the Fines model
*
**/
CREATE TABLE local_justice_areas
(
local_justice_area_id smallint not null
,name varchar(35) not null
,address_line_1 varchar(35) not null
,address_line_2 varchar(35)
,address_line_3 varchar(35)
,postcode varchar(8)
,CONSTRAINT local_justice_area_id_pk PRIMARY KEY
(
local_justice_area_id
)
);

COMMENT ON COLUMN local_justice_areas.local_justice_area_id IS 'Unique ID of this record';
COMMENT ON COLUMN local_justice_areas.name IS 'LJA name';
COMMENT ON COLUMN local_justice_areas.address_line_1 IS 'LJA address line 1';
COMMENT ON COLUMN local_justice_areas.address_line_2 IS 'LJA address line 2';
COMMENT ON COLUMN local_justice_areas.address_line_3 IS 'LJA address line 3';
COMMENT ON COLUMN local_justice_areas.postcode IS 'LJA postcode';
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* OPAL Program
*
* MODULE : local_justice_area_id_seq.sql
*
* DESCRIPTION : Creates the Sequence to be used to generate the Primary key for the table LOCAL_JUSTICE_AREAS.
*
* VERSION HISTORY:
*
* Date Author Version Nature of Change
* ---------- ------- -------- ---------------------------------------------------------------------------------------------------------
* 04/12/2023 A Dennis 1.0 PO-127 Creates the Sequence to be used to generate the Primary key for the table LOCAL_JUSTICE_AREAS
*
**/
CREATE SEQUENCE IF NOT EXISTS local_justice_area_id_seq INCREMENT 1 MINVALUE 1 NO MAXVALUE START WITH 1 CACHE 20 OWNED BY local_justice_areas.local_justice_area_id;
Loading

0 comments on commit 96547e8

Please sign in to comment.