Skip to content

Commit

Permalink
Merge pull request #1082 from flexion/bug/section_required_forward_wo…
Browse files Browse the repository at this point in the history
…rk_item

"Section required" Bug when forwarding a work item
  • Loading branch information
codyseibert authored Mar 13, 2019
2 parents 6b8d28d + eba9c6c commit c43b20e
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 14 deletions.
75 changes: 75 additions & 0 deletions efcms-service/storage/fixtures/efcms.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@
}
],
"sk": "0",

"caseTitle": "Selma Horn & Cairo Harris, Petitioners v. Commissioner of Internal Revenue, Respondent",
"initialCaption": "Selma Horn & Cairo Harris, Petitioners v. Commissioner of Internal Revenue, Respondent",
"filingType": "Myself",
"pk": "491b05b4-483f-4b85-8dd7-2dd4c069eb50",
"hasIrsNotice": false,
Expand Down Expand Up @@ -495,6 +498,9 @@
"createdAt": "2019-03-01T21:42:29.073Z",
"caseId": "fa1179bd-04f5-4934-a716-964d8d7babc6",
"sk": "0",

"caseTitle": "Selma Horn & Cairo Harris, Petitioners v. Commissioner of Internal Revenue, Respondent",
"initialCaption": "Selma Horn & Cairo Harris, Petitioners v. Commissioner of Internal Revenue, Respondent",
"filingType": "Myself and my spouse",
"hasIrsNotice": true,
"petitioners": [
Expand Down Expand Up @@ -833,6 +839,9 @@
"payGovId": null,
"caseId": "5f6e8b8e-4fac-4fd7-bf3c-42f0d7c3ca05",
"sk": "0",

"caseTitle": "Selma Horn & Cairo Harris, Petitioners v. Commissioner of Internal Revenue, Respondent",
"initialCaption": "Selma Horn & Cairo Harris, Petitioners v. Commissioner of Internal Revenue, Respondent",
"filingType": "A business",
"orderForOds": true,
"orderForRatification": true,
Expand Down Expand Up @@ -2010,6 +2019,40 @@
"userId": "1805d1ab-18d0-43ec-bafb-654e83405416",
"email": "docketclerk"
},

{
"password": "Testing1234$",
"role": "seniorattorney",
"sk": "6805d1ab-18d0-43ec-bafb-654e83405416",
"name": "Test Seniorattorney",
"section": "seniorattorney",
"pk": "seniorattorney|user",
"userId": "6805d1ab-18d0-43ec-bafb-654e83405416",
"email": "seniorattorney"
},

{
"password": "Testing1234$",
"role": "seniorattorney",
"sk": "6805d1ab-18d0-43ec-bafb-654e83405416",
"name": "Test Seniorattorney",
"section": "seniorattorney",
"pk": "6805d1ab-18d0-43ec-bafb-654e83405416",
"userId": "6805d1ab-18d0-43ec-bafb-654e83405416",
"email": "seniorattorney"
},


