Skip to content

Commit

Permalink
10049 - using appcontext for persistence calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Absolutestunna committed Sep 13, 2023
1 parent a15c18e commit 0be92d4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {
isAuthorized,
} from '../../../authorization/authorizationClientService';
import { RawCaseWorksheet } from '@shared/business/entities/caseWorksheet/CaseWorksheet';
import { getCaseWorksheet } from '@web-api/persistence/dynamo/caseWorksheet/getCaseWorksheet';
import { getCountOfConsolidedCases } from '@web-api/persistence/elasticsearch/getCountOfConsolidedCases';

export type JudgeActivityReportCavAndSubmittedCasesRequest = {
statuses: string[];
Expand Down Expand Up @@ -165,10 +163,12 @@ const getCases = async (

const completeCaseRecords = await Promise.all(
filteredCaseRecords.map(async caseRecord => {
const caseWorksheet = await getCaseWorksheet({
applicationContext,
docketNumber: caseRecord.docketNumber,
});
const caseWorksheet = await applicationContext
.getPersistenceGateway()
.getCaseWorksheet({
applicationContext,
docketNumber: caseRecord.docketNumber,
});

return {
...caseRecord,
Expand All @@ -188,8 +188,10 @@ const calculateNumberOfConsolidatedCases = async (
return 0;
}

return await getCountOfConsolidedCases({
applicationContext,
leadDocketNumber: caseInfo.leadDocketNumber,
});
return await applicationContext
.getPersistenceGateway()
.getCountOfConsolidedCases({
applicationContext,
leadDocketNumber: caseInfo.leadDocketNumber,
});
};
2 changes: 2 additions & 0 deletions web-api/src/getPersistenceGateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ import { getCognitoUserIdByEmail } from './persistence/cognito/getCognitoUserIdB
import { getCompletedSectionInboxMessages } from './persistence/elasticsearch/messages/getCompletedSectionInboxMessages';
import { getCompletedUserInboxMessages } from './persistence/elasticsearch/messages/getCompletedUserInboxMessages';
import { getConfigurationItemValue } from './persistence/dynamo/deployTable/getConfigurationItemValue';
import { getCountOfConsolidedCases } from '@web-api/persistence/elasticsearch/getCountOfConsolidedCases';
import { getDeployTableStatus } from './persistence/dynamo/getDeployTableStatus';
import { getDispatchNotification } from './persistence/dynamo/notifications/getDispatchNotification';
import { getDocketEntriesServedWithinTimeframe } from './persistence/elasticsearch/getDocketEntriesServedWithinTimeframe';
Expand Down Expand Up @@ -326,6 +327,7 @@ const gatewayMethods = {
getCognitoUserIdByEmail,
getCompletedSectionInboxMessages,
getCompletedUserInboxMessages,
getCountOfConsolidedCases,
getDeployTableStatus,
getDispatchNotification,
getDocketEntriesServedWithinTimeframe,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,5 @@ export const getCountOfConsolidedCases = async ({
index: 'efcms-case',
},
});

console.log(results);
return results;
};

0 comments on commit 0be92d4

Please sign in to comment.