Skip to content

Commit

Permalink
Merge branch 'main' into jl_MR-3561_validate_prisma_to_domain_model_f…
Browse files Browse the repository at this point in the history
…unctions

# Conflicts:
#	services/app-api/src/domain-models/contractAndRates/contractType.ts
#	services/app-api/src/postgres/contractAndRates/findContractWithHistory.ts
#	services/app-api/src/postgres/contractAndRates/prismaToDomainModel.test.ts
#	services/app-api/src/postgres/contractAndRates/prismaToDomainModel.ts
  • Loading branch information
JasonLin0991 committed Jul 14, 2023
2 parents 6ad0f18 + 915fc6e commit e1c2f6e
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
BEGIN;
/*
Warnings:
- You are about to drop the column `contractRevisionID` on the `ActuaryContact` table. All the data in the column will be lost.
- You are about to drop the column `rateRevisionID` on the `ActuaryContact` table. All the data in the column will be lost.
- You are about to drop the column `addtlActuaryCommunicationPreference` on the `ContractRevisionTable` table. All the data in the column will be lost.
*/
-- DropForeignKey
ALTER TABLE "ActuaryContact" DROP CONSTRAINT "ActuaryContact_contractRevisionID_fkey";

-- DropForeignKey
ALTER TABLE "ActuaryContact" DROP CONSTRAINT "ActuaryContact_rateRevisionID_fkey";

-- AlterTable
ALTER TABLE "ActuaryContact" DROP COLUMN "contractRevisionID",
DROP COLUMN "rateRevisionID",
ADD COLUMN "rateWithAddtlActuaryID" TEXT,
ADD COLUMN "rateWithCertifyingActuaryID" TEXT;

-- AlterTable
ALTER TABLE "ContractRevisionTable" DROP COLUMN "addtlActuaryCommunicationPreference";

-- AddForeignKey
ALTER TABLE "ActuaryContact" ADD CONSTRAINT "ActuaryContact_rateWithCertifyingActuaryID_fkey" FOREIGN KEY ("rateWithCertifyingActuaryID") REFERENCES "RateRevisionTable"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "ActuaryContact" ADD CONSTRAINT "ActuaryContact_rateWithAddtlActuaryID_fkey" FOREIGN KEY ("rateWithAddtlActuaryID") REFERENCES "RateRevisionTable"("id") ON DELETE SET NULL ON UPDATE CASCADE;
COMMIT;
17 changes: 8 additions & 9 deletions services/app-api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ model ContractRevisionTable {
populationCovered PopulationCoverageType?
riskBasedContract Boolean?
stateContacts StateContact[]
addtlActuaryContacts ActuaryContact[]
addtlActuaryCommunicationPreference ActuaryCommunication?
supportingDocuments ContractSupportingDocument[]
contractType ContractType
contractExecutionStatus ContractExecutionStatus?
Expand Down Expand Up @@ -138,7 +136,8 @@ model RateRevisionTable {
amendmentEffectiveDateEnd DateTime? @db.Date
rateProgramIDs String[]
rateCertificationName String?
actuaryContacts ActuaryContact[]
certifyingActuaryContacts ActuaryContact[] @relation(name: "CertifyingActuaryOnRateRevision")
addtlActuaryContacts ActuaryContact[] @relation(name: "AddtlActuaryOnRateRevision")
actuaryCommunicationPreference ActuaryCommunication?
packagesWithSharedRateCerts SharedRateCertifications[]
}
Expand All @@ -163,9 +162,9 @@ model UpdateInfoTable {
updatedBy User @relation(fields: [updatedByID], references: [id])
updatedReason String
unlockedContracts ContractRevisionTable[] @relation("unlockContractInfo")
submitedContracts ContractRevisionTable[] @relation("submitContractInfo")
submittedContracts ContractRevisionTable[] @relation("submitContractInfo")
unlockedRates RateRevisionTable[] @relation("unlockRateInfo")
submitedRates RateRevisionTable[] @relation("submitRateInfo")
submittedRates RateRevisionTable[] @relation("submitRateInfo")
}

model SharedRateCertifications {
Expand All @@ -185,10 +184,10 @@ model ActuaryContact {
email String
actuarialFirm ActuarialFirm
actuarialFirmOther String?
contractRevisionID String?
contractRevision ContractRevisionTable? @relation(fields: [contractRevisionID], references: [id])
rateRevisionID String?
rateRevision RateRevisionTable? @relation(fields: [rateRevisionID], references: [id])
rateWithCertifyingActuaryID String?
rateWithAddtlActuaryID String?
rateActuaryCertifying RateRevisionTable? @relation(name: "CertifyingActuaryOnRateRevision", fields: [ rateWithCertifyingActuaryID ], references: [id])
rateActuaryAddtl RateRevisionTable? @relation(name: "AddtlActuaryOnRateRevision", fields: [ rateWithAddtlActuaryID ], references: [id])
}

model ContractDocument {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ async function findContractWithHistory(
},
},
stateContacts: true,
addtlActuaryContacts: true,
contractDocuments: true,
supportingDocuments: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ async function findDraftRate(
submitInfo: updateInfoIncludeUpdater,
unlockInfo: updateInfoIncludeUpdater,
stateContacts: true,
addtlActuaryContacts: true,
contractDocuments: true,
supportingDocuments: true,
rateRevisions: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ async function findRateWithHistory(
submitInfo: updateInfoIncludeUpdater,
unlockInfo: updateInfoIncludeUpdater,
stateContacts: true,
addtlActuaryContacts: true,
contractDocuments: true,
supportingDocuments: true,
rateRevisions: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ async function insertDraftRate(
},
},
stateContacts: true,
addtlActuaryContacts: true,
contractDocuments: true,
supportingDocuments: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,6 @@ function contractFormDataToDomainModel(
email: contact.email,
}))
: [],
addtlActuaryContacts: contractRevision.addtlActuaryContacts
? contractRevision.addtlActuaryContacts.map((contact) => ({
name: contact.name,
titleRole: contact.titleRole,
email: contact.email,
actuarialFirm: contact.actuarialFirm,
actuarialFirmOther: contact.actuarialFirmOther ?? undefined,
}))
: [],
addtlActuaryCommunicationPreference:
contractRevision.addtlActuaryCommunicationPreference ?? undefined,
supportingDocuments: contractRevision.supportingDocuments
? contractRevision.supportingDocuments.map((doc) => ({
name: doc.name,
Expand Down
1 change: 0 additions & 1 deletion services/app-api/src/postgres/prismaHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const updateInfoIncludeUpdater = {

const draftContractRevisionsWithDraftRates = {
stateContacts: true,
addtlActuaryContacts: true,
contractDocuments: true,
supportingDocuments: true,
draftRates: {
Expand Down
2 changes: 0 additions & 2 deletions services/app-api/src/postgres/prismaTypes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
ActuaryContact,
ContractDocument,
ContractRevisionTable,
ContractSupportingDocument,
Expand Down Expand Up @@ -36,7 +35,6 @@ type ContractRevisionTableWithRelations = ContractRevisionTable & {
submitInfo?: UpdateInfoTableWithUpdater | null
unlockInfo?: UpdateInfoTableWithUpdater | null
stateContacts: StateContact[]
addtlActuaryContacts: ActuaryContact[]
contractDocuments: ContractDocument[]
supportingDocuments: ContractSupportingDocument[]
managedCareEntities: ManagedCareEntity[]
Expand Down

0 comments on commit e1c2f6e

Please sign in to comment.