diff --git a/lib/constructs/persistence/database.ts b/lib/constructs/persistence/database.ts index 90d142904..3c203dd56 100644 --- a/lib/constructs/persistence/database.ts +++ b/lib/constructs/persistence/database.ts @@ -147,7 +147,7 @@ export class DynamoDatabase extends Construct { this.tables[Collection.ADS] = new dynamodb.Table( this, - 'dynamodb-ads-table', + 'dynamodb-abs-table', { partitionKey: { name: 'board_id', type: dynamodb.AttributeType.STRING }, sortKey: { name: 'ads_id', type: dynamodb.AttributeType.STRING }, diff --git a/src/lambda/sync-image/index.py b/src/lambda/sync-image/index.py index 037f85d84..8b448fde1 100644 --- a/src/lambda/sync-image/index.py +++ b/src/lambda/sync-image/index.py @@ -10,12 +10,12 @@ def post_imgskey(key): dt_now = datetime.now().strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z' # Creaet board_id, ads_id from the event payload we got - board_id, ads_id = key.split('/') - + board_id, ad_id = key.split('/') + # Create new item in the dynamoDB item = { 'board_id': board_id, - 'ads_id': ads_id, + 'ad_id': ad_id, 'timestamp': dt_now } @@ -34,7 +34,7 @@ def handler(event, context): # Get event payload and get imgs information key = event['Records'][0]['s3']['object']['key'] print(key) # Try out the code - board_id, ads_id = key.split('/') - print(board_id, ads_id) + board_id, ad_id = key.split('/') + print(board_id, ad_id) return post_imgskey(key)