forked from ustaxcourt/ef-cms
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #379 from flexion/113_lambdas
113 Lambdas and Interactor Skeletons
- Loading branch information
Showing
13 changed files
with
336 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const { getAuthHeader } = require('../middleware/apiGatewayHelper'); | ||
const { handle } = require('../middleware/apiGatewayHelper'); | ||
const applicationContext = require('../applicationContext'); | ||
|
||
/** | ||
* getWorkItem | ||
* | ||
* @param event | ||
* @returns {Promise<*|undefined>} | ||
*/ | ||
exports.get = event => | ||
handle(() => | ||
applicationContext.getUseCases().getWorkItem({ | ||
userId: getAuthHeader(event), | ||
workItemId: event.pathParameters.workItemId, | ||
applicationContext, | ||
}), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const { getAuthHeader, handle } = require('../middleware/apiGatewayHelper'); | ||
const applicationContext = require('../applicationContext'); | ||
|
||
/** | ||
* GET WorkItems API Lambda | ||
* | ||
* @param event | ||
* @param context | ||
* @param callback | ||
*/ | ||
|
||
exports.get = event => | ||
handle(() => { | ||
const userId = getAuthHeader(event); | ||
return applicationContext.getUseCases().getWorkItems({ userId: userId, applicationContext}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const { handle, getAuthHeader } = require('../middleware/apiGatewayHelper'); | ||
const applicationContext = require('../applicationContext'); | ||
|
||
/** | ||
* updateCase | ||
* | ||
* @param event | ||
* @returns {Promise<*|undefined>} | ||
*/ | ||
exports.put = event => | ||
handle(() => { | ||
const userId = getAuthHeader(event); | ||
return applicationContext.getUseCases().updateWorkItem({ | ||
workItemId: event.pathParameters.workItemId, | ||
workItemToUpdate: JSON.parse(event.body), | ||
userId, | ||
applicationContext, | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
shared/src/business/useCases/workitems/getWorkItem.interactor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// const { | ||
// isAuthorized, | ||
// WORKITEM, | ||
// } = require('../../authorization/authorizationClientService'); | ||
// const { NotFoundError, UnauthorizedError } = require('../../errors/errors'); | ||
// const WorkItem = require('../entities/WorkItem'); | ||
|
||
/** | ||
* getWorkItem | ||
* | ||
* @param userId | ||
* @param workItemId | ||
* @param applicationContext | ||
* @returns {Promise<*>} | ||
*/ | ||
exports.getWorkItem = async ({ userId, workItemId, applicationContext }) => { | ||
// const workItem = await applicationContext | ||
// .getPersistenceGateway() | ||
// .getWorkItemById({ | ||
// workItemId, | ||
// applicationContext, | ||
// }); | ||
// | ||
// if (!workItem) { | ||
// throw new NotFoundError(`WorkItem ${workItemId} was not found.`); | ||
// } | ||
// | ||
|
||
// | ||
// return new WorkItem(workItem).validate().toJSON(); | ||
//MOCK REMOVE WHEN IMPLEMENTED | ||
let ctx = applicationContext; | ||
return { | ||
workItemId: workItemId, | ||
assigneeId: userId, | ||
docketNumber: '101-18', | ||
ctx: ctx.getUseCases().getWorkItem !== undefined, | ||
}; | ||
}; |
Oops, something went wrong.