From 35b797480010588e30f825b4dcbc3f79b9d7838c Mon Sep 17 00:00:00 2001 From: Maxime Naulleau Date: Fri, 6 Dec 2024 22:30:14 +0100 Subject: [PATCH] Log file document saved --- .../gateways/repositories/drizzle/sql-file.repository.ts | 4 ++-- .../business-logic/use-cases/file-upload/upload-file.ts | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/api/src/files-context/adapters/secondary/gateways/repositories/drizzle/sql-file.repository.ts b/apps/api/src/files-context/adapters/secondary/gateways/repositories/drizzle/sql-file.repository.ts index 0ecbbb1..d3e2390 100644 --- a/apps/api/src/files-context/adapters/secondary/gateways/repositories/drizzle/sql-file.repository.ts +++ b/apps/api/src/files-context/adapters/secondary/gateways/repositories/drizzle/sql-file.repository.ts @@ -8,9 +8,9 @@ import { DrizzleTransactionableAsync } from 'src/shared-kernel/adapters/secondar import { filesPm } from './schema/files-pm'; export class SqlFileRepository implements FileRepository { - save(report: FileDocument): DrizzleTransactionableAsync { + save(file: FileDocument): DrizzleTransactionableAsync { return async (db) => { - const reportRow = SqlFileRepository.mapToDb(report); + const reportRow = SqlFileRepository.mapToDb(file); await db.insert(filesPm).values(reportRow); }; } diff --git a/apps/api/src/files-context/business-logic/use-cases/file-upload/upload-file.ts b/apps/api/src/files-context/business-logic/use-cases/file-upload/upload-file.ts index 0c1abaf..d5a679c 100644 --- a/apps/api/src/files-context/business-logic/use-cases/file-upload/upload-file.ts +++ b/apps/api/src/files-context/business-logic/use-cases/file-upload/upload-file.ts @@ -30,7 +30,11 @@ export class UploadFileUseCase { filePath, FilesStorageProvider.SCALEWAY, ); - console.log('files context - created file document'); + console.log( + 'files context - created file document', + fileDocument, + fileDocument.toSnapshot(), + ); // Order matters, file isn't uploaded if saving in repository fails await this.fileRepository.save(fileDocument)(trx);