From c6335996a60ee399286009009fa67b0a06269631 Mon Sep 17 00:00:00 2001 From: Vins Date: Fri, 12 Jan 2024 15:11:54 +0100 Subject: [PATCH 1/5] Fixed empty email --- src/app/api/idnot/UserController.ts | 5 +++++ src/services/common/IdNotService/IdNotService.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/app/api/idnot/UserController.ts b/src/app/api/idnot/UserController.ts index 8b448b2b..96b9d2c6 100644 --- a/src/app/api/idnot/UserController.ts +++ b/src/app/api/idnot/UserController.ts @@ -51,6 +51,11 @@ export default class UserController extends ApiController { //Hydrate user to be able to use his contact const userHydrated = User.hydrate(prismaUser, { strategy: "excludeAll" }); + + if(!userHydrated.contact?.email || userHydrated.contact?.email === "") { + this.httpBadRequest(response, "Email not found"); + return; + } //Check if user is whitelisted const isWhitelisted = await this.whitelistService.getByEmail(userHydrated.contact!.email); diff --git a/src/services/common/IdNotService/IdNotService.ts b/src/services/common/IdNotService/IdNotService.ts index eca8fe37..b9157b6d 100644 --- a/src/services/common/IdNotService/IdNotService.ts +++ b/src/services/common/IdNotService/IdNotService.ts @@ -120,7 +120,9 @@ export default class IdNotService extends BaseService { redirect_uri: this.variables.IDNOT_REDIRECT_URL, code: code, grant_type: "authorization_code", - }); + }); + console.log(this.variables.IDNOT_BASE_URL + this.variables.IDNOT_CONNEXION_URL + "?" + query.toString()); + const token = await fetch(this.variables.IDNOT_BASE_URL + this.variables.IDNOT_CONNEXION_URL + "?" + query, { method: "POST" }); if(token.status !== 200) console.error(await token.text()); From 2810a37bd48a4c3d0fce08d23c1cf2a0862bd686 Mon Sep 17 00:00:00 2001 From: Vins Date: Fri, 12 Jan 2024 15:19:50 +0100 Subject: [PATCH 2/5] Fixed email empty --- src/app/api/idnot/UserController.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/api/idnot/UserController.ts b/src/app/api/idnot/UserController.ts index 96b9d2c6..6aeabb4b 100644 --- a/src/app/api/idnot/UserController.ts +++ b/src/app/api/idnot/UserController.ts @@ -34,7 +34,7 @@ export default class UserController extends ApiController { return; } - const user = await this.idNotService.getOrCreateUser(idNotToken); + const user = await this.idNotService.getOrCreateUser(idNotToken); if(!user) { this.httpUnauthorized(response, "Email not found"); @@ -47,13 +47,13 @@ export default class UserController extends ApiController { if (!prismaUser) { this.httpNotFoundRequest(response, "user not found"); return; - } + } //Hydrate user to be able to use his contact - const userHydrated = User.hydrate(prismaUser, { strategy: "excludeAll" }); + const userHydrated = User.hydrate(prismaUser, { strategy: "excludeAll" }); - if(!userHydrated.contact?.email || userHydrated.contact?.email === "") { - this.httpBadRequest(response, "Email not found"); + if(!userHydrated.contact?.email || userHydrated.contact?.email === "") { + this.httpUnauthorized(response, "Email not found"); return; } From f596aaa1333850fc556dae4cd23a3a584be940c9 Mon Sep 17 00:00:00 2001 From: Vins Date: Mon, 12 Feb 2024 17:51:28 +0100 Subject: [PATCH 3/5] Document public description optional --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a7ad6158..1cb06594 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "file-type-checker": "^1.0.8", "fp-ts": "^2.16.1", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.106", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.108", "module-alias": "^2.2.2", "monocle-ts": "^2.3.13", "multer": "^1.4.5-lts.1", From 3520a15a1091d24dd716f889f8192d5d0ca6fffb Mon Sep 17 00:00:00 2001 From: Vins Date: Tue, 13 Feb 2024 09:21:24 +0100 Subject: [PATCH 4/5] Archive an unanchored folder --- src/app/api/notary/OfficeFoldersController.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/app/api/notary/OfficeFoldersController.ts b/src/app/api/notary/OfficeFoldersController.ts index d10af72a..45941476 100644 --- a/src/app/api/notary/OfficeFoldersController.ts +++ b/src/app/api/notary/OfficeFoldersController.ts @@ -168,7 +168,7 @@ export default class OfficeFoldersController extends ApiController { const officeFolderFound = await this.officeFoldersService.getByUid(uid, { folder_anchor: true, - }); + }); if (!officeFolderFound) { this.httpNotFoundRequest(response, "office folder not found"); @@ -184,11 +184,6 @@ export default class OfficeFoldersController extends ApiController { //validate folder await validateOrReject(officefolderToUpdate, { groups: ["updateFolder"], forbidUnknownValues: false }); - if ((officeFolderFound as any).folder_anchor?.status !== "VERIFIED_ON_CHAIN") { - this.httpBadRequest(response, "Cannot archive a not anchored folder"); - return; - } - //call service to get prisma entity const officeFolderEntityUpdated = await this.officeFoldersService.updateStatus(uid, officefolderToUpdate); From c2ae7e4ea3c08ee183bf5077e85459427d22f8bd Mon Sep 17 00:00:00 2001 From: Vins Date: Tue, 13 Feb 2024 11:45:30 +0100 Subject: [PATCH 5/5] All document types in deed type list --- src/common/repositories/DocumentTypesRepository.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/common/repositories/DocumentTypesRepository.ts b/src/common/repositories/DocumentTypesRepository.ts index a8b3ad3f..221e541f 100644 --- a/src/common/repositories/DocumentTypesRepository.ts +++ b/src/common/repositories/DocumentTypesRepository.ts @@ -20,7 +20,6 @@ export default class DocumentTypesRepository extends BaseRepository { * @description : Find many document types */ public async findMany(query: Prisma.DocumentTypesFindManyArgs) { - query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); return this.model.findMany(query); }