diff --git a/backend/src/helpers/GetDefaultWhatsApp.ts b/backend/src/helpers/GetDefaultWhatsApp.ts index c19757a..6adc34d 100644 --- a/backend/src/helpers/GetDefaultWhatsApp.ts +++ b/backend/src/helpers/GetDefaultWhatsApp.ts @@ -25,7 +25,7 @@ const GetDefaultWhatsApp = async ({ where: { isDefault: true } }); - if (!defaultWhatsapp && !ignoreNoWhatsappFound) { + if (!defaultWhatsapp) { if (userId) { let whatsapps = await wbotByUserQueue({ userId, queueId }); @@ -53,13 +53,13 @@ const GetDefaultWhatsApp = async ({ where: { status: "CONNECTED" } }); } - } else { + } else { defaultWhatsapp = await Whatsapp.findOne({ where: { status: "CONNECTED", isOfficial: false } }); } - } - + } + if (!defaultWhatsapp && !ignoreNoWhatsappFound) { throw new AppError("ERR_NO_DEF_WAPP_FOUND"); } diff --git a/backend/src/services/WbotServices/CheckIsValidContact.ts b/backend/src/services/WbotServices/CheckIsValidContact.ts index d663206..bb1496c 100644 --- a/backend/src/services/WbotServices/CheckIsValidContact.ts +++ b/backend/src/services/WbotServices/CheckIsValidContact.ts @@ -30,6 +30,9 @@ const CheckIsValidContact = async ( let _status: any; if (!isValidNumber) { + + console.log('kkkkkkkkkkkkkkkkkkkkkkkkkkkkk ') + const { data, status } = await axios.post( `${process.env.WHATS_NUMBER_VALIDATOR_URL}/api/validate`, { mobile: number }, @@ -44,6 +47,8 @@ const CheckIsValidContact = async ( _status = status; } if (ignoreThrow) return isValidNumber?.number; + + console.log('_status: ', _status) if (_status && _status == 422) throw new AppError("ERR_NO_WAPP_FOUND");