chore: code otimization

master
adriano 2024-10-04 15:08:36 -03:00
parent 70f0fc992d
commit 5b4406584b
1 changed files with 7 additions and 11 deletions

View File

@ -344,8 +344,7 @@ const webhook_crm = async (req, res) => {
const sObject = req.body['soapenv:Envelope']['soapenv:Body']?.notifications?.Notification?.sObject const sObject = req.body['soapenv:Envelope']['soapenv:Body']?.notifications?.Notification?.sObject
if (!sObject) { if (!sObject) {
res.set('Content-Type', 'text/xml') return res.set('Content-Type', 'text/xml').status(StatusCodes.OK).send(responseXml)
return res.status(StatusCodes.OK).send(responseXml)
} }
const whoId = sObject['sf:WhoId'] const whoId = sObject['sf:WhoId']
@ -375,8 +374,7 @@ const webhook_crm = async (req, res) => {
const contactIdChatwoot = await getContactIdChatwoot(phone) const contactIdChatwoot = await getContactIdChatwoot(phone)
if (!contactIdChatwoot) { if (!contactIdChatwoot) {
res.set('Content-Type', 'text/xml') return res.set('Content-Type', 'text/xml').status(StatusCodes.OK).send(responseXml)
return res.status(StatusCodes.OK).send(responseXml)
} }
console.log('==========> crm contactIdChatwoot: ', contactIdChatwoot) console.log('==========> crm contactIdChatwoot: ', contactIdChatwoot)
@ -389,9 +387,7 @@ const webhook_crm = async (req, res) => {
} }
return res.set('Content-Type', 'text/xml').status(StatusCodes.OK).send(responseXml)
res.set('Content-Type', 'text/xml')
return res.status(StatusCodes.OK).send(responseXml)
} }
module.exports = { module.exports = {