From 6c061b260bb53a36c376f18ea5cbeec9daa90eb8 Mon Sep 17 00:00:00 2001 From: "Y.H LIEN" Date: Thu, 12 Oct 2023 22:48:16 +0900 Subject: [PATCH 1/8] chore: fix sync imgs --- src/lambda/sync-image/index.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lambda/sync-image/index.py b/src/lambda/sync-image/index.py index 8dc8889eb..b2502ede7 100644 --- a/src/lambda/sync-image/index.py +++ b/src/lambda/sync-image/index.py @@ -10,7 +10,7 @@ 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, ads_id = key.split('/') # Create new item in the dynamoDB item = { @@ -29,6 +29,7 @@ def post_imgskey(key): def handler(event, context): + print(event) # Get event payload and get imgs information key = event['Records'][0]['s3']['object']['key'] From 5b22fc762c86affef6a06cdae3e716d6eaabff06 Mon Sep 17 00:00:00 2001 From: "Y.H LIEN" Date: Thu, 12 Oct 2023 23:26:00 +0900 Subject: [PATCH 2/8] chore: fix sync imgs2 --- src/lambda/sync-image/index.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lambda/sync-image/index.py b/src/lambda/sync-image/index.py index b2502ede7..ab6cf6d7a 100644 --- a/src/lambda/sync-image/index.py +++ b/src/lambda/sync-image/index.py @@ -33,5 +33,6 @@ def handler(event, context): # Get event payload and get imgs information key = event['Records'][0]['s3']['object']['key'] + print(key) return post_imgskey(key) From 9dcdd7c5a7df331b83502c36358a45df7d59622c Mon Sep 17 00:00:00 2001 From: "Y.H LIEN" Date: Thu, 12 Oct 2023 23:28:16 +0900 Subject: [PATCH 3/8] chore: fix sync imgs3 --- src/lambda/sync-image/index.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lambda/sync-image/index.py b/src/lambda/sync-image/index.py index ab6cf6d7a..1f6b6fba8 100644 --- a/src/lambda/sync-image/index.py +++ b/src/lambda/sync-image/index.py @@ -33,6 +33,6 @@ def handler(event, context): # Get event payload and get imgs information key = event['Records'][0]['s3']['object']['key'] - print(key) + print(key) # Try out the code return post_imgskey(key) From 45ec74452c7f853b4ef0b7271b77d7334de0b3bd Mon Sep 17 00:00:00 2001 From: "Y.H LIEN" Date: Fri, 13 Oct 2023 00:39:31 +0900 Subject: [PATCH 4/8] chore: fix sync imgs5 --- src/lambda/sync-image/index.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lambda/sync-image/index.py b/src/lambda/sync-image/index.py index 1f6b6fba8..21873ee73 100644 --- a/src/lambda/sync-image/index.py +++ b/src/lambda/sync-image/index.py @@ -34,5 +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) return post_imgskey(key) From d6c80939d16c44bec62ba975cc35a475d94e407a Mon Sep 17 00:00:00 2001 From: "Y.H LIEN" Date: Fri, 13 Oct 2023 00:53:32 +0900 Subject: [PATCH 5/8] fix: syncimgsneo --- src/lambda/sync-image/index.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lambda/sync-image/index.py b/src/lambda/sync-image/index.py index 21873ee73..c3652bc01 100644 --- a/src/lambda/sync-image/index.py +++ b/src/lambda/sync-image/index.py @@ -14,9 +14,9 @@ def post_imgskey(key): # Create new item in the dynamoDB item = { - 'board_id': {board_id}, - 'ads_id': {ads_id}, - 'timestamp': {dt_now} + 'board_id': board_id, + 'ads_id': ads_id, + 'timestamp': dt_now, } table.put_item( From 080cd1c597764449ebe2cb5631a94a6a55f9b199 Mon Sep 17 00:00:00 2001 From: "Y.H LIEN" Date: Fri, 13 Oct 2023 01:17:04 +0900 Subject: [PATCH 6/8] fix: syncimgsneo2 --- lib/constructs/persistence/database.ts | 2 +- src/lambda/sync-image/index.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/constructs/persistence/database.ts b/lib/constructs/persistence/database.ts index 9ba3e9ca2..90d142904 100644 --- a/lib/constructs/persistence/database.ts +++ b/lib/constructs/persistence/database.ts @@ -150,7 +150,7 @@ export class DynamoDatabase extends Construct { 'dynamodb-ads-table', { partitionKey: { name: 'board_id', type: dynamodb.AttributeType.STRING }, - sortKey: { name: 'ad_id', type: dynamodb.AttributeType.STRING }, + sortKey: { name: 'ads_id', type: dynamodb.AttributeType.STRING }, billingMode: dynamodb.BillingMode.PROVISIONED, encryption: dynamodb.TableEncryption.DEFAULT, removalPolicy: RemovalPolicy.RETAIN, diff --git a/src/lambda/sync-image/index.py b/src/lambda/sync-image/index.py index c3652bc01..037f85d84 100644 --- a/src/lambda/sync-image/index.py +++ b/src/lambda/sync-image/index.py @@ -16,7 +16,7 @@ def post_imgskey(key): item = { 'board_id': board_id, 'ads_id': ads_id, - 'timestamp': dt_now, + 'timestamp': dt_now } table.put_item( From 33fe888d0a15a1f3df8251961ed24d009f6c6aa6 Mon Sep 17 00:00:00 2001 From: "Y.H LIEN" Date: Fri, 13 Oct 2023 01:43:02 +0900 Subject: [PATCH 7/8] fix: syncimgsneo3 --- lib/constructs/persistence/database.ts | 2 +- src/lambda/sync-image/index.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/constructs/persistence/database.ts b/lib/constructs/persistence/database.ts index 90d142904..9ba3e9ca2 100644 --- a/lib/constructs/persistence/database.ts +++ b/lib/constructs/persistence/database.ts @@ -150,7 +150,7 @@ export class DynamoDatabase extends Construct { 'dynamodb-ads-table', { partitionKey: { name: 'board_id', type: dynamodb.AttributeType.STRING }, - sortKey: { name: 'ads_id', type: dynamodb.AttributeType.STRING }, + sortKey: { name: 'ad_id', type: dynamodb.AttributeType.STRING }, billingMode: dynamodb.BillingMode.PROVISIONED, encryption: dynamodb.TableEncryption.DEFAULT, removalPolicy: RemovalPolicy.RETAIN, diff --git a/src/lambda/sync-image/index.py b/src/lambda/sync-image/index.py index 037f85d84..490af8427 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) From 53ff8064cd2b008a15a56c2db6cec8d5a7b06d80 Mon Sep 17 00:00:00 2001 From: "Y.H LIEN" Date: Fri, 13 Oct 2023 01:45:15 +0900 Subject: [PATCH 8/8] fix: syncimgsneo4 --- lib/constructs/persistence/database.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/constructs/persistence/database.ts b/lib/constructs/persistence/database.ts index 9ba3e9ca2..991378560 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: 'ad_id', type: dynamodb.AttributeType.STRING },