feat: implemented find companyId by omnihit accountId
parent
1d300e07ca
commit
f05bfa4047
|
@ -436,29 +436,19 @@ const webhook = async (req, res) => {
|
|||
}
|
||||
|
||||
let crmPhone = phone_number.replace('+', '')
|
||||
|
||||
|
||||
const company = await Company.findOne({
|
||||
integrations: {
|
||||
$elemMatch: {
|
||||
name: "omnihit",
|
||||
"config.accountId": accountId
|
||||
"config.accountId": `${accountId}`
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (!company) {
|
||||
return res.status(StatusCodes.NOT_FOUND).send({ msg: "companyId not found!" })
|
||||
}
|
||||
|
||||
console.log("======> company omnihit: ", company)
|
||||
|
||||
// const companies = [
|
||||
// // { companyId: "99", account_id: "1" },
|
||||
// { companyId: "99", account_id: "15" },
|
||||
// ]
|
||||
|
||||
// const obj = companies.find(c => +c.account_id == +accountId)
|
||||
}
|
||||
|
||||
console.log('=======> name: ', name)
|
||||
console.log('=======> crmPhone: ', crmPhone)
|
||||
|
@ -533,9 +523,7 @@ const webhook_crm = async (req, res) => {
|
|||
|
||||
if (!contact) return res.send()
|
||||
|
||||
const { phone } = contact
|
||||
|
||||
// const obj = omnihitV2Integration.find(o => o.companyId == companyId)
|
||||
const { phone } = contact
|
||||
|
||||
const config = await getIntegrationsConfig(companyId, 'omnihit')
|
||||
|
||||
|
@ -565,16 +553,7 @@ const webhook_crm = async (req, res) => {
|
|||
}
|
||||
|
||||
return res.set('Content-Type', 'text/xml').status(StatusCodes.OK).send(responseXml)
|
||||
}
|
||||
|
||||
const integration = async (req, res) => {
|
||||
const { companyId } = req.query
|
||||
const { integration } = req.body
|
||||
|
||||
console.log("====> companyId: ", companyId, " | integration: ", integration)
|
||||
|
||||
res.send()
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
contactCreate,
|
||||
|
|
Loading…
Reference in New Issue