Skip to content

Commit

Permalink
Tests compiling - working on emails
Browse files Browse the repository at this point in the history
  • Loading branch information
haworku committed Sep 8, 2023
1 parent 723a552 commit 7135646
Show file tree
Hide file tree
Showing 10 changed files with 909 additions and 803 deletions.
8 changes: 3 additions & 5 deletions services/app-api/src/domain-models/contractAndRates/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
export { rateSchema, draftRateSchema } from './rateTypes'

export type { RateType } from './rateTypes'

export { contractSchema, draftContractSchema } from './contractTypes'

export { contractFormDataSchema, rateFormDataSchema } from './formDataTypes'
Expand All @@ -16,13 +14,13 @@ export {
export {
convertContractWithRatesRevtoHPPRev,
convertContractWithRatesToUnlockedHPP,
convertContractWithRatesToFormData
convertContractWithRatesToFormData,
} from './convertContractWithRatesToHPP'


export type { ContractType } from './contractTypes'
export type { RateType } from './rateTypes'

export type { PackageStatusType , UpdateInfoType } from './updateInfoType'
export type { PackageStatusType, UpdateInfoType } from './updateInfoType'

export type { ContractFormDataType, RateFormDataType } from './formDataTypes'

Expand Down
14 changes: 13 additions & 1 deletion services/app-api/src/domain-models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,23 @@ export {
packageSubmitters,
} from './healthPlanPackage'

export {
export {
convertContractWithRatesRevtoHPPRev,
convertContractWithRatesToUnlockedHPP,
} from './contractAndRates'

export type {
ContractType,
ContractRevisionType,
ContractRevisionWithRatesType,
ContractFormDataType,
RateType,
RateRevisionType,
RateRevisionWithContractsType,
RateFormDataType,
PackageStatusType,
} from './contractAndRates'

export type {
HealthPlanRevisionType,
HealthPlanPackageType,
Expand Down
4 changes: 4 additions & 0 deletions services/app-api/src/postgres/contractAndRates/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
export type { InsertContractArgsType } from './insertContract'
export type { UpdateContractArgsType } from './updateDraftContract'
export type { SubmitContractArgsType } from './submitContract'
export type { SubmitRateArgsType } from './submitRate'
export { submitContract } from './submitContract'
export { submitRate } from './submitRate'
export { insertDraftContract } from './insertContract'
export { findContractWithHistory } from './findContractWithHistory'
export { updateDraftContract } from './updateDraftContract'
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { UpdateInfoType } from '../../domain-models'
import { includeFirstSubmittedRateRev } from './prismaSubmittedRateHelpers'

type SubmitContractArgsType = {
contractID: string
contractID: string // revision ID
submittedByUserID: UpdateInfoType['updatedBy']
submitReason: UpdateInfoType['updatedReason']
}
Expand Down Expand Up @@ -156,3 +156,4 @@ async function submitContract(
}

export { submitContract }
export type { SubmitContractArgsType }
14 changes: 1 addition & 13 deletions services/app-api/src/postgres/contractAndRates/submitRate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,6 @@ async function submitRate(
(c) => c.revisions[0]
)

const everyRelatedContractIsSubmitted = relatedContractRevs.every(
(rev) => rev !== undefined
)

if (!everyRelatedContractIsSubmitted) {
const message =
'Attempted to submit a rate related to a contract that has not been submitted'

console.error(message)

return new Error(message)
}

const updated = await tx.rateRevisionTable.update({
where: {
id: currentRev.id,
Expand Down Expand Up @@ -158,3 +145,4 @@ async function submitRate(
}

export { submitRate }
export type { SubmitRateArgsType }
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { ContractFormDataType } from '../../domain-models/contractAndRates'
type ContractFormEditable = Partial<ContractFormDataType>

type UpdateContractArgsType = {
contractID: string
contractID: string //revision ID
formData: ContractFormEditable
rateIDs: string[]
}
Expand Down
13 changes: 13 additions & 0 deletions services/app-api/src/postgres/postgresStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type {
QuestionResponseType,
InsertQuestionResponseArgs,
StateType,
RateType,
} from '../domain-models'
import { findPrograms, findStatePrograms } from '../postgres'
import type { StoreError } from './storeError'
Expand Down Expand Up @@ -52,10 +53,14 @@ import {
insertDraftContract,
findContractWithHistory,
updateDraftContract,
submitRate,
submitContract,
} from './contractAndRates'
import type {
InsertContractArgsType,
UpdateContractArgsType,
SubmitContractArgsType,
SubmitRateArgsType,
} from './contractAndRates'

type Store = {
Expand Down Expand Up @@ -145,6 +150,12 @@ type Store = {
updateDraftContract: (
args: UpdateContractArgsType
) => Promise<ContractType | Error>

submitContract: (
args: SubmitContractArgsType
) => Promise<ContractType | Error>

submitRate: (args: SubmitRateArgsType) => Promise<RateType | Error>
}

function NewPostgresStore(client: PrismaClient): Store {
Expand Down Expand Up @@ -206,6 +217,8 @@ function NewPostgresStore(client: PrismaClient): Store {
findContractWithHistory: (args) =>
findContractWithHistory(client, args),
updateDraftContract: (args) => updateDraftContract(client, args),
submitContract: (args) => submitContract(client, args),
submitRate: (args) => submitRate(client, args),
}
}

Expand Down
Loading

0 comments on commit 7135646

Please sign in to comment.