Skip to content

Commit

Permalink
feat: CE-977 create ceeb decison (#79) (#81)
Browse files Browse the repository at this point in the history
Co-authored-by: Mike <100624415+marqueone-ps@users.noreply.github.com>
Co-authored-by: Mike Sears <mike.2.sears@gov.bc.ca>
  • Loading branch information
3 people authored Sep 6, 2024
1 parent 5a6d032 commit 4b56e12
Show file tree
Hide file tree
Showing 44 changed files with 3,007 additions and 17 deletions.
117 changes: 117 additions & 0 deletions backend/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,10 @@ model action {
update_utc_timestamp DateTime? @db.Timestamp(6)
equipment_guid String? @db.Uuid
wildlife_guid String? @db.Uuid
decision_guid String? @db.Uuid
case_file case_file @relation(fields: [case_guid], references: [case_file_guid], onDelete: NoAction, onUpdate: NoAction, map: "FK_action__case_guid")
action_type_action_xref action_type_action_xref @relation(fields: [action_type_action_xref_guid], references: [action_type_action_xref_guid], onDelete: NoAction, onUpdate: NoAction, map: "FK_action_action_type_action_xref")
decision decision? @relation(fields: [decision_guid], references: [decision_guid], onDelete: NoAction, onUpdate: NoAction, map: "fk_action__decision_guid")
equipment equipment? @relation(fields: [equipment_guid], references: [equipment_guid], onDelete: NoAction, onUpdate: NoAction, map: "fk_action__equipment_guid")
wildlife wildlife? @relation(fields: [wildlife_guid], references: [wildlife_guid], onDelete: NoAction, onUpdate: NoAction, map: "fk_action__wildlife_guid")
}
Expand Down Expand Up @@ -283,6 +285,7 @@ model case_file {
case_code_case_file_case_codeTocase_code case_code @relation("case_file_case_codeTocase_code", fields: [case_code], references: [case_code], onDelete: NoAction, onUpdate: NoAction, map: "FK_case_file__case_code")
inaction_reason_code_case_file_inaction_reason_codeToinaction_reason_code inaction_reason_code? @relation("case_file_inaction_reason_codeToinaction_reason_code", fields: [inaction_reason_code], references: [inaction_reason_code], onDelete: NoAction, onUpdate: NoAction, map: "FK_case_file__inaction_reason_code")
agency_code agency_code @relation(fields: [owned_by_agency_code], references: [agency_code], onDelete: NoAction, onUpdate: NoAction, map: "FK_case_file__owned_by_agency_code")
decision decision[]
lead lead[]
wildlife wildlife[]
}
Expand Down Expand Up @@ -453,3 +456,117 @@ model wildlife_h {
operation_executed_at DateTime @default(now()) @db.Timestamp(6)
data_after_executed_operation Json?
}

/// 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 decision {
decision_guid String @id(map: "PK_decision_guid") @default(dbgenerated("uuid_generate_v4()")) @db.Uuid
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)
inspection_number Int?
lead_agency String? @db.VarChar(10)
non_compliance_decision_matrix_code String @db.VarChar(10)
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)
action action[]
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")
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")
}

model decision_h {
h_decision_guid String @id(map: "PK_h_decision") @default(dbgenerated("uuid_generate_v4()")) @db.Uuid
target_row_id String @db.Uuid
operation_type String @db.Char(1)
operation_user_id String @default(dbgenerated("CURRENT_USER")) @db.VarChar(32)
operation_executed_at DateTime @default(now()) @db.Timestamp(6)
data_after_executed_operation Json?
}

/// 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 discharge_code {
discharge_code String @id(map: "PK_discharge_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_discharge_codeTodischarge_code decision[] @relation("decision_discharge_codeTodischarge_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 non_compliance_decision_matrix_code {
non_compliance_decision_matrix_code String @id(map: "PK_non_compliance_decision_matrix_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)
}

/// 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)
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)
schedule_sector_xref_schedule_sector_xref_schedule_codeToschedule_code schedule_sector_xref[] @relation("schedule_sector_xref_schedule_codeToschedule_code")
}

