Skip to content

feat(dynamodb): add dynamodb storage adapter#206

Open
manueltarouca wants to merge 3 commits into
grammyjs:mainfrom
manueltarouca:main
Open

feat(dynamodb): add dynamodb storage adapter#206
manueltarouca wants to merge 3 commits into
grammyjs:mainfrom
manueltarouca:main

Conversation

@manueltarouca
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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