diff --git a/dist/Notary/Contact.js b/dist/Notary/Contact.js index a373032..7ac40c2 100644 --- a/dist/Notary/Contact.js +++ b/dist/Notary/Contact.js @@ -96,9 +96,9 @@ __decorate([ groups: ["createCustomer"], message: "Numéro de téléphone ne peut pas être vide", }), - (0, class_validator_1.Matches)(/^\+[1-9]{2,3}[0-9]{9}$/, { + (0, class_validator_1.IsPhoneNumber)(undefined, { groups: ["createCustomer", "updateCustomer"], - message: "Le numéro de téléphone doit être au format 0X XX XX XX XX ou +33X XX XX XX XX", + message: "Numéro de téléphone incorrect", }), __metadata("design:type", Object) ], Contact.prototype, "cell_phone_number", void 0); diff --git a/src/Notary/Contact.ts b/src/Notary/Contact.ts index 9e9bbd5..1a5d1d2 100644 --- a/src/Notary/Contact.ts +++ b/src/Notary/Contact.ts @@ -5,7 +5,7 @@ import { IsEmail, IsNotEmpty, IsOptional, - Matches, + IsPhoneNumber, NotEquals, ValidateNested, } from "class-validator"; @@ -68,10 +68,9 @@ export default class Contact extends ContactCustomer { groups: ["createCustomer"], message: "Numéro de téléphone ne peut pas être vide", }) - @Matches(/^\+[1-9]{2,3}[0-9]{9}$/, { + @IsPhoneNumber(undefined, { groups: ["createCustomer", "updateCustomer"], - message: - "Le numéro de téléphone doit être au format 0X XX XX XX XX ou +33X XX XX XX XX", + message: "Numéro de téléphone incorrect", }) public override cell_phone_number?: string | null = null;