Skip to content

Commit

Permalink
10502-dxox: fix typing and kysely mapping for docketEntries, hearings…
Browse files Browse the repository at this point in the history
…, and qcCompleteForTrial
  • Loading branch information
Mwindo committed Jan 24, 2025
1 parent f385da9 commit a555d34
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
12 changes: 6 additions & 6 deletions web-api/src/business/useCases/createCaseInteractor.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { Case } from '../../../../shared/src/business/entities/cases/Case';
import { Case } from '@shared/business/entities/cases/Case';
import {
CreatedCaseType,
INITIAL_DOCUMENT_TYPES,
PETITIONS_SECTION,
ROLES,
} from '../../../../shared/src/business/entities/EntityConstants';
import { DocketEntry } from '../../../../shared/src/business/entities/DocketEntry';
} from '@shared/business/entities/EntityConstants';
import { DocketEntry } from '@shared/business/entities/DocketEntry';
import { ElectronicPetition } from '@shared/business/entities/cases/ElectronicPetition';
import { Petitioner } from '@shared/business/entities/contacts/Petitioner';
import {
ROLE_PERMISSIONS,
isAuthorized,
} from '../../../../shared/src/authorization/authorizationClientService';
} from '@shared/authorization/authorizationClientService';
import { ServerApplicationContext } from '@web-api/applicationContext';
import { UnauthorizedError } from '@web-api/errors/errors';
import { UnknownAuthUser } from '@shared/business/entities/authUser/AuthUser';
import { UserCase } from '../../../../shared/src/business/entities/UserCase';
import { UserCase } from '@shared/business/entities/UserCase';
import { UserRecord } from '@web-api/persistence/dynamo/dynamoTypes';
import { WorkItem } from '../../../../shared/src/business/entities/WorkItem';
import { WorkItem } from '@shared/business/entities/WorkItem';
import { createPetitionersOnCase } from '@web-api/persistence/postgres/cases/parties/createPetitionersOnCase';
import { createCaseStatistic } from '@web-api/persistence/postgres/cases/statistics/createCaseStatistic';
import { generateDocketNumber } from '@web-api/persistence/postgres/cases/generateDocketNumber';
Expand Down
9 changes: 7 additions & 2 deletions web-api/src/database-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,15 @@ export interface CaseTable {
damages?: number;
docketNumber: string;
docketNumberSuffix?: string;
docketEntries?: ColumnType<
{ docketEntryId: string; docketNumber: string }[],
string,
string
>;
filingType?: string;
hasPendingItems?: boolean;
hasVerifiedIrsNotice?: boolean;
hearings?: any[];
hearings?: ColumnType<{ trialSessionId: string }[], string, string>;
highPriority?: boolean;
highPriorityReason?: string;
initialCaption?: string;
Expand Down Expand Up @@ -93,7 +98,7 @@ export interface CaseTable {
petitionPaymentWaivedDate?: Date | null;
preferredTrialCity?: string;
procedureType: string;
qcCompleteForTrial?: Record<string, any>; // needed
qcCompleteForTrial?: ColumnType<{ trialSessionId: string }[], string, string>;
receivedAt: Date;
sealedDate?: Date | null;
sortableDocketNumber: number;
Expand Down
5 changes: 3 additions & 2 deletions web-api/src/persistence/postgres/cases/mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ export const convertRawCaseToDbRow = (rawCase: RawCase) => {
damages: rawCase.damages,
docketNumber: rawCase.docketNumber,
docketNumberSuffix: rawCase.docketNumberSuffix,
docketEntries: JSON.stringify(rawCase.docketEntries),
filingType: rawCase.filingType,
hasPendingItems: rawCase.hasPendingItems,
hasVerifiedIrsNotice: rawCase.hasVerifiedIrsNotice,
hearings: rawCase.hearings,
hearings: JSON.stringify(rawCase.hearings),
highPriority: rawCase.highPriority,
highPriorityReason: rawCase.highPriorityReason,
initialCaption: rawCase.initialCaption,
Expand Down Expand Up @@ -73,7 +74,7 @@ export const convertRawCaseToDbRow = (rawCase: RawCase) => {
: null,
preferredTrialCity: rawCase.preferredTrialCity,
procedureType: rawCase.procedureType,
qcCompleteForTrial: rawCase.qcCompleteForTrial,
qcCompleteForTrial: JSON.stringify(rawCase.qcCompleteForTrial),
receivedAt: rawCase.receivedAt
? calculateDate({ dateString: rawCase.receivedAt })
: calculateDate({ dateString: formatNow() }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export async function up(db: Kysely<any>): Promise<void> {
.addColumn('caseNote', 'varchar')
.addColumn('caseType', 'varchar', col => col.notNull())
.addColumn('closedDate', 'timestamptz')
.addColumn('correspondence', 'jsonb')
.addColumn('createdAt', 'timestamptz')
.addColumn('damages', 'numeric')
.addColumn('docketEntries', 'jsonb')
Expand Down

0 comments on commit a555d34

Please sign in to comment.