{
"password": "Testing1234$",
"role": "docketclerk",
"sk": "1805d1ab-18d0-43ec-bafb-654e83405416",
"name": "Test Docketclerk",
"section": "docket",
"pk": "1805d1ab-18d0-43ec-bafb-654e83405416",
"userId": "1805d1ab-18d0-43ec-bafb-654e83405416",
"email": "docketclerk"
},
{
"password": "Testing1234$",
"role": "docketclerk",
Expand All @@ -2020,6 +2063,16 @@
"userId": "2805d1ab-18d0-43ec-bafb-654e83405416",
"email": "docketclerk1"
},
{
"password": "Testing1234$",
"role": "docketclerk",
"sk": "2805d1ab-18d0-43ec-bafb-654e83405416",
"name": "Test Docketclerk1",
"section": "docket",
"pk": "2805d1ab-18d0-43ec-bafb-654e83405416",
"userId": "2805d1ab-18d0-43ec-bafb-654e83405416",
"email": "docketclerk1"
},
{
"docketNumberSuffix": null,
"caseStatus": "New",
Expand Down Expand Up @@ -2255,6 +2308,8 @@
}
],
"sk": "0",
"caseTitle": "Selma Horn & Cairo Harris, Petitioners v. Commissioner of Internal Revenue, Respondent",
"initialCaption": "Selma Horn & Cairo Harris, Petitioners v. Commissioner of Internal Revenue, Respondent",
"filingType": "Myself",
"pk": "2fa6da8d-4328-4a20-a5d7-b76637e1dc02",
"hasIrsNotice": false,
Expand Down Expand Up @@ -2423,6 +2478,16 @@
"userId": "3805d1ab-18d0-43ec-bafb-654e83405416",
"email": "petitionsclerk"
},
{
"password": "Testing1234$",
"role": "petitionsclerk",
"sk": "3805d1ab-18d0-43ec-bafb-654e83405416",
"name": "Test Petitionsclerk",
"section": "petitions",
"pk": "3805d1ab-18d0-43ec-bafb-654e83405416",
"userId": "3805d1ab-18d0-43ec-bafb-654e83405416",
"email": "petitionsclerk"
},
{
"password": "Testing1234$",
"role": "petitionsclerk",
Expand All @@ -2433,6 +2498,16 @@
"userId": "4805d1ab-18d0-43ec-bafb-654e83405416",
"email": "petitionsclerk1"
},
{
"password": "Testing1234$",
"role": "petitionsclerk",
"sk": "4805d1ab-18d0-43ec-bafb-654e83405416",
"name": "Test Petitionsclerk1",
"section": "petitions",
"pk": "4805d1ab-18d0-43ec-bafb-654e83405416",
"userId": "4805d1ab-18d0-43ec-bafb-654e83405416",
"email": "petitionsclerk1"
},
{
"sk": "2611344f-f7bf-4f47-8ba0-60c70cb25446",
"pk": "petitions|workItem"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ exports.forwardWorkItem = async ({
const userToForwardTo = new User(
await applicationContext
.getPersistenceGateway()
.getUserById({ userId: assigneeId }),
.getUserById({ applicationContext, userId: assigneeId }),
);

const workItemToForward = await applicationContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ exports.updateWorkItem = async ({
const otherUser = new User(
await applicationContext
.getPersistenceGateway()
.getUserById({ userId: workItemToUpdate.assigneeId }),
.getUserById({ applicationContext, userId: workItemToUpdate.assigneeId }),
);
workItemToUpdate.assigneeName = otherUser.name;

Expand Down
23 changes: 11 additions & 12 deletions shared/src/persistence/dynamo/users/getUserById.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,21 @@ exports.userMap = {
},
};

const userByIDMap = {
'1805d1ab-18d0-43ec-bafb-654e83405416': exports.userMap.docketclerk,
'2805d1ab-18d0-43ec-bafb-654e83405416': exports.userMap.docketclerk1,
'3805d1ab-18d0-43ec-bafb-654e83405416': exports.userMap.petitionsclerk,
'4805d1ab-18d0-43ec-bafb-654e83405416': exports.userMap.petitionsclerk1,
'5805d1ab-18d0-43ec-bafb-654e83405416': exports.userMap.respondent,
'6805d1ab-18d0-43ec-bafb-654e83405416': exports.userMap.seniorattorney,
'7805d1ab-18d0-43ec-bafb-654e83405416': exports.userMap.taxpayer,
};
const client = require('../../dynamodbClientService');

/**
* getUserById
* @param userId
* @returns {*}
*/
exports.getUserById = async ({ userId }) => {
// TODO: should hit cognito to fetch the user data
return userByIDMap[userId] || exports.userMap[userId];
exports.getUserById = async ({ applicationContext, userId }) => {
const TABLE = `efcms-${applicationContext.environment.stage}`;
return client.get({
applicationContext,
Key: {
pk: userId,
sk: userId,
},
TableName: TABLE,
});
};

0 comments on commit c43b20e

Please sign in to comment.