Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

feat: use new TableV2 construct #1179

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions code/typescript/main-workshop/lib/cdk-workshop-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ export class CdkWorkshopStack extends cdk.Stack {
super(scope, id, props);

const hello = new lambda.Function(this, 'HelloHandler', {
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_16_X,
code: lambda.Code.fromAsset('lambda'),
handler: 'hello.handler',

});

const helloWithCounter = new HitCounter(this, 'HelloHitCounter', {
Expand All @@ -26,8 +25,9 @@ export class CdkWorkshopStack extends cdk.Stack {

new TableViewer(this, 'ViewHitCounter', {
title: 'Hello Hits',
table: helloWithCounter.table,
sortBy: '-hits'
// table: helloWithCounter.table, /** when cdk-dynamo-table-viewer supports TableV2 (https://github.com/cdklabs/cdk-dynamo-table-viewer/pull/737) */
table: helloWithCounter.table as any,
sortBy: '-hits',
});
}
}
4 changes: 2 additions & 2 deletions code/typescript/main-workshop/lib/hitcounter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ export class HitCounter extends Construct {
public readonly handler: lambda.Function;

/** the hit counter table */
public readonly table: dynamodb.Table;
public readonly table: dynamodb.TableV2;

constructor(scope: Construct, id: string, props: HitCounterProps) {
super(scope, id);

const table = new dynamodb.Table(this, 'Hits', {
const table = new dynamodb.TableV2(this, 'Hits', {
partitionKey: { name: 'path', type: dynamodb.AttributeType.STRING }
});
this.table = table;
Expand Down
74 changes: 37 additions & 37 deletions code/typescript/main-workshop/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/typescript/main-workshop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"typescript": "^4.3.5"
},
"dependencies": {
"aws-cdk-lib": "^2.76.0",
"aws-cdk-lib": "^2.96.2",
"constructs": "^10.0.5",
"cdk-dynamo-table-viewer": "^0.2.461"
}
Expand Down
Loading