Enhance NestJS application with SWC builder configuration, add @nestjs/devtools-integration for development support, and refactor various components for improved readability. Update package dependencies and streamline import statements across multiple files.

This commit is contained in:
2024-11-26 04:26:55 +07:00
parent c4e302387f
commit a1ca5c62fb
12 changed files with 1646 additions and 235 deletions

View File

@@ -36,10 +36,7 @@ export class MinioService {
}
let url = null
// check if presignUrl is provided and not expired else get new presignUrl
if (
presignUrl &&
!DateTimeUtils.isExpired(presignUrl.split('&X-Amz-Date=')[1])
) {
if (presignUrl && !DateTimeUtils.isExpired(presignUrl.split('&X-Amz-Date=')[1])) {
url = presignUrl
} else {
try {
@@ -81,14 +78,30 @@ export class MinioService {
}
async deleteFile(id: string, category: string) {
return await this.minioClient.removeObject(
this.configService.get('BUCKET_NAME') ?? 'epess',
`${category}/${id}`,
)
return await this.minioClient.removeObject(this.configService.get('BUCKET_NAME') ?? 'epess', `${category}/${id}`)
}
// create a folder for a document pattern epess/documents/<id>/<page>
async createDocumentFolder(id: string) {
return await this.minioClient.putObject(this.configService.get('BUCKET_NAME') ?? 'epess', `documents/${id}`, '')
}
async streamFile(id: string, category: string) {}
async upsertDocumentFolder(id: string, page: string) {
return await this.minioClient.putObject(
this.configService.get('BUCKET_NAME') ?? 'epess',
`documents/${id}/${page}`,
'',
)
}
// export document to docx format by get all pages and convert to docx
async exportDocument(id: string) {
// get all pages
const pages = await this.minioClient.listObjects(
this.configService.get('BUCKET_NAME') ?? 'epess',
`documents/${id}`,
)
// convert to docx
// const docx = await this.convertToDocx(pages)
}
fileName() {
// generate a unique file name using uuid
return uuidv4()