update license structures and setup file storage services

This commit is contained in:
2026-04-16 22:19:20 +03:30
parent d098ef10e1
commit ca494ee82a
75 changed files with 4550 additions and 1255 deletions
+33
View File
@@ -0,0 +1,33 @@
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
// await fs.mkdir(dirPath, { recursive: true })
// await fs.writeFile(filePath, buffer)
// Return a URL path, e.g. /uploads/{accountId}/{type}/{filename}
// return `/uploads/${type}/${filename}`
}
async deleteFile(url: string) {
const key = url?.split('/').pop()
if (key) {
return await this.storageService.deleteFile(key)
}
return {}
// await fs.mkdir(dirPath, { recursive: true })
// await fs.writeFile(filePath, buffer)
// Return a URL path, e.g. /uploads/{accountId}/{type}/{filename}
// return `/uploads/${type}/${filename}`
}
}