Initializes the S3Service by setting up the S3 client and bucket names based on the provided configuration. The constructor retrieves necessary configuration values such as AWS credentials, region, endpoint, and bucket names for different types of images (book covers, author images, profile pictures). If any required configuration value is missing, an error will be thrown during initialization.
The type of bucket from which to delete images ('author', 'book', or 'profile').
File keys to delete
Sharp for image processing and upload to S3
Multer file object
bucket type ('author' | 'book' | 'profile')
Image name base for generating file names
An object containing URLs and keys of the uploaded images
This method takes an uploaded file, processes it using Sharp to create different sizes based on the specified bucket type, and uploads the processed images to S3. The method generates unique file names to avoid collisions and returns the URLs and keys of the uploaded images. If any error occurs during processing or uploading, an InternalServerErrorException is thrown.
The configuration service for retrieving S3 configuration values. Its from s3.config.ts which is a nestjs/config package and is used to access environment variables and other configuration settings required for S3 operations.