Skip to content

Commit

Permalink
feat: adding processor
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonNotJson committed Sep 30, 2023
1 parent 97bae4e commit b71b6ef
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions lib/constructs/persistence/data-pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}` }],
}),
);
}
}
}

Expand Down

0 comments on commit b71b6ef

Please sign in to comment.