model schedule_sector_xref {
schedule_sector_xref_guid String @id(map: "PK_schedule_sector_xref_guid") @default(dbgenerated("uuid_generate_v4()")) @db.Uuid
schedule_code String @db.VarChar(10)
sector_code String @db.VarChar(10)
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[]
schedule_code_schedule_sector_xref_schedule_codeToschedule_code schedule_code @relation("schedule_sector_xref_schedule_codeToschedule_code", fields: [schedule_code], references: [schedule_code], onDelete: NoAction, onUpdate: NoAction, map: "fk_schedule_sector_xref__schedule_code")
sector_code_schedule_sector_xref_sector_codeTosector_code sector_code @relation("schedule_sector_xref_sector_codeTosector_code", fields: [sector_code], references: [sector_code], onDelete: NoAction, onUpdate: NoAction, map: "fk_schedule_sector_xref__sector_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 sector_code {
sector_code String @id(map: "PK_sector_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)
schedule_sector_xref_schedule_sector_xref_sector_codeTosector_code schedule_sector_xref[] @relation("schedule_sector_xref_sector_codeTosector_code")
}
12 changes: 12 additions & 0 deletions backend/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ import { InactionJustificationTypeModule } from "./inaction_justification_type/i
import { DateScalar } from "./common/custom_scalars";
import { HWCRPreventionActionModule } from "./hwcr_prevention_action/hwcr_prevention_action.module";
import { HWCRAssessmentActionModule } from "./hwcr_assessment_action/hwcr_assessment_action.module";
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";

@Module({
imports: [
Expand All @@ -49,6 +55,12 @@ import { HWCRAssessmentActionModule } from "./hwcr_assessment_action/hwcr_assess
HWCRPreventionActionModule,
CaseFileModule,
InactionJustificationTypeModule,
ScheduleCodeModule,
DischargeCodeModule,
NonComplianceCodeModule,
RationaleCodeModule,
SectorCodeModule,
CEEBDecisionActionModule,
],
controllers: [AppController],
providers: [AppService, DateScalar],
Expand Down
18 changes: 16 additions & 2 deletions backend/src/case_file/case_file.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { DeleteEquipmentInput } from "./dto/equipment/delete-equipment.input";
import { CreateWildlifeInput } from "./dto/wildlife/create-wildlife-input";
import { DeleteWildlifeInput } from "./dto/wildlife/delete-wildlife-input";
import { UpdateWildlifeInput } from "./dto/wildlife/update-wildlife-input";
import { CreateDecisionInput } from "./dto/ceeb/decision/create-decsion-input";
import { UpdateDecisionInput } from "./dto/ceeb/decision/update-decsion-input";

@UseGuards(JwtRoleGuard)
@Resolver("CaseFile")
Expand All @@ -39,13 +41,13 @@ export class CaseFileResolver {
}

@Query("getCaseFile")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS_OFFICER, Role.CEEB)
findOne(@Args("caseIdentifier") caseIdentifier: string) {
return this.caseFileService.findOne(caseIdentifier);
}

@Query("getCaseFileByLeadId")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS_OFFICER, Role.CEEB)
findOneByLeadId(@Args("leadIdentifier") leadIdentifier: string) {
return this.caseFileService.findOneByLeadId(leadIdentifier);
}
Expand Down Expand Up @@ -121,4 +123,16 @@ export class CaseFileResolver {
deleteWildlife(@Args("input") input: DeleteWildlifeInput) {
return this.caseFileService.deleteWildlife(input);
}

@Mutation("createDecision")
@Roles(Role.CEEB)
createDecision(@Args("input") input: CreateDecisionInput) {
return this.caseFileService.createDecision(input);
}

@Mutation("updateDecision")
@Roles(Role.CEEB)
updateDecision(@Args("input") input: UpdateDecisionInput) {
return this.caseFileService.updateDecision(input);
}
}
Loading

0 comments on commit 4b56e12

Please sign in to comment.