@@ -55,6 +55,13 @@ export class JProfByBotStack extends cdk.Stack {
5555 billingMode : dynamodb . BillingMode . PAY_PER_REQUEST ,
5656 removalPolicy : cdk . RemovalPolicy . DESTROY ,
5757 } ) ;
58+ const timezonesTable = new dynamodb . Table ( this , 'jprof-by-bot-table-timezones' , {
59+ tableName : 'jprof-by-bot-table-timezones' ,
60+ partitionKey : { name : 'user' , type : dynamodb . AttributeType . NUMBER } ,
61+ sortKey : { name : 'chat' , type : dynamodb . AttributeType . NUMBER } ,
62+ billingMode : dynamodb . BillingMode . PAY_PER_REQUEST ,
63+ removalPolicy : cdk . RemovalPolicy . DESTROY ,
64+ } ) ;
5865
5966 pinsTable . addGlobalSecondaryIndex ( {
6067 indexName : 'chatId' ,
@@ -66,6 +73,12 @@ export class JProfByBotStack extends cdk.Stack {
6673 partitionKey : { name : 'userId' , type : dynamodb . AttributeType . NUMBER } ,
6774 projectionType : dynamodb . ProjectionType . ALL ,
6875 } ) ;
76+ timezonesTable . addGlobalSecondaryIndex ( {
77+ indexName : 'username' ,
78+ partitionKey : { name : 'username' , type : dynamodb . AttributeType . STRING } ,
79+ sortKey : { name : 'chat' , type : dynamodb . AttributeType . NUMBER } ,
80+ projectionType : dynamodb . ProjectionType . ALL ,
81+ } ) ;
6982
7083 const lambdaUnpin = new lambda . Function ( this , 'jprof-by-bot-lambda-unpin' , {
7184 functionName : 'jprof-by-bot-lambda-unpin' ,
@@ -123,6 +136,7 @@ export class JProfByBotStack extends cdk.Stack {
123136 'TABLE_QUIZOJIS' : quizojisTable . tableName ,
124137 'TABLE_MONIES' : moniesTable . tableName ,
125138 'TABLE_PINS' : pinsTable . tableName ,
139+ 'TABLE_TIMEZONES' : timezonesTable . tableName ,
126140 'STATE_MACHINE_UNPINS' : stateMachineUnpin . stateMachineArn ,
127141 'TOKEN_TELEGRAM_BOT' : props . telegramToken ,
128142 'TOKEN_YOUTUBE_API' : props . youtubeToken ,
@@ -144,6 +158,8 @@ export class JProfByBotStack extends cdk.Stack {
144158 pinsTable . grantReadWriteData ( lambdaWebhook ) ;
145159 pinsTable . grantReadWriteData ( lambdaUnpin ) ;
146160
161+ timezonesTable . grantReadWriteData ( lambdaWebhook ) ;
162+
147163 stateMachineUnpin . grantStartExecution ( lambdaWebhook )
148164
149165 const api = new apigateway . RestApi ( this , 'jprof-by-bot-api' , {
0 commit comments