From 6997e13d28022ccafb530b4ce83658302e4cdec6 Mon Sep 17 00:00:00 2001 From: Vins Date: Wed, 13 Dec 2023 10:20:24 +0100 Subject: [PATCH 1/2] removed logs --- src/services/common/IdNotService/IdNotService.ts | 5 +---- src/services/common/OvhService/OvhService.ts | 1 - src/services/common/SmsFactorService/SmsFactorService.ts | 1 - 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/services/common/IdNotService/IdNotService.ts b/src/services/common/IdNotService/IdNotService.ts index d5a0eac8..5f9f9fda 100644 --- a/src/services/common/IdNotService/IdNotService.ts +++ b/src/services/common/IdNotService/IdNotService.ts @@ -120,10 +120,7 @@ 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); - + }); 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()); diff --git a/src/services/common/OvhService/OvhService.ts b/src/services/common/OvhService/OvhService.ts index f6550900..79036fcb 100644 --- a/src/services/common/OvhService/OvhService.ts +++ b/src/services/common/OvhService/OvhService.ts @@ -27,7 +27,6 @@ export default class OvhService extends BaseService { console.error('Error sending Ovh Sms'); return false; } else { - console.log('SMS sent successfully via Ovh'); return true; } }); diff --git a/src/services/common/SmsFactorService/SmsFactorService.ts b/src/services/common/SmsFactorService/SmsFactorService.ts index 1bc3f714..c756ca3d 100644 --- a/src/services/common/SmsFactorService/SmsFactorService.ts +++ b/src/services/common/SmsFactorService/SmsFactorService.ts @@ -21,7 +21,6 @@ export default class SmsFactorService extends BaseService { {}, ) .then((response) => { - console.log("SMS sent successfully via Sms Factor"); return true; }) .catch((error) => { From a6bdd8708867b2947ed1bbe9cd34f7f240bbefeb Mon Sep 17 00:00:00 2001 From: Vins Date: Fri, 15 Dec 2023 13:16:45 +0100 Subject: [PATCH 2/2] done --- package.json | 2 +- src/app/api/admin/CustomersController.ts | 4 +++- src/app/api/notary/CustomersController.ts | 2 ++ src/app/api/super-admin/CustomersController.ts | 4 +++- src/app/middlewares/AuthHandler.ts | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index e9f75855..162504e4 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,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.104", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.105", "module-alias": "^2.2.2", "monocle-ts": "^2.3.13", "multer": "^1.4.5-lts.1", diff --git a/src/app/api/admin/CustomersController.ts b/src/app/api/admin/CustomersController.ts index 90e05691..8a81eaa6 100644 --- a/src/app/api/admin/CustomersController.ts +++ b/src/app/api/admin/CustomersController.ts @@ -56,7 +56,7 @@ export default class CustomersController extends ApiController { /** * @description Create a new customer */ - @Post("/api/v1/notary/customers", [authHandler, ruleHandler]) + @Post("/api/v1/admin/customers", [authHandler, ruleHandler]) protected async post(req: Request, response: Response) { try { //init IUser resource with request body values @@ -69,6 +69,8 @@ export default class CustomersController extends ApiController { return; } + if (!customerEntity.contact?.cell_phone_number) return; + const customers = await this.customersService.get({ where: { contact: { email: customerEntity.contact?.email }, diff --git a/src/app/api/notary/CustomersController.ts b/src/app/api/notary/CustomersController.ts index 0c63db1f..ada54166 100644 --- a/src/app/api/notary/CustomersController.ts +++ b/src/app/api/notary/CustomersController.ts @@ -68,6 +68,8 @@ export default class CustomersController extends ApiController { return; } + if (!customerEntity.contact?.cell_phone_number) return; + const customers = await this.customersService.get({ where: { contact: { email: customerEntity.contact?.email }, diff --git a/src/app/api/super-admin/CustomersController.ts b/src/app/api/super-admin/CustomersController.ts index fdb8ff01..28366c9f 100644 --- a/src/app/api/super-admin/CustomersController.ts +++ b/src/app/api/super-admin/CustomersController.ts @@ -57,7 +57,7 @@ export default class CustomersController extends ApiController { /** * @description Create a new customer */ - @Post("/api/v1/notary/customers", [authHandler, ruleHandler]) + @Post("/api/v1/super-admin/customers", [authHandler, ruleHandler]) protected async post(req: Request, response: Response) { try { //init IUser resource with request body values @@ -70,6 +70,8 @@ export default class CustomersController extends ApiController { return; } + if (!customerEntity.contact?.cell_phone_number) return; + const customers = await this.customersService.get({ where: { contact: { email: customerEntity.contact?.email }, diff --git a/src/app/middlewares/AuthHandler.ts b/src/app/middlewares/AuthHandler.ts index bd3f1293..28c1f082 100644 --- a/src/app/middlewares/AuthHandler.ts +++ b/src/app/middlewares/AuthHandler.ts @@ -13,7 +13,7 @@ export default function authHandler(req: Request, response: Response, next: Next return; } - const authService = Container.get(AuthService); + const authService = Container.get(AuthService); authService.verifyAccessToken(token, (err, userPayload) => { if (err) { response.status(HttpCodes.UNAUTHORIZED).send("Error while verifying token");