From b71b6efbd28304160161727fe4058c12cb053e4f Mon Sep 17 00:00:00 2001 From: Jason Park Date: Sun, 1 Oct 2023 02:05:35 +0900 Subject: [PATCH] feat: adding processor --- lib/constructs/persistence/data-pipeline.ts | 44 ++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/constructs/persistence/data-pipeline.ts b/lib/constructs/persistence/data-pipeline.ts index 0ec59d4e4..598d4691e 100644 --- a/lib/constructs/persistence/data-pipeline.ts +++ b/lib/constructs/persistence/data-pipeline.ts @@ -243,28 +243,28 @@ export class ThreadImgDataPipeline extends AbstractDataPipeline { }); this.dataWarehouse.addToResourcePolicy(publicReadStatement); - // this.processor = new ThreadImageProcessFunctions( - // this, - // 'image-process-func', - // { - // envVars: { - // INPUT_BUCKET: this.dataSource.bucketName, - // OUTPUT_BUCKET: this.dataWarehouse.bucketName, - // TABLE_NAME: 'wasedatime-thread-img', - // }, - // }, - // ).resizeImageFunction; - - // const supportedExtensions = ['jpeg', 'png', 'gif', 'jpg']; - - // for (const ext of supportedExtensions) { - // this.processor.addEventSource( - // new event_sources.S3EventSource(this.dataSource, { - // events: [s3.EventType.OBJECT_CREATED_PUT], - // filters: [{ prefix: `/image.${ext}` }], - // }), - // ); - // } + this.processor = new ThreadImageProcessFunctions( + this, + 'image-process-func', + { + envVars: { + INPUT_BUCKET: this.dataSource.bucketName, + OUTPUT_BUCKET: this.dataWarehouse.bucketName, + TABLE_NAME: 'wasedatime-thread-img', + }, + }, + ).resizeImageFunction; + + const supportedExtensions = ['jpeg', 'png', 'gif', 'jpg']; + + for (const ext of supportedExtensions) { + this.processor.addEventSource( + new event_sources.S3EventSource(this.dataSource, { + events: [s3.EventType.OBJECT_CREATED_PUT], + filters: [{ prefix: `/image.${ext}` }], + }), + ); + } } }