cell_phone not required

This commit is contained in:
Vins 2023-12-19 15:11:13 +01:00
parent 12744ea98e
commit 34eb644940
5 changed files with 8 additions and 6 deletions

View File

@ -57,7 +57,7 @@
"file-type-checker": "^1.0.8", "file-type-checker": "^1.0.8",
"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.105", "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.106",
"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

@ -35,7 +35,7 @@ export default class AuthController extends ApiController {
return; return;
} }
this.httpSuccess(response, { this.httpSuccess(response, {
partialPhoneNumber: res.customer.contact?.cell_phone_number.replace(/\s/g, "").slice(-4), partialPhoneNumber: res.customer.contact?.cell_phone_number?.replace(/\s/g, "").slice(-4),
totpCodeUid: res.totpCode.uid, totpCodeUid: res.totpCode.uid,
}); });
} catch (error) { } catch (error) {
@ -58,7 +58,7 @@ export default class AuthController extends ApiController {
this.httpNotFoundRequest(response, "Customer not found"); this.httpNotFoundRequest(response, "Customer not found");
return; return;
} }
this.httpSuccess(response, { partialPhoneNumber: customer.contact?.cell_phone_number.replace(/\s/g, "").slice(-4) }); this.httpSuccess(response, { partialPhoneNumber: customer.contact?.cell_phone_number?.replace(/\s/g, "").slice(-4) });
} catch (error) { } catch (error) {
if (error instanceof SmsNotExpiredError) { if (error instanceof SmsNotExpiredError) {
this.httpTooEarlyRequest(response, error.message); this.httpTooEarlyRequest(response, error.message);
@ -229,7 +229,7 @@ export default class AuthController extends ApiController {
return; return;
} }
this.httpSuccess(response, { this.httpSuccess(response, {
partialPhoneNumber: res.customer.contact?.cell_phone_number.replace(/\s/g, "").slice(-4), partialPhoneNumber: res.customer.contact?.cell_phone_number?.replace(/\s/g, "").slice(-4),
totpCodeUid: res.totpCode.uid, totpCodeUid: res.totpCode.uid,
}); });
} catch (error) { } catch (error) {

View File

@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "contacts" ALTER COLUMN "cell_phone_number" DROP NOT NULL;

View File

@ -37,7 +37,7 @@ model Contacts {
last_name String @db.VarChar(255) last_name String @db.VarChar(255)
email String @db.VarChar(255) email String @db.VarChar(255)
phone_number String? @db.VarChar(50) phone_number String? @db.VarChar(50)
cell_phone_number String @db.VarChar(50) cell_phone_number String? @db.VarChar(50)
civility ECivility @default(MALE) civility ECivility @default(MALE)
address Addresses? @relation(fields: [address_uid], references: [uid], onDelete: Cascade) address Addresses? @relation(fields: [address_uid], references: [uid], onDelete: Cascade)
address_uid String? @unique @db.VarChar(255) address_uid String? @unique @db.VarChar(255)

View File

@ -56,7 +56,7 @@ export default class UsersRepository extends BaseRepository {
last_name: user.contact!.last_name, last_name: user.contact!.last_name,
email: user.contact!.email, email: user.contact!.email,
phone_number: user.contact?.phone_number, phone_number: user.contact?.phone_number,
cell_phone_number: user.contact!.cell_phone_number, cell_phone_number: user.contact!.cell_phone_number || null,
civility: ECivility[user.contact?.civility as keyof typeof ECivility], civility: ECivility[user.contact?.civility as keyof typeof ECivility],
}, },
}, },