From 339dfe17deedeb58e30b1c60dafb1546512bd4af Mon Sep 17 00:00:00 2001 From: Max Bischof Date: Tue, 16 Jan 2024 13:13:17 +0100 Subject: [PATCH] Rename promise2 to fileRecordPromise --- .../modules/files-storage/uc/files-storage.uc.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/apps/server/src/modules/files-storage/uc/files-storage.uc.ts b/apps/server/src/modules/files-storage/uc/files-storage.uc.ts index 4b3ed1cd7ff..ca3d5f28ac1 100644 --- a/apps/server/src/modules/files-storage/uc/files-storage.uc.ts +++ b/apps/server/src/modules/files-storage/uc/files-storage.uc.ts @@ -65,12 +65,12 @@ export class FilesStorageUC { private async uploadFileWithBusboy(userId: EntityId, params: FileRecordParams, req: Request): Promise { const promise = new Promise((resolve, reject) => { const bb = busboy({ headers: req.headers, defParamCharset: 'utf8' }); - let promise2: Promise; + let fileRecordPromise: Promise; bb.on('file', (_name, file, info) => { const fileDto = FileDtoBuilder.buildFromRequest(info, file); - promise2 = RequestContext.createAsync(this.em, () => { + fileRecordPromise = RequestContext.createAsync(this.em, () => { const record = this.filesStorageService.uploadFile(userId, params, fileDto); return record; @@ -78,14 +78,9 @@ export class FilesStorageUC { }); bb.on('finish', () => { - promise2 - .then((result) => { - resolve(result); - console.log('fileclose', result); - return result; - }) + fileRecordPromise + .then((result) => resolve(result)) .catch((error) => { - this.logger.error({ message: 'could not upload file', error: error as Error }); req.unpipe(bb); reject(error); });