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", diff --git a/src/app/api/idnot/UserController.ts b/src/app/api/idnot/UserController.ts index 8b448b2b..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,10 +47,15 @@ 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.httpUnauthorized(response, "Email not found"); + return; + } //Check if user is whitelisted const isWhitelisted = await this.whitelistService.getByEmail(userHydrated.contact!.email); 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); 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); } 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());