1ee9520d8767754d04646e8656fab907e92c63ab
[motion-next.git] / server / api / whatsappInteraction / whatsappInteraction.rpc.js
1 const a797_0x3687=['limit','../../config/logger','register','debug','error','addTags','omit','./whatsappInteraction.socket','options','lodash','body','where','catch','AddTags','message','stringify','../../rediscache','attributes','rpc','then','raw','UpdateWhatsappInteraction'];(function(_0x238559,_0x368722){const _0x3a6c3f=function(_0x1d967b){while(--_0x1d967b){_0x238559['push'](_0x238559['shift']());}};_0x3a6c3f(++_0x368722);}(a797_0x3687,0xc5));const a797_0x3a6c=function(_0x238559,_0x368722){_0x238559=_0x238559-0x0;let _0x3a6c3f=a797_0x3687[_0x238559];return _0x3a6c3f;};const _0x48fb16=a797_0x3a6c;'use strict';const _=require(_0x48fb16('0xa')),db=require('../../mysqldb')['db'],logger=require(_0x48fb16('0x2'))(_0x48fb16('0x13')),{getSocket}=require(_0x48fb16('0x11')),socket=getSocket();require(_0x48fb16('0x8'))[_0x48fb16('0x3')](socket),exports[_0x48fb16('0x0')]=function(_0x1d967b){const _0x49819b=this;return new Promise(function(_0x19e2e3,_0x21a2f8){const _0x4a425d=a797_0x3a6c;return db['WhatsappInteraction']['update'](_0x1d967b[_0x4a425d('0xb')],{'raw':_0x1d967b[_0x4a425d('0x9')]?_0x1d967b['options'][_0x4a425d('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d967b['options']?_0x1d967b[_0x4a425d('0x9')][_0x4a425d('0xc')]||null:null,'attributes':_0x1d967b[_0x4a425d('0x9')]?_0x1d967b[_0x4a425d('0x9')][_0x4a425d('0x12')]||null:null,'limit':_0x1d967b[_0x4a425d('0x9')]?_0x1d967b[_0x4a425d('0x9')][_0x4a425d('0x1')]||null:null})[_0x4a425d('0x14')](function(_0x5dbab9){const _0x323682=_0x4a425d;logger['info'](_0x323682('0x0'),_0x1d967b),logger['debug']('UpdateWhatsappInteraction',_0x1d967b,JSON['stringify'](_0x5dbab9)),_0x19e2e3(_0x5dbab9);})[_0x4a425d('0xd')](function(_0x773106){const _0x3919bb=_0x4a425d;logger[_0x3919bb('0x5')](_0x3919bb('0x0'),_0x773106[_0x3919bb('0xf')],_0x1d967b),_0x21a2f8(_0x49819b['error'](0x1f4,_0x773106[_0x3919bb('0xf')]));});});},exports['AddTagsToWhatsappInteraction']=function(_0x67a10e){const _0x4f0f03=this;return new Promise(function(_0x1f27d6,_0x1260b3){const _0x30bffb=a797_0x3a6c;return db['WhatsappInteraction']['findOne']({'where':_0x67a10e[_0x30bffb('0x9')]?_0x67a10e['options'][_0x30bffb('0xc')]||null:null})[_0x30bffb('0x14')](function(_0x18a1c1){const _0x48e561=_0x30bffb;if(_0x18a1c1)return _0x18a1c1[_0x48e561('0x6')](_0x67a10e[_0x48e561('0xb')]['ids'],{'through':_[_0x48e561('0x7')](_0x67a10e[_0x48e561('0xb')],['ids','id'])});})['then'](function([_0x56d739]){const _0x34f175=_0x30bffb;logger['info'](_0x34f175('0xe'),_0x67a10e),logger[_0x34f175('0x4')](_0x34f175('0xe'),_0x67a10e,JSON[_0x34f175('0x10')](_0x56d739)),_0x1f27d6(_0x56d739);})[_0x30bffb('0xd')](function(_0x470bfc){const _0x3cbe64=_0x30bffb;logger[_0x3cbe64('0x5')](_0x3cbe64('0xe'),_0x470bfc['message'],_0x67a10e),_0x1260b3(_0x4f0f03['error'](0x1f4,_0x470bfc['message']));});});};