import { UploadedFileTypes } from '@/common/enums/enums' import { Injectable } from '@nestjs/common' import { StorageService } from '../storage/storage.service' @Injectable() export class UploaderService { constructor(private readonly storageService: StorageService) {} async uploadFile(file: Express.Multer.File, type: UploadedFileTypes) { const uploaded = await this.storageService.uploadFile(file, type) return uploaded } async deleteFile(url: string, type: UploadedFileTypes) { const key = `${type}/${url?.split('/').pop()}` if (key) { return await this.storageService.deleteFile(key) } return {} } }