From 855334dbd8655dfb38b884aadaac4ff16642b438 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Thu, 4 May 2023 17:48:56 +0200 Subject: [PATCH] Fixed create Document --- package-lock.json | 4 ++-- package.json | 2 +- src/app/api/super-admin/DocumentsController.ts | 2 ++ src/common/repositories/FilesRepository.ts | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 67d17234..c72c56fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.33", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.36", "module-alias": "^2.2.2", "next": "^13.1.5", "node-cache": "^5.1.2", @@ -3615,7 +3615,7 @@ } }, "node_modules/le-coffre-resources": { - "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#cabb4c6c05258d5725cb5747f9cb8335915edf10", + "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#90ed41d1239cb915defec195cf0e1363ea157d36", "license": "MIT", "dependencies": { "class-transformer": "^0.5.1", diff --git a/package.json b/package.json index 5efcdb77..8a3c77e1 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.35", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.37", "module-alias": "^2.2.2", "next": "^13.1.5", "node-cache": "^5.1.2", diff --git a/src/app/api/super-admin/DocumentsController.ts b/src/app/api/super-admin/DocumentsController.ts index cfe412ec..6dc9904d 100644 --- a/src/app/api/super-admin/DocumentsController.ts +++ b/src/app/api/super-admin/DocumentsController.ts @@ -47,6 +47,8 @@ export default class DocumentsController extends ApiController { try { //init Document resource with request body values const documentEntity = Document.hydrate(req.body); + console.log(documentEntity); + //validate document await validateOrReject(documentEntity, { groups: ["createDocument"], forbidUnknownValues: false }); diff --git a/src/common/repositories/FilesRepository.ts b/src/common/repositories/FilesRepository.ts index ebc0fb77..7c7d99d8 100644 --- a/src/common/repositories/FilesRepository.ts +++ b/src/common/repositories/FilesRepository.ts @@ -32,7 +32,7 @@ export default class FilesRepository extends BaseRepository { data: { document: { connect: { - uid: file.document.uid, + uid: file.document!.uid, }, }, file_path: file.file_path,