Skip to content

Commit

Permalink
Merge pull request #5 from NexusDevTeam/setup/init-setup-dynamodb
Browse files Browse the repository at this point in the history
feat: ✨ init config user table
  • Loading branch information
antfconeto authored Feb 17, 2025
2 parents 3e04ef6 + 25f8513 commit d7afd53
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
29 changes: 29 additions & 0 deletions lib/dynamodb-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {aws_dynamodb as dynamodb, Stack} from 'aws-cdk-lib'

export class DynamoDBSetup{
private userTable:dynamodb.Table;
private stack:Stack

constructor(stackParameter: Stack){
this.stack = stackParameter
}


setupUserTable():void{
this.userTable = new dynamodb.Table(this.stack,'UserTableIdentifier',{
partitionKey:{
name:"PK",
type:dynamodb.AttributeType.STRING
},
sortKey:{
name:"SK",
type:dynamodb.AttributeType.STRING
},
billingMode:dynamodb.BillingMode.PAY_PER_REQUEST
})
}

getUserTable():dynamodb.Table{
return this.userTable;
}
}
11 changes: 4 additions & 7 deletions lib/svc-user-stack.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { DynamoDBSetup } from './dynamodb-setup';
// import * as sqs from 'aws-cdk-lib/aws-sqs';

export class SvcUserStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);

// The code that defines your stack goes here

// example resource
// const queue = new sqs.Queue(this, 'SvcUserQueue', {
// visibilityTimeout: cdk.Duration.seconds(300)
// });
//---------Setup DynamoDB----------//
const dynamodbSetup = new DynamoDBSetup(this)
dynamodbSetup.setupUserTable()
}
}

0 comments on commit d7afd53

Please sign in to comment.