Skip to content

Commit

Permalink
Merge branch 'staging' of https://github.com/ustaxcourt/ef-cms into 1…
Browse files Browse the repository at this point in the history
…0049-display-wip-cav-submitted-cases
  • Loading branch information
TomElliottFlexion committed Sep 19, 2023
2 parents 183d15e + 9b93a2a commit 86be5cc
Show file tree
Hide file tree
Showing 48 changed files with 545 additions and 295 deletions.
6 changes: 4 additions & 2 deletions scripts/data-import/judge/judge_users.csv
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Cantrel,Judge,Cantrel,[email protected],legacyJudge,legacyJudgesC
Carluzzo,Chief Special Trial Judge,Lewis R. Carluzzo,[email protected],judge,carluzzosChambers
Chabot,Judge,Chabot,[email protected],legacyJudge,legacyJudgesChambers
Chiechi,Judge,Chiechi,[email protected],legacyJudge,legacyJudgesChambers
Choi,Special Trial Judge,Eunkyong Choi,[email protected],legacyJudge,legacyJudgesChambers
Clapp,Judge,Clapp,[email protected],legacyJudge,legacyJudgesChambers
Cohen,Judge,Mary Ann Cohen,[email protected],judge,cohensChambers
Colvin,Judge,John O. Colvin,[email protected],judge,colvinsChambers
Expand All @@ -20,6 +21,7 @@ Dinan,Special Trial Judge,Dinan,[email protected],legacyJudge,legac
Drennen,Judge,Drennen,[email protected],legacyJudge,legacyJudgesChambers
Fay,Judge,Fay,[email protected],legacyJudge,legacyJudgesChambers
Featherston,Judge,Featherston,[email protected],legacyJudge,legacyJudgesChambers
Fried,Special Trial Judge,Zachary S. Fried,[email protected],judge,friedsChambers
Foley,Chief Judge,Maurice B. Foley,[email protected],judge,foleysChambers
Gale,Judge,Joseph H. Gale,[email protected],judge,galesChambers
Galloway,Special Trial Judge,Galloway,[email protected],legacyJudge,legacyJudgesChambers
Expand All @@ -40,6 +42,7 @@ Jones,Judge,Courtney D. Jones,[email protected],judge,jonesChambers
Kerrigan,Judge,Kathleen Kerrigan,[email protected],judge,kerrigansChambers
Korner,Judge,Korner,[email protected],legacyJudge,legacyJudgesChambers
Kroupa,Judge,Kroupa,[email protected],legacyJudge,legacyJudgesChambers
Landy,Special Trial Judge,Adam B. Landy,[email protected],judge,landysChambers
Laro,Judge,Laro,[email protected],legacyJudge,legacyJudgesChambers
Lauber,Judge,Albert G. Lauber,[email protected],judge,laubersChambers
Leyden,Special Trial Judge,Diana L. Leyden,[email protected],judge,leydensChambers
Expand All @@ -62,6 +65,7 @@ Raum,Judge,Raum,[email protected],legacyJudge,legacyJudgesChambers
Ruwe,Judge,Robert P. Ruwe,[email protected],judge,ruwesChambers
Scott,Judge,Scott,[email protected],legacyJudge,legacyJudgesChambers
Shields,Judge,Shields,[email protected],legacyJudge,legacyJudgesChambers
Siegel,Special Trial Judge,Jennifer E. Siegel,[email protected],judge,siegelsChambers
Simpson,Judge,Simpson,[email protected],legacyJudge,legacyJudgesChambers
Sterrett,Judge,Sterrett,[email protected],legacyJudge,legacyJudgesChambers
Swift,Judge,Swift,[email protected],legacyJudge,legacyJudgesChambers
Expand All @@ -81,5 +85,3 @@ Wiles,Judge,Wiles,[email protected],legacyJudge,legacyJudgesChamber
Williams,Judge,Williams,[email protected],legacyJudge,legacyJudgesChambers
Wolfe,Special Trial Judge,Wolfe,[email protected],legacyJudge,legacyJudgesChambers
Wright,Judge,Wright,[email protected],legacyJudge,legacyJudgesChambers
Choi,Special Trial Judge,Eunkyong Choi,[email protected],judge,choisChambers
Landy,Special Trial Judge,Adam B. Landy,[email protected],judge,landysChambers
3 changes: 2 additions & 1 deletion shared/admin-tools/user/add-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ const checkParams = params => {
'reportersOffice',
'ashfordsChambers',
'buchsChambers',
'choisChambers',
'cohensChambers',
'colvinsChambers',
'copelandsChambers',
'foleysChambers',
'friedsChambers',
'galesChambers',
'goekesChambers',
'greavesChambers',
Expand All @@ -103,6 +103,7 @@ const checkParams = params => {
'negasChambers',
'parisChambers',
'pughsChambers',
'siegelsChambers',
'thorntonsChambers',
'torosChambers',
'urdasChambers',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ describe('createMessageInteractor', () => {
});

it('creates the message', async () => {
const mockAttachments = [
{
documentId: 'b1130321-0a76-43bc-b3eb-64a18f079873',
},
{
documentId: 'b1130321-0a69-43bc-b3eb-64a18f079873',
},
];

const messageData = {
attachments: [
{
documentId: 'b1130321-0a76-43bc-b3eb-64a18f079873',
},
],
docketNumber: '101-20',
isRepliedTo: false,
message: "How's it going?",
Expand Down Expand Up @@ -70,6 +74,7 @@ describe('createMessageInteractor', () => {

await createMessageInteractor(applicationContext, {
...messageData,
attachments: mockAttachments,
});

expect(
Expand All @@ -80,6 +85,7 @@ describe('createMessageInteractor', () => {
.message,
).toMatchObject({
...messageData,
attachments: mockAttachments,
caseStatus: CASE_STATUS_TYPES.generalDocket,
caseTitle: 'Guy Fieri',
docketNumber: '101-20',
Expand Down
43 changes: 21 additions & 22 deletions shared/src/business/useCases/messages/createMessageInteractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,25 @@ import {
} from '../../../authorization/authorizationClientService';
import { UnauthorizedError } from '../../../../../web-api/src/errors/errors';

/**
* creates a message on a case
*
* @param {object} applicationContext the application context
* @param {object} providers the providers object
* @param {array} providers.attachments array of objects containing documentId and documentTitle
* @param {string} providers.docketNumber the docket number of the case
* @param {string} providers.message the message text
* @param {string} providers.subject the message subject
* @param {string} providers.toSection the section of the user receiving the message
* @param {string} providers.toUserId the user id of the user receiving the message
* @returns {object} the created message
*/
export type MessageType = {
attachments: {
documentId: string;
}[];
message: string;
subject: string;
toSection: string;
toUserId: string;
};

export type MessageWithMetaData = MessageType & {
docketNumber: string;
};

export type ReplyMessageType = MessageType & {
parentMessageId: string;
docketNumber: string;
};

export const createMessageInteractor = async (
applicationContext: IApplicationContext,
{
Expand All @@ -28,15 +34,8 @@ export const createMessageInteractor = async (
subject,
toSection,
toUserId,
}: {
attachments: any;
docketNumber: string;
message: string;
subject: string;
toSection: string;
toUserId: string;
},
) => {
}: MessageWithMetaData,
): Promise<RawMessage> => {
const authorizedUser = applicationContext.getCurrentUser();

if (!isAuthorized(authorizedUser, ROLE_PERMISSIONS.SEND_RECEIVE_MESSAGES)) {
Expand Down
29 changes: 4 additions & 25 deletions shared/src/business/useCases/messages/forwardMessageInteractor.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
import { ReplyMessageType } from '@shared/business/useCases/messages/createMessageInteractor';
import { replyToMessage } from './replyToMessageInteractor';

/**
* forwards a message
*
* @param {object} applicationContext the application context
* @param {object} providers the providers object
* @param {array} providers.attachments array of objects containing documentId and documentTitle
* @param {string} providers.docketNumber the docket number of the case
* @param {string} providers.message the message text
* @param {string} providers.parentMessageId the id of the parent message for the thread
* @param {string} providers.subject the message subject
* @param {string} providers.toSection the section of the user receiving the message
* @param {string} providers.toUserId the user id of the user receiving the message
* @returns {object} the message
*/
export const forwardMessageInteractor = async (
applicationContext,
applicationContext: IApplicationContext,
{
attachments,
docketNumber,
Expand All @@ -24,16 +11,8 @@ export const forwardMessageInteractor = async (
subject,
toSection,
toUserId,
}: {
attachments: any;
docketNumber: string;
message: string;
parentMessageId: string;
subject: string;
toSection: string;
toUserId: string;
},
) => {
}: ReplyMessageType,
): Promise<RawMessage> => {
return await replyToMessage(applicationContext, {
attachments,
docketNumber,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ import { applicationContext } from '../../test/createTestApplicationContext';
import { replyToMessageInteractor } from './replyToMessageInteractor';

describe('replyToMessageInteractor', () => {
const mockAttachments = [
{
documentId: 'b1130321-0a76-43bc-b3eb-64a18f079873',
},
{
documentId: 'b1130321-0a69-43bc-b3eb-64a18f079873',
},
];

it('throws unauthorized for a user without MESSAGES permission', async () => {
applicationContext.getCurrentUser.mockReturnValue({
role: ROLES.petitioner,
Expand All @@ -16,11 +25,7 @@ describe('replyToMessageInteractor', () => {

await expect(
replyToMessageInteractor(applicationContext, {
attachments: [
{
documentId: 'b1130321-0a76-43bc-b3eb-64a18f079873',
},
],
attachments: mockAttachments,
docketNumber: '101-20',
message: "How's it going?",
parentMessageId: '62ea7e6e-8101-4e4b-9bbd-932b149c86c3',
Expand All @@ -33,11 +38,6 @@ describe('replyToMessageInteractor', () => {

it('creates the message reply and marks the parent message as replied to', async () => {
const messageData = {
attachments: [
{
documentId: 'b1130321-0a76-43bc-b3eb-64a18f079873',
},
],
docketNumber: '101-20',
message: "How's it going?",
parentMessageId: '62ea7e6e-8101-4e4b-9bbd-932b149c86c3',
Expand Down Expand Up @@ -75,6 +75,7 @@ describe('replyToMessageInteractor', () => {

await replyToMessageInteractor(applicationContext, {
...messageData,
attachments: mockAttachments,
});

expect(
Expand All @@ -85,6 +86,7 @@ describe('replyToMessageInteractor', () => {
.message,
).toMatchObject({
...messageData,
attachments: mockAttachments,
caseStatus: CASE_STATUS_TYPES.generalDocket,
caseTitle: 'Guy Fieri',
docketNumber: '101-20',
Expand Down
53 changes: 5 additions & 48 deletions shared/src/business/useCases/messages/replyToMessageInteractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,9 @@ import {
ROLE_PERMISSIONS,
isAuthorized,
} from '../../../authorization/authorizationClientService';
import { ReplyMessageType } from '@shared/business/useCases/messages/createMessageInteractor';
import { UnauthorizedError } from '../../../../../web-api/src/errors/errors';

/**
* calls persistence methods to create a reply state for a message
*
* @param {object} applicationContext the application context
* @param {object} providers the providers object
* @param {array} providers.attachments array of objects containing documentId and documentTitle
* @param {string} providers.docketNumber the docket number of the case
* @param {string} providers.message the message text
* @param {string} providers.parentMessageId the id of the parent message for the thread
* @param {string} providers.subject the message subject
* @param {string} providers.toSection the section of the user receiving the message
* @param {string} providers.toUserId the user id of the user receiving the message
* @returns {object} validated raw message object
*/
export const replyToMessage = async (
applicationContext: IApplicationContext,
{
Expand All @@ -30,16 +17,8 @@ export const replyToMessage = async (
subject,
toSection,
toUserId,
}: {
attachments: any;
docketNumber: string;
message: string;
parentMessageId: string;
subject: string;
toSection: string;
toUserId: string;
},
) => {
}: ReplyMessageType,
): Promise<RawMessage> => {
const authorizedUser = applicationContext.getCurrentUser();

if (!isAuthorized(authorizedUser, ROLE_PERMISSIONS.SEND_RECEIVE_MESSAGES)) {
Expand Down Expand Up @@ -94,20 +73,6 @@ export const replyToMessage = async (
return validatedRawMessage;
};

/**
* replies to a message
*
* @param {object} applicationContext the application context
* @param {object} providers the providers object
* @param {array} providers.attachments array of objects containing documentId and documentTitle
* @param {string} providers.docketNumber the docket number of the case
* @param {string} providers.message the message text
* @param {string} providers.parentMessageId the id of the parent message for the thread
* @param {string} providers.subject the message subject
* @param {string} providers.toSection the section of the user receiving the message
* @param {string} providers.toUserId the user id of the user receiving the message
* @returns {object} the message
*/
export const replyToMessageInteractor = (
applicationContext: IApplicationContext,
{
Expand All @@ -118,16 +83,8 @@ export const replyToMessageInteractor = (
subject,
toSection,
toUserId,
}: {
attachments: any;
docketNumber: string;
message: string;
parentMessageId: string;
subject: string;
toSection: string;
toUserId: string;
},
) => {
}: ReplyMessageType,
): Promise<RawMessage> => {
return replyToMessage(applicationContext, {
attachments,
docketNumber,
Expand Down
3 changes: 2 additions & 1 deletion shared/src/business/utilities/DateHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const FORMATS = {
} as const;
const FORMATS1 = Object.values(FORMATS);
export type TimeFormats = (typeof FORMATS1)[number];
export type TimeFormatNames = keyof typeof FORMATS;

export const PATTERNS = {
'H:MM': /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/, // hour can be specified with either one OR two digits.
Expand Down Expand Up @@ -240,7 +241,7 @@ export const createISODateStringFromObject = options => {
*/
export const formatDateString = (
dateString,
formatArg: TimeFormats = FORMATS.ISO,
formatArg: TimeFormatNames | TimeFormats = FORMATS.ISO,
) => {
if (!dateString) return;
let formatString = FORMATS[formatArg] || formatArg;
Expand Down
8 changes: 7 additions & 1 deletion shared/src/business/utilities/getFormattedCaseDetail.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ describe('getFormattedCaseDetail', () => {
const result = getFormattedCaseDetail({
applicationContext,
caseDetail: {
...MOCK_CASE,
docketEntries: [
{
docketEntryId: 'd-1-2-3',
Expand Down Expand Up @@ -526,6 +527,7 @@ describe('getFormattedCaseDetail', () => {
const result = getFormattedCaseDetail({
applicationContext,
caseDetail: {
...MOCK_CASE,
petitionPaymentDate: '2019-03-01T21:40:46.415Z',
petitionPaymentMethod: 'check',
petitionPaymentStatus: PAYMENT_STATUS.PAID,
Expand All @@ -539,6 +541,7 @@ describe('getFormattedCaseDetail', () => {
const result = getFormattedCaseDetail({
applicationContext,
caseDetail: {
...MOCK_CASE,
petitionPaymentStatus: PAYMENT_STATUS.WAIVED,
petitionPaymentWaivedDate: '2019-03-01T21:40:46.415Z',
},
Expand All @@ -550,7 +553,10 @@ describe('getFormattedCaseDetail', () => {
it('should format filing fee string for an unpaid petition fee', () => {
const result = getFormattedCaseDetail({
applicationContext,
caseDetail: { petitionPaymentStatus: PAYMENT_STATUS.UNPAID },
caseDetail: {
...MOCK_CASE,
petitionPaymentStatus: PAYMENT_STATUS.UNPAID,
},
});

expect(result.filingFee).toEqual(`${PAYMENT_STATUS.UNPAID} `);
Expand Down
Loading

0 comments on commit 86be5cc

Please sign in to comment.