✨ Updating ts config
This commit is contained in:
parent
97fd3f0d86
commit
5a870b7712
@ -2,7 +2,6 @@ import { Response, Request } from "express";
|
|||||||
import { Controller, Post } from "@ControllerPattern/index";
|
import { Controller, Post } from "@ControllerPattern/index";
|
||||||
import ApiController from "@Common/system/controller-pattern/ApiController";
|
import ApiController from "@Common/system/controller-pattern/ApiController";
|
||||||
import { Service } from "typedi";
|
import { Service } from "typedi";
|
||||||
import { EnrollmentResponse } from "@Services/common/Id360Service/Id360Service";
|
|
||||||
import CustomersService, {
|
import CustomersService, {
|
||||||
InvalidPasswordError,
|
InvalidPasswordError,
|
||||||
InvalidTotpCodeError,
|
InvalidTotpCodeError,
|
||||||
@ -11,7 +10,7 @@ import CustomersService, {
|
|||||||
SmsNotExpiredError,
|
SmsNotExpiredError,
|
||||||
TotpCodeExpiredError,
|
TotpCodeExpiredError,
|
||||||
} from "@Services/customer/CustomersService/CustomersService";
|
} 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";
|
import { Customer } from "le-coffre-resources/dist/SuperAdmin";
|
||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
@ -144,54 +143,4 @@ export default class AuthController extends ApiController {
|
|||||||
return;
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
"alwaysStrict": true,
|
"alwaysStrict": true,
|
||||||
"noPropertyAccessFromIndexSignature": true,
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
/* Additional Checks */
|
/* Additional Checks */
|
||||||
"noUnusedLocals": false,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": false,
|
"noUnusedParameters": false,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noUncheckedIndexedAccess": true,
|
"noUncheckedIndexedAccess": true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user