fix package version

This commit is contained in:
OxSaitama 2023-10-13 11:26:29 +02:00
parent 5643a8ffe7
commit 988a10efde
2 changed files with 19 additions and 11 deletions

View File

@ -53,7 +53,7 @@
"express": "^4.18.2", "express": "^4.18.2",
"fp-ts": "^2.16.1", "fp-ts": "^2.16.1",
"jsonwebtoken": "^9.0.0", "jsonwebtoken": "^9.0.0",
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.92", "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.93",
"module-alias": "^2.2.2", "module-alias": "^2.2.2",
"monocle-ts": "^2.3.13", "monocle-ts": "^2.3.13",
"multer": "^1.4.5-lts.1", "multer": "^1.4.5-lts.1",

View File

@ -34,26 +34,34 @@ export default class CustomerController extends ApiController {
return; return;
} }
try { try {
await new Promise( resolve => setTimeout(resolve, 3000)); // wait 3 seconds to be sure that the enrollment is finilazed await new Promise((resolve) => setTimeout(resolve, 3000)); // wait 3 seconds to be sure that the enrollment is finilazed
const res = await this.id360Service.getEnrollment(callbackToken); const res = await this.id360Service.getEnrollment(callbackToken);
const enrollment = await res.json() as EnrollmentResponse; const enrollment = (await res.json()) as EnrollmentResponse;
if (enrollment.status !== "OK") { if (enrollment.status !== "OK") {
this.httpUnauthorized(response, "Enrollment status is not OK"); this.httpUnauthorized(response, "Enrollment status is not OK");
return; return;
} }
const customerData = await this.id360Service.getReport(enrollment.id); const customerData = await this.id360Service.getReport(enrollment.id);
const customer = await this.customerService.get({ const customer = await this.customerService.get({
where: { where: {
contact: { contact: {
last_name: { contains: customerData.external_methods.france_connect.results.france_connect_out_userinfo[0].family_name, last_name: {
mode: 'insensitive' }, contains: customerData.external_methods.france_connect.results.france_connect_out_userinfo[0].family_name,
first_name: { contains: customerData.external_methods.france_connect.results.france_connect_out_userinfo[0].given_name.split(" ")[0], mode: "insensitive",
mode: 'insensitive'}, },
first_name: {
contains:
customerData.external_methods.france_connect.results.france_connect_out_userinfo[0].given_name.split(
" ",
)[0],
mode: "insensitive",
},
}, },
}, },
include: { include: {
contact: true, contact: true,
} },
}); });
// const contact = await this.customerService.getByEmail( // const contact = await this.customerService.getByEmail(
// customerData.external_methods.france_connect.results.france_connect_out_userinfo[0].email, // customerData.external_methods.france_connect.results.france_connect_out_userinfo[0].email,
@ -63,7 +71,7 @@ export default class CustomerController extends ApiController {
return; return;
} }
const customersHydrated = Customer.hydrateArray<Customer>(customer); const customersHydrated = Customer.hydrateArray<Customer>(customer);
const payload = await this.authService.getCustomerJwtPayload(customersHydrated[0]!); const payload = await this.authService.getCustomerJwtPayload(customersHydrated[0]!);
const accessToken = this.authService.generateAccessToken(payload); const accessToken = this.authService.generateAccessToken(payload);
const refreshToken = this.authService.generateRefreshToken(payload); const refreshToken = this.authService.generateRefreshToken(payload);