EventStoreTable:
Type: 'AWS::DynamoDB::Table'
Properties:
TableName: someEntity ## <- your table name here
AttributeDefinitions:
- AttributeName: entityId
AttributeType: S
- AttributeName: version
AttributeType: N
- AttributeName: entityName
AttributeType: S
- AttributeName: commitId
AttributeType: S
KeySchema:
- AttributeName: entityId
KeyType: HASH
- AttributeName: version
KeyType: RANGE
GlobalSecondaryIndexes:
- IndexName: someEntityByCommitId ## <- your index name here
KeySchema:
- AttributeName: entityName
KeyType: HASH
- AttributeName: commitId
KeyType: RANGE
Projection:
ProjectionType: ALL
const dynamoAdapterBuilder = require('serverless-cqrs.dynamodb-adapter')
module.exports = dynamoAdapterBuilder.build({
entityName: 'todo'
}, {
tableName: 'todos',
indexName: 'todosByCommitId',
region: 'eu-west-1',
})