Skip to content

Commit

Permalink
corrected type checking for conversations-clear.ts, groups-clear.ts, …
Browse files Browse the repository at this point in the history
…users-clear.ts (#8)
  • Loading branch information
OlehDulebaEpam authored Dec 18, 2023
1 parent f6d8d56 commit 912dcc4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/functions/conversations-clear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const handler = async (event: APIGatewayProxyEventV2) => {
const deleteTableQuery = client.send(deleteTableCommand);


return Promise.allSettled([deleteItemQuery, deleteTableQuery]).then(res => ({conversationID, result: res.status === 'fulfilled' ? res.value : res.reason}));
return Promise.allSettled([deleteItemQuery, deleteTableQuery]).then(res => ({conversationID, tableDeleted: res[1].status === 'fulfilled' ? res[1].value : res[1].reason, recordDeleted: res[0].status === 'fulfilled' ? res[0].value : res[0].reason}));
});

const response = await Promise.allSettled(deleteRequests);
Expand Down
2 changes: 1 addition & 1 deletion src/functions/groups-clear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const handler = async (event: APIGatewayProxyEventV2) => {
const deleteTableQuery = client.send(deleteTableCommand);


return Promise.allSettled([deleteItemQuery, deleteTableQuery]).then(res => ({groupID, result: res.status === 'fulfilled' ? res.value : res.reason}));
return Promise.allSettled([deleteItemQuery, deleteTableQuery]).then(res => ({groupID, tableDeleted: res[1].status === 'fulfilled' ? res[1].value : res[1].reason, recordDeleted: res[0].status === 'fulfilled' ? res[0].value : res[0].reason}));
});

const response = await Promise.allSettled(deleteRequests);
Expand Down
2 changes: 1 addition & 1 deletion src/functions/users-clear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const handler = async (event: APIGatewayProxyEventV2) => {
const deleteItemQuery = client.send(deleteItemCommand);


return deleteItemQuery.then(res => ({email, result: res.status === 'fulfilled' ? res.value : res.reason}));
return deleteItemQuery.then(res => ({email, recordDeleted: res}), reason => ({email, recordDeleted: reason}));
});

const response = await Promise.allSettled(deleteRequests);
Expand Down

0 comments on commit 912dcc4

Please sign in to comment.