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

feat: CE-1066 update rationale to text field #91

Merged
merged 5 commits into from
Sep 26, 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
17 changes: 1 addition & 16 deletions backend/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ model decision {
case_file_guid String @db.Uuid
schedule_sector_xref_guid String @db.Uuid
discharge_code String @db.VarChar(10)
rationale_code String? @db.VarChar(10)
rationale_text String? @db.VarChar(10)
inspection_number Int?
lead_agency_code String? @db.VarChar(10)
non_compliance_decision_matrix_code String? @db.VarChar(10)
Expand All @@ -479,7 +479,6 @@ model decision {
case_file case_file @relation(fields: [case_file_guid], references: [case_file_guid], onDelete: NoAction, onUpdate: NoAction, map: "fk_decision__case_file_guid")
discharge_code_decision_discharge_codeTodischarge_code discharge_code @relation("decision_discharge_codeTodischarge_code", fields: [discharge_code], references: [discharge_code], onDelete: NoAction, onUpdate: NoAction, map: "fk_decision__discharge_code")
non_compliance_decision_matrix_code_decision_non_compliance_decision_matrix_codeTonon_compliance_decision_matrix_code non_compliance_decision_matrix_code? @relation("decision_non_compliance_decision_matrix_codeTonon_compliance_decision_matrix_code", fields: [non_compliance_decision_matrix_code], references: [non_compliance_decision_matrix_code], onDelete: NoAction, onUpdate: NoAction, map: "fk_decision__ncdm_code")
rationale_code_decision_rationale_codeTorationale_code rationale_code? @relation("decision_rationale_codeTorationale_code", fields: [rationale_code], references: [rationale_code], onDelete: NoAction, onUpdate: NoAction, map: "fk_decision__rationale_code")
schedule_sector_xref schedule_sector_xref @relation(fields: [schedule_sector_xref_guid], references: [schedule_sector_xref_guid], onDelete: NoAction, onUpdate: NoAction, map: "fk_decision__schedule_sector_xref_guid")
}

Expand Down Expand Up @@ -520,20 +519,6 @@ model non_compliance_decision_matrix_code {
decision_decision_non_compliance_decision_matrix_codeTonon_compliance_decision_matrix_code decision[] @relation("decision_non_compliance_decision_matrix_codeTonon_compliance_decision_matrix_code")
}

/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model rationale_code {
rationale_code String @id(map: "PK_rationale_code") @db.VarChar(10)
short_description String @db.VarChar(50)
long_description String? @db.VarChar(250)
display_order Int
active_ind Boolean
create_user_id String @db.VarChar(32)
create_utc_timestamp DateTime @db.Timestamp(6)
update_user_id String @db.VarChar(32)
update_utc_timestamp DateTime @db.Timestamp(6)
decision_decision_rationale_codeTorationale_code decision[] @relation("decision_rationale_codeTorationale_code")
}

/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model schedule_code {
schedule_code String @id(map: "PK_schedule_code") @db.VarChar(10)
Expand Down
2 changes: 0 additions & 2 deletions backend/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { HWCRAssessmentActionModule } from "./hwcr_assessment_action/hwcr_assess
import { ScheduleCodeModule } from "./code-tables/schedule_code/schedule_code.module";
import { DischargeCodeModule } from "./code-tables/discharge_code/discharge_code,module";
import { NonComplianceCodeModule } from "./code-tables/non_compliance_code/non_compliance_code.module";
import { RationaleCodeModule } from "./code-tables/rationale_code/rationale_code.module";
import { SectorCodeModule } from "./code-tables/sector_code/sector_code.module";
import { CEEBDecisionActionModule } from "./ceeb_decision_action/ceeb_decision_action.module";
import { AgencyCodeModule } from "./agency_code/agency_code.module";
Expand Down Expand Up @@ -60,7 +59,6 @@ import { AgencyCodeModule } from "./agency_code/agency_code.module";
ScheduleCodeModule,
DischargeCodeModule,
NonComplianceCodeModule,
RationaleCodeModule,
SectorCodeModule,
CEEBDecisionActionModule,
],
Expand Down
8 changes: 4 additions & 4 deletions backend/src/case_file/case_file.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export class CaseFileService {
select: {
decision_guid: true,
discharge_code: true,
rationale_code: true,
rationale_text: true,
inspection_number: true,
lead_agency_code: true,
non_compliance_decision_matrix_code: true,
Expand Down Expand Up @@ -412,7 +412,7 @@ export class CaseFileService {
sector: decision[0].schedule_sector_xref.sector_code,
discharge: decision[0].discharge_code,
nonCompliance: decision[0]?.non_compliance_decision_matrix_code,
rationale: decision[0]?.rationale_code,
rationale: decision[0]?.rationale_text,
assignedTo: action[0]?.actor,
actionTaken: action[0]?.actionCode,
actionTakenDate: action[0]?.date,
Expand Down Expand Up @@ -2481,7 +2481,7 @@ export class CaseFileService {
case_file_guid: caseId,
schedule_sector_xref_guid: scheduleSectorXref,
discharge_code: discharge,
rationale_code: rationale,
rationale_text: rationale,
non_compliance_decision_matrix_code: nonCompliance,
active_ind: true,
create_user_id: userId,
Expand Down Expand Up @@ -2670,7 +2670,7 @@ export class CaseFileService {

let data: any = {
discharge_code: discharge,
rationale_code: rationale,
rationale_text: rationale,
non_compliance_decision_matrix_code: nonCompliance,
update_user_id: updateUserId,
update_utc_timestamp: current,
Expand Down

This file was deleted.

11 changes: 0 additions & 11 deletions backend/src/code-tables/rationale_code/rationale_code.graphql

This file was deleted.

10 changes: 0 additions & 10 deletions backend/src/code-tables/rationale_code/rationale_code.module.ts

This file was deleted.

18 changes: 0 additions & 18 deletions backend/src/code-tables/rationale_code/rationale_code.resolver.ts

This file was deleted.

28 changes: 0 additions & 28 deletions backend/src/code-tables/rationale_code/rationale_code.service.ts

This file was deleted.

50 changes: 0 additions & 50 deletions migrations/sql/R__insert_CEEB_decision_codes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1406,56 +1406,6 @@ VALUES
CURRENT_TIMESTAMP
) ON CONFLICT DO NOTHING;

--
-- INSERT rationale values
--
INSERT INTO
case_management.rationale_code (
rationale_code,
short_description,
long_description,
display_order,
active_ind,
create_user_id,
create_utc_timestamp,
update_user_id,
update_utc_timestamp
)
VALUES
(
'RATIONAL01',
'RATIONAL_01',
'Rationale 01',
10,
'Y',
CURRENT_USER,
CURRENT_TIMESTAMP,
CURRENT_USER,
CURRENT_TIMESTAMP
),
(
'RATIONAL02',
'RATIONAL_02',
'Rationale 02',
20,
'Y',
CURRENT_USER,
CURRENT_TIMESTAMP,
CURRENT_USER,
CURRENT_TIMESTAMP
),
(
'RATIONAL03',
'RATIONAL_03',
'Rational 03',
30,
'Y',
CURRENT_USER,
CURRENT_TIMESTAMP,
CURRENT_USER,
CURRENT_TIMESTAMP
) ON CONFLICT DO NOTHING;

--
-- INSERT discharge_code values
--
Expand Down
10 changes: 10 additions & 0 deletions migrations/sql/V1.28.1__CE-1066.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ALTER TABLE case_management.decision
DROP CONSTRAINT fk_decision__rationale_code;

ALTER TABLE case_management.decision
RENAME COLUMN rationale_code TO rationale_text;

ALTER TABLE case_management.decision
ALTER COLUMN rationale_text TYPE varchar(4000);

DROP TABLE if exists case_management.rationale_code;
Loading