From 5a870b77125dc7710762e1af9f14ef90c19eabc5 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Fri, 24 Nov 2023 14:34:29 +0100 Subject: [PATCH] :sparkles: Updating ts config --- src/app/api/customer/AuthController.ts | 53 +------------------------- tsconfig.json | 2 +- 2 files changed, 2 insertions(+), 53 deletions(-) diff --git a/src/app/api/customer/AuthController.ts b/src/app/api/customer/AuthController.ts index b2c1e204..2089cb11 100644 --- a/src/app/api/customer/AuthController.ts +++ b/src/app/api/customer/AuthController.ts @@ -2,7 +2,6 @@ import { Response, Request } from "express"; import { Controller, Post } from "@ControllerPattern/index"; import ApiController from "@Common/system/controller-pattern/ApiController"; import { Service } from "typedi"; -import { EnrollmentResponse } from "@Services/common/Id360Service/Id360Service"; import CustomersService, { InvalidPasswordError, InvalidTotpCodeError, @@ -11,7 +10,7 @@ import CustomersService, { SmsNotExpiredError, TotpCodeExpiredError, } from "@Services/customer/CustomersService/CustomersService"; -import AuthService, { ICustomerJwtPayload } from "@Services/common/AuthService/AuthService"; +import AuthService from "@Services/common/AuthService/AuthService"; import { Customer } from "le-coffre-resources/dist/SuperAdmin"; @Controller() @@ -144,54 +143,4 @@ export default class AuthController extends ApiController { return; } } - - @Post("/api/v1/customer/check-sms-code") - protected async checkSmsCode(req: Request, response: Response) { - const email = req.body["email"]; - const smsCode = req.body["smsCode"]; - - if (!email) { - this.httpBadRequest(response, "Email is required"); - return; - } - - if (!smsCode) { - this.httpBadRequest(response, "Sms code is required"); - return; - } - - const customer = await this.customerService.getOne({ - where: { - contact: { - email, - }, - }, - include: { - contact: true, - }, - }); - - if (!customer) { - this.httpNotFoundRequest(response, "Customer not found"); - return; - } - - if (!customer.smsCode) { - this.httpBadRequest(response, "No sms code found"); - return; - } - - if (customer.smsCode !== smsCode) { - this.httpBadRequest(response, "Invalid sms code"); - return; - } - - try { - this.httpSuccess(response, { success: "success" }); - } catch (error) { - console.log(error); - this.httpInternalError(response); - return; - } - } } diff --git a/tsconfig.json b/tsconfig.json index bbd8ba4d..bf9fc16e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,7 +27,7 @@ "alwaysStrict": true, "noPropertyAccessFromIndexSignature": true, /* Additional Checks */ - "noUnusedLocals": false, + "noUnusedLocals": true, "noUnusedParameters": false, "noImplicitReturns": true, "noUncheckedIndexedAccess": true,