Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dynamodb): add dynamodb storage adapter #206

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

manueltarouca
Copy link

In this pull request I add an additional storage adapter for DynamoDB.
Let me know if you have questions.

Best regards,
Manuel Tarouca

Copy link
Member

@Satont Satont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi.

Thanks for your contribution, really appreciate this.

But can you please do few changes?

"name": "@grammyjs/storage-dynamodb",
"version": "2.4.0",
"description": "AWS DynamoDB storage adapter for grammY",
"types": "dist/index.d.ts",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think main field missed there?

Comment on lines +29 to +31
if (item) {
return JSON.parse(item.Value.S) as T;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should response with null in case item not found.

Comment on lines +32 to +34
} catch (error) {
console.error('Error reading item from DynamoDB:', error);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we shouldn't catch something there and especially logging.

try {
await this.client.send(putItemCommand);
} catch (error) {
console.error('Error writing item to DynamoDB:', error);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trycatch please.

try {
await this.client.send(deleteItemCommand);
} catch (error) {
console.error('Error deleting item from DynamoDB:', error);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trycatch please.

@Satont Satont changed the title feat(dynamodb): added dynamodb storage adapter feat(dynamodb): add dynamodb storage adapter Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants