Skip to content

Commit

Permalink
#962 Create WorkItem in sending user section sent outbox
Browse files Browse the repository at this point in the history
  • Loading branch information
wbyoko committed Mar 15, 2019
1 parent 8fda695 commit 41a4de8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion shared/src/persistence/dynamo/workitems/createWorkItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const {
* @returns {*}
*/
exports.createWorkItem = async ({ workItem, applicationContext }) => {
const user = applicationContext.getCurrentUser();

// create the work item
await put({
applicationContext,
Expand All @@ -31,6 +33,7 @@ exports.createWorkItem = async ({ workItem, applicationContext }) => {
type: 'workItem',
});

// sending user 'my' outbox
await put({
applicationContext,
Item: {
Expand All @@ -48,10 +51,11 @@ exports.createWorkItem = async ({ workItem, applicationContext }) => {
type: 'workItem',
});

// sending user section outbox
await put({
applicationContext,
Item: {
pk: `${workItem.section}|outbox`,
pk: `${user.section}|outbox`,
sk: workItem.createdAt,
...workItem,
},
Expand Down

0 comments on commit 41a4de8

Please sign in to comment.