From 6321e702ee53c5a62b99bb9c691d46c7e5105d20 Mon Sep 17 00:00:00 2001 From: Filipe Borelli <60223308+filipeborelli@users.noreply.github.com> Date: Thu, 9 Dec 2021 17:07:03 -0300 Subject: [PATCH] Update ContactController.ts --- backend/src/controllers/ContactController.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/backend/src/controllers/ContactController.ts b/backend/src/controllers/ContactController.ts index 9f42a1c..536ba3a 100644 --- a/backend/src/controllers/ContactController.ts +++ b/backend/src/controllers/ContactController.ts @@ -8,6 +8,7 @@ import ShowContactService from "../services/ContactServices/ShowContactService"; import UpdateContactService from "../services/ContactServices/UpdateContactService"; import DeleteContactService from "../services/ContactServices/DeleteContactService"; +import CheckContactNumber from "../services/WbotServices/CheckNumber" import CheckIsValidContact from "../services/WbotServices/CheckIsValidContact"; import GetProfilePicUrl from "../services/WbotServices/GetProfilePicUrl"; import AppError from "../errors/AppError"; @@ -57,11 +58,20 @@ export const store = async (req: Request, res: Response): Promise => { } await CheckIsValidContact(newContact.number); + const validNumber : any = await CheckContactNumber(newContact.number) + + const profilePicUrl = await GetProfilePicUrl(validNumber); - const profilePicUrl = await GetProfilePicUrl(newContact.number); + let name = newContact.name + let number = validNumber + let email = newContact.email + let extraInfo = newContact.extraInfo const contact = await CreateContactService({ - ...newContact, + name, + number, + email, + extraInfo, profilePicUrl });