@@ -37,6 +37,7 @@ export async function setupDynamoDBContainer() {
3737 lettersTtlHours : 1 ,
3838 letterQueueTtlHours : 1 ,
3939 miTtlHours : 1 ,
40+ supplierConfigTableName : "supplier-config" ,
4041 } ;
4142
4243 return {
@@ -146,6 +147,31 @@ const createLetterQueueTableCommand = new CreateTableCommand({
146147 { AttributeName : "queueSortOrderSk" , AttributeType : "S" } ,
147148 ] ,
148149} ) ;
150+ const createSupplierConfigTableCommand = new CreateTableCommand ( {
151+ TableName : "supplier-config" ,
152+ BillingMode : "PAY_PER_REQUEST" ,
153+ KeySchema : [
154+ { AttributeName : "PK" , KeyType : "HASH" } , // Partition key
155+ { AttributeName : "SK" , KeyType : "RANGE" } , // Sort key
156+ ] ,
157+ GlobalSecondaryIndexes : [
158+ {
159+ IndexName : "volumeGroup-index" ,
160+ KeySchema : [
161+ { AttributeName : "PK" , KeyType : "HASH" } , // Partition key for GSI
162+ { AttributeName : "volumeGroup" , KeyType : "RANGE" } , // Sort key for GSI
163+ ] ,
164+ Projection : {
165+ ProjectionType : "ALL" ,
166+ } ,
167+ } ,
168+ ] ,
169+ AttributeDefinitions : [
170+ { AttributeName : "PK" , AttributeType : "S" } ,
171+ { AttributeName : "SK" , AttributeType : "S" } ,
172+ { AttributeName : "volumeGroup" , AttributeType : "S" } ,
173+ ] ,
174+ } ) ;
149175
150176export async function createTables ( context : DBContext ) {
151177 const { ddbClient } = context ;
@@ -156,6 +182,7 @@ export async function createTables(context: DBContext) {
156182 await ddbClient . send ( createMITableCommand ) ;
157183 await ddbClient . send ( createSupplierTableCommand ) ;
158184 await ddbClient . send ( createLetterQueueTableCommand ) ;
185+ await ddbClient . send ( createSupplierConfigTableCommand ) ;
159186}
160187
161188export async function deleteTables ( context : DBContext ) {
@@ -166,6 +193,7 @@ export async function deleteTables(context: DBContext) {
166193 "management-info" ,
167194 "suppliers" ,
168195 "letter-queue" ,
196+ "supplier-config" ,
169197 ] ) {
170198 await ddbClient . send (
171199 new DeleteTableCommand ( {
0 commit comments