Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into design-tweaks-header-…
Browse files Browse the repository at this point in the history
…n-errors
  • Loading branch information
haworku committed Mar 11, 2024
2 parents 61031da + 9c8873d commit f8e980b
Show file tree
Hide file tree
Showing 66 changed files with 8,384 additions and 2,509 deletions.
6 changes: 3 additions & 3 deletions dev_tool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
]
},
"dependencies": {
"@aws-sdk/client-cloudfront": "^3.485.0",
"@aws-sdk/client-ec2": "^3.485.0",
"@aws-sdk/client-secrets-manager": "^3.485.0",
"@aws-sdk/client-cloudfront": "^3.529.1",
"@aws-sdk/client-ec2": "^3.529.1",
"@aws-sdk/client-secrets-manager": "^3.529.1",
"node-ssh": "^13.1.0",
"yargs": "^17.2.1"
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"devDependencies": {
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.0",
"@cypress-audit/pa11y": "^1.3.0",
"chromedriver": "^121.0.0",
"chromedriver": "^122.0.4",
"cypress": "^12.16.0",
"cypress-pipe": "^2.0.0",
"danger": "^11.2.6",
Expand Down
6 changes: 3 additions & 3 deletions scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
]
},
"dependencies": {
"@aws-sdk/client-cloudformation": "^3.485.0",
"@aws-sdk/client-cognito-identity-provider": "^3.485.0",
"@aws-sdk/client-s3": "^3.485.0",
"@aws-sdk/client-cloudformation": "^3.529.1",
"@aws-sdk/client-cognito-identity-provider": "^3.529.1",
"@aws-sdk/client-s3": "^3.529.1",
"octokit": "^3.1.2"
},
"devDependencies": {
Expand Down
18 changes: 9 additions & 9 deletions services/app-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
},
"dependencies": {
"@apollo/gateway": "^2.2.2",
"@aws-sdk/client-amplify": "^3.485.0",
"@aws-sdk/client-cognito-identity-provider": "^3.485.0",
"@aws-sdk/client-lambda": "^3.485.0",
"@aws-sdk/client-rds": "^3.485.0",
"@aws-sdk/client-s3": "^3.485.0",
"@aws-sdk/client-secrets-manager": "^3.485.0",
"@aws-sdk/client-ses": "^3.485.0",
"@aws-sdk/client-ssm": "^3.485.0",
"@aws-sdk/lib-storage": "^3.485.0",
"@aws-sdk/client-amplify": "^3.529.1",
"@aws-sdk/client-cognito-identity-provider": "^3.529.1",
"@aws-sdk/client-lambda": "^3.529.1",
"@aws-sdk/client-rds": "^3.529.1",
"@aws-sdk/client-s3": "^3.529.1",
"@aws-sdk/client-secrets-manager": "^3.529.1",
"@aws-sdk/client-ses": "^3.529.1",
"@aws-sdk/client-ssm": "^3.529.1",
"@aws-sdk/lib-storage": "^3.529.1",
"@launchdarkly/node-server-sdk": "8.1.1",
"@opentelemetry/exporter-trace-otlp-http": "^0.45.1",
"apollo-server-core": "^3.11.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@ import { z } from 'zod'
import { contractRevisionWithRatesSchema } from './revisionTypes'
import { statusSchema } from './statusType'
import { pruneDuplicateEmails } from '../../emailer/formatters'
import { rateSchema } from './rateTypes'

// Contract represents the contract specific information in a submission package
// All that data is contained in revisions, each revision represents the data in a single submission
// submissions are kept intact here across time
const contractSchema = z.object({
id: z.string().uuid(),
createdAt: z.date(),
updatedAt: z.date(),
status: statusSchema,
stateCode: z.string(),
mccrsID: z.string().optional(),
stateNumber: z.number().min(1),
// If this contract is in a DRAFT or UNLOCKED status, there will be a draftRevision
// If this contract is in a DRAFT or UNLOCKED status, there will be a draftRevision and draftRates
draftRevision: contractRevisionWithRatesSchema.optional(),
draftRates: z.array(rateSchema).optional(),
// All revisions are submitted and in reverse chronological order
revisions: z.array(contractRevisionWithRatesSchema),
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {
ContractType,
ContractRevisionWithRatesType,
ContractRevisionType,
RateType,
} from '../../domain-models/contractAndRates'
import { contractSchema } from '../../domain-models/contractAndRates'
import { draftContractRevToDomainModel } from './prismaDraftContractHelpers'
Expand Down Expand Up @@ -111,6 +112,7 @@ function contractWithHistoryToDomainModel(
const contractRevisions = contract.revisions
let draftRevision: ContractRevisionWithRatesType | Error | undefined =
undefined
let draftRates: RateType[] | Error | undefined = undefined

for (const [contractRevIndex, contractRev] of contractRevisions.entries()) {
// We set the draft revision aside, all ordered revisions are submitted
Expand All @@ -130,6 +132,19 @@ function contractWithHistoryToDomainModel(
)
}

const draftPrismaRates = contractRev.draftRates

draftRates = draftPrismaRates.map((r) => {
return {
id: r.id,
createdAt: r.createdAt,
updatedAt: r.updatedAt,
status: getContractRateStatus(r.revisions),
stateCode: r.stateCode,
stateNumber: r.stateNumber,
revisions: [],
}
})
// skip the rest of the processing
continue
}
Expand Down Expand Up @@ -261,11 +276,14 @@ function contractWithHistoryToDomainModel(

return {
id: contract.id,
createdAt: contract.createdAt,
updatedAt: contract.updatedAt,
mccrsID: contract.mccrsID || undefined,
status: getContractRateStatus(contract.revisions),
stateCode: contract.stateCode,
stateNumber: contract.stateNumber,
draftRevision,
draftRates,
revisions: revisions.reverse(),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,5 @@ export {
parseRateWithHistory,
rateRevisionToDomainModel,
rateRevisionsToDomainModels,
rateWithHistoryToDomainModel,
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import type { ContractRevisionTableWithRates } from './prismaSubmittedContractHe
const includeDraftRates = {
revisions: {
include: includeRateFormData,
take: 1,
orderBy: {
createdAt: 'desc',
},
Expand Down
Loading

0 comments on commit f8e980b

Please sign in to comment.