From 2c48aafbdbe4b980d2450bf8555dd15efb64fac8 Mon Sep 17 00:00:00 2001 From: adriano Date: Fri, 19 May 2023 13:00:07 -0300 Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=A3o=20para=20obrigar=20o=20usuar?= =?UTF-8?q?io=20a=20inserir=20numero=20com=2055=20no=20inicio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/controllers/ContactController.ts | 8 ++++---- .../src/services/MessageServices/CreateMessageService.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/src/controllers/ContactController.ts b/backend/src/controllers/ContactController.ts index 1c05596..c5099b0 100644 --- a/backend/src/controllers/ContactController.ts +++ b/backend/src/controllers/ContactController.ts @@ -88,6 +88,7 @@ export const store = async (req: Request, res: Response): Promise => { number: Yup.string() .required() .matches(/^\d+$/, "Invalid number format. Only numbers is allowed.") + .matches(/^55\d+$/, "The number must start with 55.") }); try { @@ -152,10 +153,9 @@ export const update = async ( const schema = Yup.object().shape({ name: Yup.string(), - number: Yup.string().matches( - /^\d+$/, - "Invalid number format. Only numbers is allowed." - ) + number: Yup.string() + .matches(/^\d+$/,"Invalid number format. Only numbers is allowed.") + .matches(/^55\d+$/, "The number must start with 55.") }); try { diff --git a/backend/src/services/MessageServices/CreateMessageService.ts b/backend/src/services/MessageServices/CreateMessageService.ts index 7a09947..11a009b 100644 --- a/backend/src/services/MessageServices/CreateMessageService.ts +++ b/backend/src/services/MessageServices/CreateMessageService.ts @@ -20,7 +20,7 @@ interface Request { const CreateMessageService = async ({ messageData }: Request): Promise => { - console.log('UPSERT MESSAGE messageData: ', messageData) + // console.log('UPSERT MESSAGE messageData: ', messageData) try {