Skip to content

Commit

Permalink
feat: init db wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
alinarublea committed Oct 19, 2023
1 parent 95ff60d commit 2418fb3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ function DB() {
};
}

const createDynamoDBService = () => Object.freeze({
getInstance: () => DB(),
});
const createDynamoDBService = () => DB();

export default { createDynamoDBService };
4 changes: 1 addition & 3 deletions src/service-wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ const serviceWrap = (
factoryFn,
) => {
if (!lambdaContext[paramName]) {
const service = factoryFn(lambdaContext);

// pass params by reference and not value so later modifications
// of the params are accessible to the wrap
// eslint-disable-next-line no-param-reassign
lambdaContext[paramName] = service.getInstance(lambdaContext);
lambdaContext[paramName] = factoryFn(lambdaContext);
}
return lambdaFn(lambdaContext);
};
Expand Down

0 comments on commit 2418fb3

Please sign in to comment.