Skip to content

Commit

Permalink
10504-dxox: fix processCaseCorrespondenceEntries and processCaseWorks…
Browse files Browse the repository at this point in the history
…heetEntries, which are not passing through newly added entity fields
  • Loading branch information
Mwindo committed Dec 6, 2024
1 parent 8200d45 commit 2f511b0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,22 @@ export const processCaseCorrespondenceEntries = async ({
`going to upsert ${caseCorrespondenceRecords.length} correspondence records`,
);

function getDocketNumberFromPk(pk?: string) {
if (!pk) {
throw new Error('Case Correspondence is missing a pk');
}
const parts = pk.split('|');
if (parts.length > 1 && parts[1].length) {
return parts[1];
}
throw new Error(`Case Correspondence pk of ${pk} is improperly formatted`);
}

await upsertCaseCorrespondences(
caseCorrespondenceRecords.map(record => {
return unmarshall(record.dynamodb.NewImage) as RawCorrespondence;
const unmarshalledData = unmarshall(record.dynamodb.NewImage);
const docketNumber = getDocketNumberFromPk(unmarshalledData.pk);
return { ...unmarshalledData, docketNumber } as RawCorrespondence;
}),
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,19 @@ export const processCaseWorksheetEntries = async ({
`going to upsert ${caseWorksheetRecords.length} case worksheet records`,
);

function getJudgeUserIdFromGs1pk(gs1pk?: string): string | null {
if (!gs1pk) {
return null;
}
const parts = gs1pk.split('|');
return parts.length > 1 ? parts[1] : null;
}

await upsertCaseWorksheets(
caseWorksheetRecords.map(record => {
return unmarshall(record.dynamodb.NewImage) as RawCaseWorksheet;
const unmarshalledData = unmarshall(record.dynamodb.NewImage);
const judgeUserId = getJudgeUserIdFromGs1pk(unmarshalledData.gs1pk);
return { ...unmarshalledData, judgeUserId } as RawCaseWorksheet;
}),
);
};

0 comments on commit 2f511b0

Please sign in to comment.