Built motion from commit b517aaa2a6638133380e4d135c64a80893061362. Version 3.0.0...
[motion-next.git] / server / api / faxInteraction / faxInteraction.controller.js
index e84d657..8726642 100644 (file)
@@ -1 +1 @@
-const a198_0x4392=['rimraf','params','filter','fax_interaction_has_tags','i.FaxAccountId\x20IS\x20NOT\x20NULL','emit','Users','Account.key','stack','fax_accounts','error','pipe','some','type','search','TagIds','merge','color','c.firstName','rawAttributes','filters','fax_interactions','server','key','getFaxAccounts','\x27\x27\x27\x27','isNumeric','isEmpty','index','Contact.mobile','tag','Contact.email','findOne','join','undefined','fullname','setTags','null','update','mkdirSync','forEach','gte','end','createWriteStream','Contact.firstName','addMessage','ui.FaxInteractionId','sendStatus','$gte','unreadMessages','Contact.lastName','expr','i.id\x20LIKE\x20?','operator','Contact.phone','push','Attachment','split','pick','zip-dir','createdAt','t.id\x20=\x20it.TagId','fax_messages','buildExpression','model','includeAll','toString','o.internal','like','length','map','isArray','describe','api','getMessages','`\x20=\x200','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','i.FaxAccountId\x20IS\x20NULL','$substring','../../rediscache','find','download','destroy','util','i.FaxAccountId\x20IN\x20?','Tag','basename','body','groupBy','show','status','transcript-%d-%s.zip','cm_contacts','having','rows','files','c.lastName','field','Sequelize','YYYY-MM-DD\x20HH:mm:ss','tools_tags','concat','i.*','ContactId','value','json','replace','intersection','start','c.fax','../../config/environment','log','Messages','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','Contact','omit','sort','a.mandatoryDisposition','FaxAccountId','unlinkSync','then','resolve','Owner.fullname','order','\x20=\x20?','parse','./faxInteraction.socket','attributes','findAll','root','removeTags','text','existsSync','lodash','fieldName','nolimit','offset','Contact.fax','createReadStream','send','GROUP_CONCAT(DISTINCT\x20t.id)','fields','../../components/parsers/qs','name','left_join','UserId','../../components/parsers/advancedSearch','user_has_fax_interactions','a.id\x20=\x20i.FaxAccountId','../../config/logger','count','FaxInteractionId','o.fullname','i.id','sequelize','User','`unreadMessages`\x20>\x200','users','keys','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','Tags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','addTags','catch','compact','FaxInteraction','options','ui.FaxInteractionId\x20IN\x20?','attachments','create','select','conditions','query','format','all','limit','c.phone','moment','user','from','FaxMessage','Account.mandatoryDisposition','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','where','ids'];(function(_0x329b92,_0x4392d9){const _0x34b95b=function(_0x445b19){while(--_0x445b19){_0x329b92['push'](_0x329b92['shift']());}};_0x34b95b(++_0x4392d9);}(a198_0x4392,0x199));const a198_0x34b9=function(_0x329b92,_0x4392d9){_0x329b92=_0x329b92-0x0;let _0x34b95b=a198_0x4392[_0x329b92];return _0x34b95b;};const _0x2591b6=a198_0x34b9;'use strict';const rimraf=require(_0x2591b6('0x9b')),zipdir=require(_0x2591b6('0x1a')),moment=require(_0x2591b6('0x92')),util=require(_0x2591b6('0x32')),path=require('path'),fs=require('fs'),_=require(_0x2591b6('0x64')),squel=require('squel'),{getSocket}=require(_0x2591b6('0x2e')),socket=getSocket(),qs=require(_0x2591b6('0x6d')),as=require(_0x2591b6('0x71')),logger=require(_0x2591b6('0x74'))(_0x2591b6('0x28')),config=require(_0x2591b6('0x4d')),db=require('../../mysqldb')['db'],{Op}=require(_0x2591b6('0x79'));require(_0x2591b6('0x5d'))['register'](socket);function respondWithStatusCode(_0x445b19,_0x231fb6){return _0x231fb6=_0x231fb6||0xcc,function(_0x390c4c){if(_0x390c4c)return _0x445b19['sendStatus'](_0x231fb6);return _0x445b19['status'](_0x231fb6)['end']();};}function respondWithResult(_0xe60801,_0x28a373){return _0x28a373=_0x28a373||0xc8,function(_0x28798d){const _0x1b0486=a198_0x34b9;if(_0x28798d)return _0xe60801[_0x1b0486('0x39')](_0x28a373)['json'](_0x28798d);};}function respondWithFilteredResult(_0x1baa82,_0xd64ba1){return function(_0x642ebd){const _0x1b61e6=a198_0x34b9;if(_0x642ebd){const _0x3ed698=_0x642ebd[_0x1b61e6('0x75')],_0x3f1170=_0xd64ba1[_0x1b61e6('0x67')];let _0x4ba24f=_0xd64ba1[_0x1b61e6('0x67')]+_0xd64ba1['limit'],_0x46f648;return _0x4ba24f>=_0x3ed698?(_0x4ba24f=_0x3ed698,_0x46f648=0xc8):_0x46f648=0xce,_0x1baa82[_0x1b61e6('0x39')](_0x46f648),_0x1baa82['set']('Content-Range',_0x3f1170+'-'+_0x4ba24f+'/'+_0x3ed698)[_0x1b61e6('0x48')](_0x642ebd);}return null;};}function saveUpdates(_0x4c92eb){return function(_0x4209b1){const _0x25a58c=a198_0x34b9;if(_0x4209b1)return _0x4209b1[_0x25a58c('0x5')](_0x4c92eb)[_0x25a58c('0x57')](function(_0x3906da){return _0x3906da;});return null;};}function removeEntity(_0x157b84){return function(_0x283f2c){const _0x44119d=a198_0x34b9;if(_0x283f2c)return _0x283f2c['destroy']()[_0x44119d('0x57')](function(){const _0x124a25=_0x44119d;_0x157b84[_0x124a25('0x39')](0xcc)[_0x124a25('0x9')]();});};}function handleEntityNotFound(_0x1e212c){return function(_0x4ffe18){const _0xcf39a5=a198_0x34b9;return!_0x4ffe18&&_0x1e212c[_0xcf39a5('0xe')](0x194),_0x4ffe18;};}function handleError(_0x384f05,_0x5c3192){return _0x5c3192=_0x5c3192||0x1f4,function(_0x5273e6){const _0x10f37e=a198_0x34b9;logger[_0x10f37e('0xa5')](_0x5273e6[_0x10f37e('0xa3')]),_0x5273e6[_0x10f37e('0x6e')]&&delete _0x5273e6[_0x10f37e('0x6e')],_0x384f05[_0x10f37e('0x39')](_0x5c3192)[_0x10f37e('0x6a')](_0x5273e6);};}function getInteractionUsers(_0x4b319c,_0x38241c){return new Promise(function(_0x3e1f72,_0x48ec00){const _0x57e14e=a198_0x34b9;try{_0x38241c[_0x4b319c['id']]&&(_0x4b319c[_0x57e14e('0xa1')]=_['map'](_0x38241c[_0x4b319c['id']],function(_0x1fac65){const _0x21206b=_0x57e14e;return{'id':_0x1fac65['id'],'fullname':_0x1fac65[_0x21206b('0x2')]};}));}catch(_0x20991a){_0x48ec00(_0x20991a);}_0x3e1f72(_0x4b319c);});}function getInteractionTags(_0x281e46,_0xe4387){return new Promise(function(_0x19a21d,_0x5eaf72){const _0x502e2c=a198_0x34b9;try{_0x281e46['TagIds']&&(_0x281e46[_0x502e2c('0x81')]=[],_0x281e46['TagIds'][_0x502e2c('0x18')](',')[_0x502e2c('0x7')](function(_0x5e678a){const _0x38eb58=_0x502e2c;_0x281e46[_0x38eb58('0x81')][_0x38eb58('0x16')](_0xe4387[_0x5e678a]);})),delete _0x281e46[_0x502e2c('0xaa')];}catch(_0xf7ad9){_0x5eaf72(_0xf7ad9);}_0x19a21d(_0x281e46);});}function updateFaxInteraction(_0x1c869c,_0x5665e8,_0x6044fb){return new Promise(function(_0x1a737a,_0x4fddbd){const _0x5865f1=a198_0x34b9;return getInteractionUsers(_0x1c869c,_0x6044fb)[_0x5865f1('0x57')](function(_0x394958){return getInteractionTags(_0x394958,_0x5665e8);})[_0x5865f1('0x57')](function(_0x1e7517){_0x1a737a(_0x1e7517);})['catch'](function(_0x91b403){_0x4fddbd(_0x91b403);});});}exports[_0x2591b6('0xb7')]=function(_0x386f0a,_0x309fa0){const _0x2e6acd=_0x2591b6,_0xc6a3bc={},_0x58bc24={},_0x467a36={'count':0x0,'rows':[]},_0xa3a3d2=_[_0x2e6acd('0x25')](db[_0x2e6acd('0x86')][_0x2e6acd('0xae')],function(_0x3f0665){const _0x220f86=_0x2e6acd;return{'name':_0x3f0665[_0x220f86('0x65')],'type':_0x3f0665[_0x220f86('0xa8')][_0x220f86('0xb2')]};});_0x58bc24['model']=_[_0x2e6acd('0x25')](_0xa3a3d2,_0x2e6acd('0x6e')),_0x58bc24['query']=_[_0x2e6acd('0x7d')](_0x386f0a[_0x2e6acd('0x8d')]),_0x58bc24[_0x2e6acd('0xaf')]=_[_0x2e6acd('0x4a')](_0x58bc24[_0x2e6acd('0x1f')],_0x58bc24[_0x2e6acd('0x8d')]),_0xc6a3bc['attributes']=_['intersection'](_0x58bc24[_0x2e6acd('0x1f')],qs[_0x2e6acd('0x6c')](_0x386f0a[_0x2e6acd('0x8d')][_0x2e6acd('0x6c')])),_0xc6a3bc[_0x2e6acd('0x5e')]=_0xc6a3bc[_0x2e6acd('0x5e')][_0x2e6acd('0x24')]?_0xc6a3bc['attributes']:_0x58bc24[_0x2e6acd('0x1f')];typeof _0x386f0a[_0x2e6acd('0x8d')][_0x2e6acd('0x66')]===_0x2e6acd('0x1')&&(_0xc6a3bc['limit']=qs[_0x2e6acd('0x90')](_0x386f0a[_0x2e6acd('0x8d')][_0x2e6acd('0x90')]),_0xc6a3bc[_0x2e6acd('0x67')]=qs[_0x2e6acd('0x67')](_0x386f0a[_0x2e6acd('0x8d')]['offset']));_0xc6a3bc[_0x2e6acd('0x5a')]=qs[_0x2e6acd('0x53')](_0x386f0a['query'][_0x2e6acd('0x53')]),_0xc6a3bc[_0x2e6acd('0x99')]=qs[_0x2e6acd('0xaf')](_['pick'](_0x386f0a[_0x2e6acd('0x8d')],_0x58bc24[_0x2e6acd('0xaf')]),_0xa3a3d2);let _0x588813=[];const _0x48a233=squel[_0x2e6acd('0x8b')]()[_0x2e6acd('0x40')]('id')[_0x2e6acd('0x40')](_0x2e6acd('0x6e'))[_0x2e6acd('0x40')](_0x2e6acd('0xac'))[_0x2e6acd('0x94')]('tools_tags'),_0x2d4af8=squel[_0x2e6acd('0x8b')]()['field']('u.id')[_0x2e6acd('0x40')]('u.fullname')[_0x2e6acd('0x40')](_0x2e6acd('0xd'))['from'](_0x2e6acd('0x72'),'ui')[_0x2e6acd('0x6f')](_0x2e6acd('0x7c'),'u',_0x2e6acd('0x97')),_0x389c11=squel[_0x2e6acd('0x8b')]()['from'](_0x2e6acd('0xb0'),'i')['left_join'](_0x2e6acd('0x3b'),'c',_0x2e6acd('0x98'))['left_join'](_0x2e6acd('0x7c'),'o','o.id\x20=\x20i.UserId')[_0x2e6acd('0x6f')](_0x2e6acd('0xa4'),'a',_0x2e6acd('0x73'))['left_join'](_0x2e6acd('0x1d'),'me','me.FaxInteractionId\x20=\x20i.id')['left_join'](_0x2e6acd('0x9e'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x2e6acd('0x6f')](_0x2e6acd('0x43'),'t',_0x2e6acd('0x1c')),_0x5697e5=squel[_0x2e6acd('0x12')]();let _0x3571fb=[];const _0x970574=squel[_0x2e6acd('0x12')]();let _0x544e64;if(_0x386f0a[_0x2e6acd('0x8d')][_0x2e6acd('0xa9')]){_0x544e64=as['parseSearch'](_0x386f0a[_0x2e6acd('0x8d')][_0x2e6acd('0xa9')]);const _0x18325b=_0x544e64['sqlOperator'];for(let _0x43cc7f=0x0;_0x43cc7f<_0x544e64[_0x2e6acd('0x8c')][_0x2e6acd('0x24')];_0x43cc7f++){const _0xce2d36=_0x544e64['conditions'][_0x43cc7f],_0x3c50f4='i';let _0x1f250c,_0x73953e=_[_0x2e6acd('0x2f')](_0xa3a3d2,[_0x2e6acd('0x6e'),_0xce2d36['field']]);if(!_0x73953e)switch(_0xce2d36[_0x2e6acd('0x40')]){case _0x2e6acd('0x10'):_0xce2d36['value']==0x1?_0x389c11[_0x2e6acd('0x3c')]('`'+_0xce2d36[_0x2e6acd('0x40')]+_0x2e6acd('0x2a')):_0x389c11['having']('`'+_0xce2d36[_0x2e6acd('0x40')]+'`\x20>\x200');break;case _0x2e6acd('0x51'):if(_0xce2d36[_0x2e6acd('0x14')]==='$substring'){if(_0xce2d36[_0x2e6acd('0x47')][_0x2e6acd('0x18')]('\x20')[_0x2e6acd('0x24')]>0x1)_0x5697e5[_0x18325b](_0x2e6acd('0x50'),qs['getFullTextValue'](_0xce2d36[_0x2e6acd('0x47')]),null);else{const _0x30cd21='%'+_0xce2d36[_0x2e6acd('0x47')]+'%';_0x5697e5[_0x18325b](_0x2e6acd('0x2b'),_0x30cd21,_0x30cd21,_0x30cd21);}}else _0x73953e=_[_0x2e6acd('0x2f')](_0xa3a3d2,[_0x2e6acd('0x6e'),_0x2e6acd('0x46')]),_0xce2d36[_0x2e6acd('0x40')]='ContactId',_0x1f250c=as[_0x2e6acd('0x1e')](_0x3c50f4,_0x73953e[_0x2e6acd('0xa8')],_0xce2d36),_0x5697e5[_0x18325b](_0x1f250c[_0x2e6acd('0x62')],_0x1f250c[_0x2e6acd('0x47')][_0x2e6acd('0x4b')],_0x1f250c[_0x2e6acd('0x47')][_0x2e6acd('0x9')]);break;case _0x2e6acd('0x34'):{const _0x2164e1=_0xce2d36['value'][_0x2e6acd('0x18')](',')[_0x2e6acd('0x25')](function(_0x52b979){return Number(_0x52b979);});_0x2164e1[_0x2e6acd('0x7')](function(_0x355c07){const _0x4e1c57=_0x2e6acd;_0x970574['or'](_0x4e1c57('0x82'),'%,'+_0x355c07+',%');}),_0x3571fb=_['union'](_0x3571fb,_0x2164e1);}break;case _0x2e6acd('0x7a'):_0xce2d36['operator']===_0x2e6acd('0x2d')?_0x5697e5[_0x18325b]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xce2d36[_0x2e6acd('0x47')]+'%',null):(_0x73953e=_[_0x2e6acd('0x2f')](_0xa3a3d2,[_0x2e6acd('0x6e'),_0x2e6acd('0x70')]),_0xce2d36[_0x2e6acd('0x40')]='UserId',_0x1f250c=as[_0x2e6acd('0x1e')](_0x3c50f4,_0x73953e['type'],_0xce2d36),_0x5697e5[_0x18325b](_0x1f250c[_0x2e6acd('0x62')],_0x1f250c[_0x2e6acd('0x47')]['start'],_0x1f250c[_0x2e6acd('0x47')][_0x2e6acd('0x9')]));break;case _0x2e6acd('0x36'):_0x1f250c=as['buildExpression']('me',null,_0xce2d36),_0x5697e5[_0x18325b](_0x1f250c[_0x2e6acd('0x62')],_0x1f250c[_0x2e6acd('0x47')]['start'],_0x1f250c[_0x2e6acd('0x47')][_0x2e6acd('0x9')]);break;}else _0x1f250c=as[_0x2e6acd('0x1e')](_0x3c50f4,_0x73953e[_0x2e6acd('0xa8')],_0xce2d36),_0x5697e5[_0x18325b](_0x1f250c[_0x2e6acd('0x62')],_0x1f250c[_0x2e6acd('0x47')]['start'],_0x1f250c[_0x2e6acd('0x47')][_0x2e6acd('0x9')]);}}else{const _0x4f1b7e=_(_0x386f0a[_0x2e6acd('0x8d')])[_0x2e6acd('0x7d')]()[_0x2e6acd('0x25')](function(_0x4b9e26){const _0x3b75d4=_0x2e6acd;return _[_0x3b75d4('0xa7')](_0xa3a3d2,[_0x3b75d4('0x6e'),_0x4b9e26])?_0x4b9e26:undefined;})[_0x2e6acd('0x85')]()['value']();!_[_0x2e6acd('0xb6')](_0x4f1b7e)&&_0x4f1b7e[_0x2e6acd('0x7')](function(_0x50bd03){const _0x479284=_0x2e6acd;if(_0x50bd03==='FaxAccountId')_0x389c11['where'](_0x479284('0x33'),[][_0x479284('0x44')](_0x386f0a[_0x479284('0x8d')][_0x50bd03]));else{if(_0x50bd03===_0x479284('0x1b')){const _0x1edf11=JSON[_0x479284('0x5c')](_0x386f0a[_0x479284('0x8d')][_0x50bd03])[_0x479284('0xf')],_0xdc4084=JSON[_0x479284('0x5c')](_0x386f0a[_0x479284('0x8d')][_0x50bd03])['$lte'];_0x389c11[_0x479284('0x99')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1edf11,_0xdc4084);}else _0x386f0a[_0x479284('0x8d')][_0x50bd03]===_0x479284('0x4')?_0x389c11['where']('i.'+_0x50bd03+'\x20IS\x20NULL'):_0x389c11[_0x479284('0x99')]('i.'+_0x50bd03+_0x479284('0x5b'),_0x386f0a['query'][_0x50bd03]);}});_0x386f0a[_0x2e6acd('0x8d')]['read']&&(_0x386f0a['query']['read']==0x1?_0x389c11[_0x2e6acd('0x3c')]('`unreadMessages`\x20=\x200'):_0x389c11['having'](_0x2e6acd('0x7b')));_0x386f0a[_0x2e6acd('0x8d')][_0x2e6acd('0xb9')]&&(_0x3571fb=_[_0x2e6acd('0x26')](_0x386f0a['query'][_0x2e6acd('0xb9')])?_0x386f0a[_0x2e6acd('0x8d')][_0x2e6acd('0xb9')]:new Array(_0x386f0a[_0x2e6acd('0x8d')][_0x2e6acd('0xb9')]),_0x3571fb[_0x2e6acd('0x7')](function(_0x25c515){const _0xa03bd4=_0x2e6acd;_0x970574['or'](_0xa03bd4('0x82'),'%,'+_0x25c515+',%');}));if(_0x386f0a[_0x2e6acd('0x8d')][_0x2e6acd('0x9d')]){const _0x3a909f=_0x386f0a[_0x2e6acd('0x8d')][_0x2e6acd('0x9d')][_0x2e6acd('0x49')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x2e6acd('0xb4'));qs[_0x2e6acd('0xb5')](_0x3a909f)&&_0x5697e5['or'](_0x2e6acd('0x13'),_0x3a909f+'%')['or']('i.fax\x20LIKE\x20?',_0x3a909f+'%'),_0x5697e5['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3a909f+'%');}}_0x389c11[_0x2e6acd('0x99')](_0x5697e5),_0x389c11['group'](_0x2e6acd('0x78'));let _0xa6607a={'type':db[_0x2e6acd('0x41')]['QueryTypes']['SELECT'],'raw':!![]};const _0x49446f=_0x389c11[_0x2e6acd('0x7e')]();_0x49446f[_0x2e6acd('0x40')](_0x2e6acd('0x78')),_0x49446f[_0x2e6acd('0x40')](_0x2e6acd('0x7f'),_0x2e6acd('0x10')),_0xc6a3bc[_0x2e6acd('0x5a')]&&_0xc6a3bc['order'][_0x2e6acd('0x7')](function(_0x15cbc0){const _0x40108c=_0x2e6acd;_0x389c11[_0x40108c('0x5a')]('i.'+_0x15cbc0[0x0],_0x15cbc0[0x1]==='DESC'?![]:!![]);}),!_[_0x2e6acd('0xb6')](_0x3571fb)&&(_0x389c11[_0x2e6acd('0x3c')](_0x970574),_0x49446f[_0x2e6acd('0x99')](_0x2e6acd('0x80'),_0x3571fb)),Promise[_0x2e6acd('0x58')]()[_0x2e6acd('0x57')](function(){const _0xd5da5c=_0x2e6acd;if(!_0x544e64){if(_0x386f0a['query'][_0xd5da5c('0x55')]||_0x386f0a[_0xd5da5c('0x8d')]['journey'])return;_0x49446f[_0xd5da5c('0x99')](_0xd5da5c('0x9f')),_0x389c11['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}return _0x386f0a[_0xd5da5c('0x93')][_0xd5da5c('0xb3')]({'attributes':['id'],'raw':!![]})[_0xd5da5c('0x57')](function(_0x5ccfc1){const _0x13aeb1=_0xd5da5c;_[_0x13aeb1('0xb6')](_0x5ccfc1)?(_0x49446f[_0x13aeb1('0x99')](_0x13aeb1('0x2c')),_0x389c11[_0x13aeb1('0x99')](_0x13aeb1('0x2c'))):(_0x49446f[_0x13aeb1('0x99')](_0x13aeb1('0x33'),_[_0x13aeb1('0x25')](_0x5ccfc1,'id')),_0x389c11['where'](_0x13aeb1('0x33'),_[_0x13aeb1('0x25')](_0x5ccfc1,'id')));});})[_0x2e6acd('0x57')](function(){const _0x477853=_0x2e6acd;db[_0x477853('0x79')][_0x477853('0x8d')](_0x49446f[_0x477853('0x21')](),_0xa6607a)[_0x477853('0x57')](function(_0x3e6e3f){const _0x4107d7=_0x477853;_0x467a36[_0x4107d7('0x75')]=_0x3e6e3f['length'];if(_0x467a36['count']===0x0)return[];return db['sequelize'][_0x4107d7('0x8d')](_0x48a233['toString'](),_0xa6607a)[_0x4107d7('0x57')](function(_0x2936c8){const _0xe2fd0f=_0x4107d7;_0x588813=_['keyBy'](_0x2936c8,'id'),_0xa6607a=_['merge'](_0xa6607a,{'model':db[_0xe2fd0f('0x86')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x386f0a[_0xe2fd0f('0x8d')][_0xe2fd0f('0x6c')]?_0xc6a3bc[_0xe2fd0f('0x5e')][_0xe2fd0f('0x7')](function(_0x4bf22b){const _0x41afb5=_0xe2fd0f;_0x389c11[_0x41afb5('0x40')]('i.'+_0x4bf22b);}):(_0x389c11[_0xe2fd0f('0x40')](_0xe2fd0f('0x7f'),'unreadMessages'),_0x389c11[_0xe2fd0f('0x40')]('a.key',_0xe2fd0f('0xa2')),_0x389c11['field'](_0xe2fd0f('0x54'),_0xe2fd0f('0x96')),_0x389c11[_0xe2fd0f('0x40')](_0xe2fd0f('0x45')),_0x389c11['field'](_0xe2fd0f('0xad'),_0xe2fd0f('0xb')),_0x389c11[_0xe2fd0f('0x40')](_0xe2fd0f('0x3f'),_0xe2fd0f('0x11')),_0x389c11['field']('c.email',_0xe2fd0f('0xba')),_0x389c11[_0xe2fd0f('0x40')](_0xe2fd0f('0x91'),_0xe2fd0f('0x15')),_0x389c11[_0xe2fd0f('0x40')]('c.mobile',_0xe2fd0f('0xb8')),_0x389c11[_0xe2fd0f('0x40')](_0xe2fd0f('0x4c'),_0xe2fd0f('0x68')),_0x389c11['field'](_0xe2fd0f('0x77'),_0xe2fd0f('0x59')),_0x389c11[_0xe2fd0f('0x40')](_0xe2fd0f('0x22'),'Owner.internal'),_0x389c11[_0xe2fd0f('0x40')](_0xe2fd0f('0x6b'),_0xe2fd0f('0xaa')));if(_0xc6a3bc[_0xe2fd0f('0x90')])_0x389c11['limit'](_0xc6a3bc['limit']);if(_0xc6a3bc[_0xe2fd0f('0x67')])_0x389c11[_0xe2fd0f('0x67')](_0xc6a3bc[_0xe2fd0f('0x67')]);return db[_0xe2fd0f('0x79')][_0xe2fd0f('0x8d')](_0x389c11[_0xe2fd0f('0x21')](),_0xa6607a);})['then'](function(_0x3283d5){const _0x3c49c4=_0x4107d7;return _0x2d4af8[_0x3c49c4('0x99')](_0x3c49c4('0x88'),_[_0x3c49c4('0x25')](_0x3283d5,'id')),db['sequelize']['query'](_0x2d4af8[_0x3c49c4('0x21')](),_0xa6607a)[_0x3c49c4('0x57')](function(_0x43ab0a){const _0x5cc85e=_0x3c49c4,_0x145116=_[_0x5cc85e('0x37')](_0x43ab0a,_0x5cc85e('0x76')),_0x3815ef=[];return _0x3283d5[_0x5cc85e('0x7')](function(_0x36526f){_0x3815ef['push'](updateFaxInteraction(_0x36526f,_0x588813,_0x145116));}),Promise[_0x5cc85e('0x8f')](_0x3815ef);});});})[_0x477853('0x57')](function(_0x37fa58){const _0x56eed9=_0x477853;return _0x467a36[_0x56eed9('0x3d')]=_0x37fa58,_0x467a36;})[_0x477853('0x57')](respondWithFilteredResult(_0x309fa0,_0xc6a3bc));})[_0x2e6acd('0x84')](handleError(_0x309fa0,null));},exports[_0x2591b6('0x38')]=function(_0x11991c,_0x5a9c48){const _0x45cddd=_0x2591b6;let _0x1ef1bf={'raw':![],'where':{'id':_0x11991c['params']['id']}};const _0x57d4c3={};return _0x57d4c3[_0x45cddd('0x1f')]=_[_0x45cddd('0x7d')](db['FaxInteraction']['rawAttributes']),_0x57d4c3[_0x45cddd('0x8d')]=_[_0x45cddd('0x7d')](_0x11991c[_0x45cddd('0x8d')]),_0x57d4c3[_0x45cddd('0xaf')]=_[_0x45cddd('0x4a')](_0x57d4c3[_0x45cddd('0x1f')],_0x57d4c3[_0x45cddd('0x8d')]),_0x1ef1bf[_0x45cddd('0x5e')]=_[_0x45cddd('0x4a')](_0x57d4c3[_0x45cddd('0x1f')],qs[_0x45cddd('0x6c')](_0x11991c[_0x45cddd('0x8d')][_0x45cddd('0x6c')])),_0x1ef1bf[_0x45cddd('0x5e')]=_0x1ef1bf['attributes']['length']?_0x1ef1bf[_0x45cddd('0x5e')]:_0x57d4c3[_0x45cddd('0x1f')],_0x11991c[_0x45cddd('0x8d')][_0x45cddd('0x20')]&&(_0x1ef1bf['include']=[{'all':!![]}]),_0x1ef1bf=_['merge']({},_0x1ef1bf,_0x11991c[_0x45cddd('0x87')]),db[_0x45cddd('0x86')][_0x45cddd('0xbb')](_0x1ef1bf)[_0x45cddd('0x57')](handleEntityNotFound(_0x5a9c48,null))[_0x45cddd('0x57')](respondWithResult(_0x5a9c48,null))[_0x45cddd('0x84')](handleError(_0x5a9c48,null));},exports['create']=function(_0x532272,_0x20fe11){const _0xbbb965=_0x2591b6;return db[_0xbbb965('0x86')][_0xbbb965('0x8a')](_0x532272['body'],{})[_0xbbb965('0x57')](respondWithResult(_0x20fe11,0xc9))[_0xbbb965('0x84')](handleError(_0x20fe11,null));},exports[_0x2591b6('0x5')]=function(_0x2b0b99,_0x659c09){const _0x5e000f=_0x2591b6;return _0x2b0b99['body']['id']&&delete _0x2b0b99['body']['id'],db[_0x5e000f('0x86')][_0x5e000f('0xbb')]({'where':{'id':_0x2b0b99[_0x5e000f('0x9c')]['id']}})[_0x5e000f('0x57')](handleEntityNotFound(_0x659c09,null))['then'](saveUpdates(_0x2b0b99[_0x5e000f('0x36')],null))[_0x5e000f('0x57')](respondWithResult(_0x659c09,null))[_0x5e000f('0x84')](handleError(_0x659c09,null));},exports[_0x2591b6('0x31')]=function(_0x2d1506,_0x2f08ab){const _0x15dd4f=_0x2591b6;return db[_0x15dd4f('0x86')][_0x15dd4f('0xbb')]({'where':{'id':_0x2d1506['params']['id']}})[_0x15dd4f('0x57')](handleEntityNotFound(_0x2f08ab,null))[_0x15dd4f('0x57')](removeEntity(_0x2f08ab,null))[_0x15dd4f('0x84')](handleError(_0x2f08ab,null));},exports['describe']=function(_0x1380be,_0x300062){const _0x1cf30b=_0x2591b6;return db[_0x1cf30b('0x86')][_0x1cf30b('0x27')]()[_0x1cf30b('0x57')](respondWithResult(_0x300062,null))['catch'](handleError(_0x300062,null));},exports[_0x2591b6('0xc')]=function(_0x9711fa,_0x21d211){const _0x447fc6=_0x2591b6;return db[_0x447fc6('0x95')][_0x447fc6('0xbb')]({'where':{'id':_0x9711fa['params']['id']}})[_0x447fc6('0x57')](function(_0x535426){const _0xea4f3a=_0x447fc6;if(_0x535426)return _0x535426[_0xea4f3a('0xc')](_0x9711fa[_0xea4f3a('0x36')]['ids'],{'through':_[_0xea4f3a('0x52')](_0x9711fa['body'],['ids','id'])});})['then'](respondWithResult(_0x21d211,null))[_0x447fc6('0x84')](handleError(_0x21d211,null));},exports[_0x2591b6('0x29')]=function(_0x55cd5f,_0x1c50ce){const _0x23164c=_0x2591b6;let _0x35063f={'raw':![],'where':{}};const _0x1d6ae3={},_0x440308={'count':0x0,'rows':[]};return db[_0x23164c('0x86')][_0x23164c('0xbb')]({'where':{'id':_0x55cd5f[_0x23164c('0x9c')]['id']}})['then'](handleEntityNotFound(_0x1c50ce,null))[_0x23164c('0x57')](function(_0x38586c){const _0x342c70=_0x23164c;if(_0x38586c){_0x1d6ae3[_0x342c70('0x1f')]=_[_0x342c70('0x7d')](db[_0x342c70('0x95')][_0x342c70('0xae')]),_0x1d6ae3[_0x342c70('0x8d')]=_['keys'](_0x55cd5f['query']),_0x1d6ae3[_0x342c70('0xaf')]=_[_0x342c70('0x4a')](_0x1d6ae3[_0x342c70('0x1f')],_0x1d6ae3[_0x342c70('0x8d')]),_0x35063f[_0x342c70('0x5e')]=_[_0x342c70('0x4a')](_0x1d6ae3[_0x342c70('0x1f')],qs['fields'](_0x55cd5f[_0x342c70('0x8d')][_0x342c70('0x6c')])),_0x35063f[_0x342c70('0x5e')]=_0x35063f['attributes'][_0x342c70('0x24')]?_0x35063f[_0x342c70('0x5e')]:_0x1d6ae3['model'];typeof _0x55cd5f['query'][_0x342c70('0x66')]===_0x342c70('0x1')&&(_0x35063f[_0x342c70('0x90')]=qs[_0x342c70('0x90')](_0x55cd5f[_0x342c70('0x8d')][_0x342c70('0x90')]),_0x35063f[_0x342c70('0x67')]=qs[_0x342c70('0x67')](_0x55cd5f[_0x342c70('0x8d')]['offset']));_0x35063f['order']=qs[_0x342c70('0x53')](_0x55cd5f['query']['sort']),_0x35063f[_0x342c70('0x99')]=qs[_0x342c70('0xaf')](_[_0x342c70('0x19')](_0x55cd5f[_0x342c70('0x8d')],_0x1d6ae3[_0x342c70('0xaf')])),_0x35063f['where'][_0x342c70('0x76')]=_0x38586c['id'];_0x55cd5f[_0x342c70('0x8d')]['filter']&&(_0x35063f['where']=_[_0x342c70('0xab')](_0x35063f[_0x342c70('0x99')],{[Op['or']]:_[_0x342c70('0x25')](_0x35063f[_0x342c70('0x5e')],function(_0x368e7f){const _0x4a64a4=_0x342c70,_0x363a10={};return _0x363a10[_0x368e7f]={[Op[_0x4a64a4('0x23')]]:'%'+_0x55cd5f[_0x4a64a4('0x8d')][_0x4a64a4('0x9d')]+'%'},_0x363a10;})}));if(_0x55cd5f['query'][_0x342c70('0xf')]){const _0x4e9f0b=_0x55cd5f[_0x342c70('0x8d')][_0x342c70('0xf')]['split'](','),_0x2ba2f4={};_0x2ba2f4[_0x4e9f0b[0x0]]={[Op[_0x342c70('0x8')]]:moment(_0x4e9f0b[0x1])[_0x342c70('0x8e')](_0x342c70('0x42'))},_0x35063f[_0x342c70('0x99')]=_[_0x342c70('0xab')](_0x35063f['where'],_0x2ba2f4);}return _0x35063f=_['merge']({},_0x35063f,_0x55cd5f[_0x342c70('0x87')]),db[_0x342c70('0x95')][_0x342c70('0x75')]({'where':_0x35063f['where']})[_0x342c70('0x57')](function(_0x436c69){const _0x110815=_0x342c70;return _0x440308[_0x110815('0x75')]=_0x436c69,_0x55cd5f[_0x110815('0x8d')][_0x110815('0x20')]&&(_0x35063f['include']=[{'all':!![]}]),db[_0x110815('0x95')][_0x110815('0x5f')](_0x35063f);})[_0x342c70('0x57')](function(_0x52d685){const _0x27a45f=_0x342c70;return _0x440308[_0x27a45f('0x3d')]=_0x52d685,_0x440308;});}})[_0x23164c('0x57')](respondWithFilteredResult(_0x1c50ce,_0x35063f))[_0x23164c('0x84')](handleError(_0x1c50ce,null));},exports[_0x2591b6('0x83')]=function(_0x2c849f,_0x565ae7){const _0x224415=_0x2591b6;return db['FaxInteraction'][_0x224415('0xbb')]({'where':{'id':_0x2c849f[_0x224415('0x9c')]['id']}})['then'](function(_0x23ca5d){const _0x502415=_0x224415;if(_0x23ca5d)return _0x23ca5d[_0x502415('0x3')](_0x2c849f[_0x502415('0x36')][_0x502415('0x9a')],{'through':_[_0x502415('0x52')](_0x2c849f[_0x502415('0x36')],[_0x502415('0x9a'),'id'])})['then'](function(){const _0x177734=_0x502415;return db['Tag'][_0x177734('0x5f')]({'attributes':['id',_0x177734('0x6e'),_0x177734('0xac')],'where':{'id':_0x2c849f[_0x177734('0x36')][_0x177734('0x9a')]}});})[_0x502415('0x57')](function(_0x17845d){const _0x43f0fa=_0x502415;return socket[_0x43f0fa('0xa0')]('faxInteractionTags:save',{'id':Number(_0x2c849f[_0x43f0fa('0x9c')]['id']),'tags':_0x17845d||[]}),{'id':Number(_0x2c849f[_0x43f0fa('0x9c')]['id']),'tags':_0x17845d||[]};});})[_0x224415('0x57')](respondWithResult(_0x565ae7,null))[_0x224415('0x84')](handleError(_0x565ae7,null));},exports[_0x2591b6('0x61')]=function(_0x2867ae,_0x226edc){const _0x31402a=_0x2591b6;return db['FaxInteraction'][_0x31402a('0xbb')]({'where':{'id':_0x2867ae['params']['id']}})[_0x31402a('0x57')](handleEntityNotFound(_0x226edc,null))[_0x31402a('0x57')](function(_0x55684a){const _0x1b9a99=_0x31402a;if(_0x55684a)return _0x55684a[_0x1b9a99('0x61')](_0x2867ae[_0x1b9a99('0x8d')][_0x1b9a99('0x9a')]);})['then'](respondWithStatusCode(_0x226edc,null))['catch'](handleError(_0x226edc,null));},exports[_0x2591b6('0x30')]=function(_0x534afa,_0x4794ec){const _0x181239=_0x2591b6,_0x10070f=moment()['unix']()[_0x181239('0x21')](),_0x363d11=path[_0x181239('0x0')](config[_0x181239('0x60')],_0x181239('0xb1'),'files','tmp'),_0x547c9a=path[_0x181239('0x0')](config[_0x181239('0x60')],_0x181239('0xb1'),_0x181239('0x3e'),_0x181239('0x89')),_0x979df1=path[_0x181239('0x0')](_0x363d11,_0x10070f),_0x448980=util[_0x181239('0x8e')](_0x181239('0x3a'),_0x534afa[_0x181239('0x9c')]['id'],_0x10070f),_0x8b3848=path['join'](_0x363d11,_0x448980),_0x374e78=[];_0x374e78[_0x181239('0x16')]({'model':db[_0x181239('0x17')],'as':_0x181239('0x17'),'raw':!![]});const _0x337af4=[{'model':db['FaxMessage'],'as':_0x181239('0x4f'),'attributes':['id',_0x181239('0x36'),_0x181239('0x1b')],'include':_0x374e78}];return db[_0x181239('0x86')][_0x181239('0xbb')]({'where':{'id':_0x534afa[_0x181239('0x9c')]['id']},'include':_0x337af4})['then'](handleEntityNotFound(_0x4794ec,null))[_0x181239('0x57')](function(_0x231be2){const _0x4f44c0=_0x181239;if(_0x231be2&&_0x231be2[_0x4f44c0('0x4f')]){const _0x5d9953=_0x231be2['get']({'plain':!![]});fs[_0x4f44c0('0x6')](_0x979df1);for(let _0x39fefe=0x0;_0x39fefe<_0x5d9953['Messages']['length'];_0x39fefe++){const _0x2b74d5=_0x5d9953[_0x4f44c0('0x4f')][_0x39fefe][_0x4f44c0('0x17')];if(_0x2b74d5){const _0x10ddfb=path[_0x4f44c0('0x0')](_0x547c9a,_0x2b74d5['basename']);fs[_0x4f44c0('0x63')](_0x10ddfb)&&fs[_0x4f44c0('0x69')](_0x10ddfb)[_0x4f44c0('0xa6')](fs[_0x4f44c0('0xa')](path['join'](_0x979df1,_0x2b74d5[_0x4f44c0('0x35')])));}}return Promise[_0x4f44c0('0x58')]()[_0x4f44c0('0x57')](function(){const _0x273d62=_0x4f44c0;return new Promise(function(_0x1136a5,_0x10c078){zipdir(_0x979df1,{'saveTo':_0x8b3848},function(_0x2e9325,_0x207b93){if(_0x2e9325)return _0x10c078(_0x2e9325);return _0x1136a5(_0x207b93);});})[_0x273d62('0x57')](function(){return new Promise(function(_0x7d6ef4,_0x50f718){rimraf(_0x979df1,function(_0xecd126){if(_0xecd126)_0x50f718(_0xecd126);return _0x7d6ef4();});});})['then'](function(){const _0x304184=_0x273d62;return _0x4794ec[_0x304184('0x30')](_0x8b3848,_0x448980,function(_0x788ed2){const _0x17aef9=_0x304184;_0x788ed2?console[_0x17aef9('0x4e')]('err',_0x788ed2):fs[_0x17aef9('0x56')](_0x8b3848);});});});}else return _0x4794ec[_0x4f44c0('0xe')](0xc8);})['catch'](handleError(_0x4794ec,null));};
\ No newline at end of file
+const a198_0x52fd=['Contact.firstName','i.FaxAccountId\x20IN\x20?','FaxInteractionId','a.id\x20=\x20i.FaxAccountId','start','i.id\x20LIKE\x20?','union','offset','lodash','join','rimraf','removeTags','c.fax','concat','GROUP_CONCAT(DISTINCT\x20t.id)','json','YYYY-MM-DD\x20HH:mm:ss','c.email','FaxMessage','filter','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','user','parseSearch','nolimit','Attachment','`unreadMessages`\x20>\x200','$substring','./faxInteraction.socket','select','ids','pipe','stack','options','download','zip-dir','o.internal','addTags','left_join','limit','params','some','from','forEach','create','like','query','push','fax_accounts','keyBy','../../config/environment','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','unix','../../components/parsers/advancedSearch','fax_interactions','ContactId','mkdirSync','root','files','u.fullname','$gte','basename','group','text','squel','body','journey','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','key','me.FaxInteractionId\x20=\x20i.id','includeAll','order','merge','replace','\x20IS\x20NULL','gte','parse','isNumeric','c.firstName','\x27\x27\x27\x27','a.mandatoryDisposition','user_has_fax_interactions','operator','faxInteractionTags:save','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','field','map','fullname','util','sequelize','findAll','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','i.*','unlinkSync','`\x20>\x200','read','fax_interaction_has_tags','get','count','createdAt','path','\x20=\x20?','filters','server','FaxAccountId','i.fax\x20LIKE\x20?','search','addMessage','resolve','keys','color','groupBy','Tag','Contact.mobile','buildExpression','update','omit','isEmpty','User','FaxInteraction','Contact.fax','Contact.email','u.id\x20=\x20ui.UserId','sendStatus','i.id','error','attributes','`unreadMessages`\x20=\x200','../../config/logger','transcript-%d-%s.zip','fields','send','Users','Messages','rawAttributes','model','name','o.fullname','tag','status','i.FaxAccountId\x20IS\x20NOT\x20NULL','TagIds','err','fax_messages','getFaxAccounts','getMessages','i.FaxAccountId\x20IS\x20NULL','register','pick','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','Owner.internal','it.FaxInteractionId\x20=\x20i.id','QueryTypes','unreadMessages','rows','UserId','null','log','ui.FaxInteractionId','emit','catch','intersection','find','Tags','split','where','tools_tags','cm_contacts','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','sort','expr','$lte','destroy','api','../../mysqldb','toString','Account.mandatoryDisposition','setTags','SELECT','compact','having','createReadStream','c.phone','t.id\x20=\x20it.TagId','getFullTextValue','describe','Sequelize','undefined','value','users','include','show','../../rediscache','u.id','Contact.phone','../../components/parsers/qs','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','type','end','then','index','format','findOne'];(function(_0x93c4bb,_0x52fd6a){const _0x47152f=function(_0x2788f4){while(--_0x2788f4){_0x93c4bb['push'](_0x93c4bb['shift']());}};_0x47152f(++_0x52fd6a);}(a198_0x52fd,0x80));const a198_0x4715=function(_0x93c4bb,_0x52fd6a){_0x93c4bb=_0x93c4bb-0x0;let _0x47152f=a198_0x52fd[_0x93c4bb];return _0x47152f;};const _0x1fcc06=a198_0x4715;'use strict';const rimraf=require(_0x1fcc06('0x55')),zipdir=require(_0x1fcc06('0x6d')),moment=require('moment'),util=require(_0x1fcc06('0xa3')),path=require(_0x1fcc06('0xaf')),fs=require('fs'),_=require(_0x1fcc06('0x53')),squel=require(_0x1fcc06('0x8a')),{getSocket}=require(_0x1fcc06('0x40')),socket=getSocket(),qs=require(_0x1fcc06('0x43')),as=require(_0x1fcc06('0x7f')),logger=require(_0x1fcc06('0x0'))(_0x1fcc06('0x2d')),config=require(_0x1fcc06('0x7c')),db=require(_0x1fcc06('0x2e'))['db'],{Op}=require(_0x1fcc06('0xa4'));require(_0x1fcc06('0x66'))[_0x1fcc06('0x13')](socket);function respondWithStatusCode(_0x2788f4,_0x2958d4){return _0x2958d4=_0x2958d4||0xcc,function(_0x39e7c8){const _0x3f1f5d=a198_0x4715;if(_0x39e7c8)return _0x2788f4[_0x3f1f5d('0xc6')](_0x2958d4);return _0x2788f4['status'](_0x2958d4)[_0x3f1f5d('0x46')]();};}function respondWithResult(_0x3ee6d2,_0x19c504){return _0x19c504=_0x19c504||0xc8,function(_0x29d8c6){const _0x31e737=a198_0x4715;if(_0x29d8c6)return _0x3ee6d2[_0x31e737('0xb')](_0x19c504)[_0x31e737('0x5a')](_0x29d8c6);};}function respondWithFilteredResult(_0x48c10f,_0x24ac2e){return function(_0x37201c){const _0x57e294=a198_0x4715;if(_0x37201c){const _0x3bdda0=_0x37201c['count'],_0x20848b=_0x24ac2e[_0x57e294('0x52')];let _0x493fa0=_0x24ac2e[_0x57e294('0x52')]+_0x24ac2e[_0x57e294('0x71')],_0x352011;return _0x493fa0>=_0x3bdda0?(_0x493fa0=_0x3bdda0,_0x352011=0xc8):_0x352011=0xce,_0x48c10f[_0x57e294('0xb')](_0x352011),_0x48c10f['set']('Content-Range',_0x20848b+'-'+_0x493fa0+'/'+_0x3bdda0)[_0x57e294('0x5a')](_0x37201c);}return null;};}function saveUpdates(_0x370787){return function(_0x16fd1c){const _0x3b81fe=a198_0x4715;if(_0x16fd1c)return _0x16fd1c[_0x3b81fe('0xbe')](_0x370787)[_0x3b81fe('0x47')](function(_0x26fb34){return _0x26fb34;});return null;};}function removeEntity(_0x59b1b6){return function(_0x545b1c){const _0x53a9ff=a198_0x4715;if(_0x545b1c)return _0x545b1c[_0x53a9ff('0x2c')]()['then'](function(){const _0x4dc5bc=_0x53a9ff;_0x59b1b6[_0x4dc5bc('0xb')](0xcc)[_0x4dc5bc('0x46')]();});};}function handleEntityNotFound(_0x2bd802){return function(_0x553523){return!_0x553523&&_0x2bd802['sendStatus'](0x194),_0x553523;};}function handleError(_0x2f117e,_0x864d76){return _0x864d76=_0x864d76||0x1f4,function(_0x56eda8){const _0xc04c18=a198_0x4715;logger[_0xc04c18('0xc8')](_0x56eda8[_0xc04c18('0x6a')]),_0x56eda8['name']&&delete _0x56eda8[_0xc04c18('0x8')],_0x2f117e[_0xc04c18('0xb')](_0x864d76)[_0xc04c18('0x3')](_0x56eda8);};}function getInteractionUsers(_0x143776,_0x8c9956){return new Promise(function(_0x4d0965,_0x5ecb06){const _0x14475e=a198_0x4715;try{_0x8c9956[_0x143776['id']]&&(_0x143776[_0x14475e('0x4')]=_['map'](_0x8c9956[_0x143776['id']],function(_0x1a435f){const _0x324d9d=_0x14475e;return{'id':_0x1a435f['id'],'fullname':_0x1a435f[_0x324d9d('0xa2')]};}));}catch(_0x4f0d0b){_0x5ecb06(_0x4f0d0b);}_0x4d0965(_0x143776);});}function getInteractionTags(_0x1bbe4b,_0x119247){return new Promise(function(_0x20756d,_0x40242e){const _0x101f86=a198_0x4715;try{_0x1bbe4b[_0x101f86('0xd')]&&(_0x1bbe4b['Tags']=[],_0x1bbe4b[_0x101f86('0xd')][_0x101f86('0x24')](',')[_0x101f86('0x75')](function(_0x249522){const _0x2465e0=_0x101f86;_0x1bbe4b[_0x2465e0('0x23')][_0x2465e0('0x79')](_0x119247[_0x249522]);})),delete _0x1bbe4b['TagIds'];}catch(_0x232f5a){_0x40242e(_0x232f5a);}_0x20756d(_0x1bbe4b);});}function updateFaxInteraction(_0xe5a66a,_0x5a7c33,_0x1e1a4b){return new Promise(function(_0x577f97,_0x4f9ea3){const _0x575b96=a198_0x4715;return getInteractionUsers(_0xe5a66a,_0x1e1a4b)['then'](function(_0x3fdba7){return getInteractionTags(_0x3fdba7,_0x5a7c33);})['then'](function(_0x10206c){_0x577f97(_0x10206c);})[_0x575b96('0x20')](function(_0x5cdb7d){_0x4f9ea3(_0x5cdb7d);});});}exports[_0x1fcc06('0x48')]=function(_0x155390,_0x5984cd){const _0x2eb36b=_0x1fcc06,_0x584c3f={},_0x262e60={},_0x1c6f7d={'count':0x0,'rows':[]},_0x736e97=_[_0x2eb36b('0xa1')](db[_0x2eb36b('0xc2')][_0x2eb36b('0x6')],function(_0x426e40){const _0xe6b4ce=_0x2eb36b;return{'name':_0x426e40['fieldName'],'type':_0x426e40['type'][_0xe6b4ce('0x8e')]};});_0x262e60[_0x2eb36b('0x7')]=_[_0x2eb36b('0xa1')](_0x736e97,'name'),_0x262e60[_0x2eb36b('0x78')]=_['keys'](_0x155390['query']),_0x262e60[_0x2eb36b('0xb1')]=_[_0x2eb36b('0x21')](_0x262e60[_0x2eb36b('0x7')],_0x262e60['query']),_0x584c3f['attributes']=_[_0x2eb36b('0x21')](_0x262e60[_0x2eb36b('0x7')],qs['fields'](_0x155390[_0x2eb36b('0x78')][_0x2eb36b('0x2')])),_0x584c3f[_0x2eb36b('0xc9')]=_0x584c3f[_0x2eb36b('0xc9')]['length']?_0x584c3f['attributes']:_0x262e60['model'];typeof _0x155390[_0x2eb36b('0x78')]['nolimit']===_0x2eb36b('0x3b')&&(_0x584c3f[_0x2eb36b('0x71')]=qs[_0x2eb36b('0x71')](_0x155390[_0x2eb36b('0x78')][_0x2eb36b('0x71')]),_0x584c3f['offset']=qs[_0x2eb36b('0x52')](_0x155390[_0x2eb36b('0x78')][_0x2eb36b('0x52')]));_0x584c3f['order']=qs[_0x2eb36b('0x29')](_0x155390[_0x2eb36b('0x78')][_0x2eb36b('0x29')]),_0x584c3f['where']=qs[_0x2eb36b('0xb1')](_[_0x2eb36b('0x14')](_0x155390[_0x2eb36b('0x78')],_0x262e60[_0x2eb36b('0xb1')]),_0x736e97);let _0x165810=[];const _0x53ee61=squel[_0x2eb36b('0x67')]()[_0x2eb36b('0xa0')]('id')[_0x2eb36b('0xa0')]('name')[_0x2eb36b('0xa0')](_0x2eb36b('0xb9'))[_0x2eb36b('0x74')]('tools_tags'),_0x1eed86=squel[_0x2eb36b('0x67')]()[_0x2eb36b('0xa0')](_0x2eb36b('0x41'))[_0x2eb36b('0xa0')](_0x2eb36b('0x85'))[_0x2eb36b('0xa0')](_0x2eb36b('0x1e'))[_0x2eb36b('0x74')](_0x2eb36b('0x9b'),'ui')[_0x2eb36b('0x70')](_0x2eb36b('0x3d'),'u',_0x2eb36b('0xc5')),_0x3d205d=squel[_0x2eb36b('0x67')]()[_0x2eb36b('0x74')](_0x2eb36b('0x80'),'i')[_0x2eb36b('0x70')](_0x2eb36b('0x27'),'c',_0x2eb36b('0x7d'))[_0x2eb36b('0x70')](_0x2eb36b('0x3d'),'o','o.id\x20=\x20i.UserId')[_0x2eb36b('0x70')](_0x2eb36b('0x7a'),'a',_0x2eb36b('0x4e'))['left_join'](_0x2eb36b('0xf'),'me',_0x2eb36b('0x8f'))[_0x2eb36b('0x70')](_0x2eb36b('0xab'),'it',_0x2eb36b('0x17'))[_0x2eb36b('0x70')](_0x2eb36b('0x26'),'t',_0x2eb36b('0x37')),_0x10697f=squel[_0x2eb36b('0x2a')]();let _0x35ca57=[];const _0x4905a4=squel[_0x2eb36b('0x2a')]();let _0x36c978;if(_0x155390['query'][_0x2eb36b('0xb5')]){_0x36c978=as[_0x2eb36b('0x61')](_0x155390[_0x2eb36b('0x78')][_0x2eb36b('0xb5')]);const _0x2ba6e7=_0x36c978['sqlOperator'];for(let _0x54b35b=0x0;_0x54b35b<_0x36c978['conditions'][_0x2eb36b('0x9e')];_0x54b35b++){const _0x200220=_0x36c978['conditions'][_0x54b35b],_0x1009d3='i';let _0x43218e,_0x364a1c=_[_0x2eb36b('0x22')](_0x736e97,[_0x2eb36b('0x8'),_0x200220['field']]);if(!_0x364a1c)switch(_0x200220[_0x2eb36b('0xa0')]){case _0x2eb36b('0x19'):_0x200220['value']==0x1?_0x3d205d[_0x2eb36b('0x34')]('`'+_0x200220[_0x2eb36b('0xa0')]+'`\x20=\x200'):_0x3d205d[_0x2eb36b('0x34')]('`'+_0x200220[_0x2eb36b('0xa0')]+_0x2eb36b('0xa9'));break;case'Contact':if(_0x200220[_0x2eb36b('0x9c')]===_0x2eb36b('0x65')){if(_0x200220[_0x2eb36b('0x3c')][_0x2eb36b('0x24')]('\x20')['length']>0x1)_0x10697f[_0x2ba6e7](_0x2eb36b('0x9f'),qs[_0x2eb36b('0x38')](_0x200220[_0x2eb36b('0x3c')]),null);else{const _0x4c3f13='%'+_0x200220[_0x2eb36b('0x3c')]+'%';_0x10697f[_0x2ba6e7](_0x2eb36b('0x15'),_0x4c3f13,_0x4c3f13,_0x4c3f13);}}else _0x364a1c=_[_0x2eb36b('0x22')](_0x736e97,[_0x2eb36b('0x8'),_0x2eb36b('0x81')]),_0x200220['field']=_0x2eb36b('0x81'),_0x43218e=as[_0x2eb36b('0xbd')](_0x1009d3,_0x364a1c[_0x2eb36b('0x45')],_0x200220),_0x10697f[_0x2ba6e7](_0x43218e[_0x2eb36b('0x89')],_0x43218e['value'][_0x2eb36b('0x4f')],_0x43218e[_0x2eb36b('0x3c')][_0x2eb36b('0x46')]);break;case _0x2eb36b('0xbb'):{const _0x3580f8=_0x200220[_0x2eb36b('0x3c')][_0x2eb36b('0x24')](',')[_0x2eb36b('0xa1')](function(_0x221988){return Number(_0x221988);});_0x3580f8[_0x2eb36b('0x75')](function(_0x1c3e66){_0x4905a4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1c3e66+',%');}),_0x35ca57=_[_0x2eb36b('0x51')](_0x35ca57,_0x3580f8);}break;case _0x2eb36b('0xc1'):_0x200220[_0x2eb36b('0x9c')]===_0x2eb36b('0x65')?_0x10697f[_0x2ba6e7](_0x2eb36b('0x8d'),'%'+_0x200220[_0x2eb36b('0x3c')]+'%',null):(_0x364a1c=_[_0x2eb36b('0x22')](_0x736e97,['name',_0x2eb36b('0x1b')]),_0x200220[_0x2eb36b('0xa0')]=_0x2eb36b('0x1b'),_0x43218e=as[_0x2eb36b('0xbd')](_0x1009d3,_0x364a1c[_0x2eb36b('0x45')],_0x200220),_0x10697f[_0x2ba6e7](_0x43218e[_0x2eb36b('0x89')],_0x43218e[_0x2eb36b('0x3c')][_0x2eb36b('0x4f')],_0x43218e[_0x2eb36b('0x3c')]['end']));break;case _0x2eb36b('0x8b'):_0x43218e=as[_0x2eb36b('0xbd')]('me',null,_0x200220),_0x10697f[_0x2ba6e7](_0x43218e[_0x2eb36b('0x89')],_0x43218e[_0x2eb36b('0x3c')]['start'],_0x43218e[_0x2eb36b('0x3c')][_0x2eb36b('0x46')]);break;}else _0x43218e=as[_0x2eb36b('0xbd')](_0x1009d3,_0x364a1c[_0x2eb36b('0x45')],_0x200220),_0x10697f[_0x2ba6e7](_0x43218e[_0x2eb36b('0x89')],_0x43218e['value'][_0x2eb36b('0x4f')],_0x43218e['value']['end']);}}else{const _0x426251=_(_0x155390[_0x2eb36b('0x78')])[_0x2eb36b('0xb8')]()[_0x2eb36b('0xa1')](function(_0x380eeb){const _0x3ccec1=_0x2eb36b;return _[_0x3ccec1('0x73')](_0x736e97,[_0x3ccec1('0x8'),_0x380eeb])?_0x380eeb:undefined;})[_0x2eb36b('0x33')]()[_0x2eb36b('0x3c')]();!_['isEmpty'](_0x426251)&&_0x426251[_0x2eb36b('0x75')](function(_0x4eec09){const _0x464fd0=_0x2eb36b;if(_0x4eec09===_0x464fd0('0xb3'))_0x3d205d[_0x464fd0('0x25')](_0x464fd0('0x4c'),[][_0x464fd0('0x58')](_0x155390[_0x464fd0('0x78')][_0x4eec09]));else{if(_0x4eec09===_0x464fd0('0xae')){const _0x4e94f4=JSON[_0x464fd0('0x96')](_0x155390[_0x464fd0('0x78')][_0x4eec09])[_0x464fd0('0x86')],_0x5aac21=JSON[_0x464fd0('0x96')](_0x155390[_0x464fd0('0x78')][_0x4eec09])[_0x464fd0('0x2b')];_0x3d205d[_0x464fd0('0x25')](_0x464fd0('0x5f'),_0x4e94f4,_0x5aac21);}else _0x155390['query'][_0x4eec09]===_0x464fd0('0x1c')?_0x3d205d['where']('i.'+_0x4eec09+_0x464fd0('0x94')):_0x3d205d[_0x464fd0('0x25')]('i.'+_0x4eec09+_0x464fd0('0xb0'),_0x155390['query'][_0x4eec09]);}});_0x155390['query'][_0x2eb36b('0xaa')]&&(_0x155390[_0x2eb36b('0x78')][_0x2eb36b('0xaa')]==0x1?_0x3d205d[_0x2eb36b('0x34')](_0x2eb36b('0xca')):_0x3d205d[_0x2eb36b('0x34')](_0x2eb36b('0x64')));_0x155390['query'][_0x2eb36b('0xa')]&&(_0x35ca57=_['isArray'](_0x155390['query']['tag'])?_0x155390[_0x2eb36b('0x78')][_0x2eb36b('0xa')]:new Array(_0x155390[_0x2eb36b('0x78')][_0x2eb36b('0xa')]),_0x35ca57[_0x2eb36b('0x75')](function(_0x4da5ce){const _0x258bc3=_0x2eb36b;_0x4905a4['or'](_0x258bc3('0x28'),'%,'+_0x4da5ce+',%');}));if(_0x155390[_0x2eb36b('0x78')]['filter']){const _0x557987=_0x155390['query'][_0x2eb36b('0x5e')]['replace']('\x5c','\x5c\x5c')[_0x2eb36b('0x93')]('\x27\x27',_0x2eb36b('0x99'));qs[_0x2eb36b('0x97')](_0x557987)&&_0x10697f['or'](_0x2eb36b('0x50'),_0x557987+'%')['or'](_0x2eb36b('0xb4'),_0x557987+'%'),_0x10697f['or'](_0x2eb36b('0x44'),_0x557987+'%');}}_0x3d205d['where'](_0x10697f),_0x3d205d[_0x2eb36b('0x88')](_0x2eb36b('0xc7'));let _0x1d3b03={'type':db[_0x2eb36b('0x3a')][_0x2eb36b('0x18')][_0x2eb36b('0x32')],'raw':!![]};const _0xe25745=_0x3d205d['clone']();_0xe25745['field']('i.id'),_0xe25745['field'](_0x2eb36b('0xa6'),_0x2eb36b('0x19')),_0x584c3f[_0x2eb36b('0x91')]&&_0x584c3f[_0x2eb36b('0x91')][_0x2eb36b('0x75')](function(_0x4c4a49){const _0x18659b=_0x2eb36b;_0x3d205d[_0x18659b('0x91')]('i.'+_0x4c4a49[0x0],_0x4c4a49[0x1]==='DESC'?![]:!![]);}),!_[_0x2eb36b('0xc0')](_0x35ca57)&&(_0x3d205d[_0x2eb36b('0x34')](_0x4905a4),_0xe25745[_0x2eb36b('0x25')]('t.id\x20IN\x20?',_0x35ca57)),Promise[_0x2eb36b('0xb7')]()[_0x2eb36b('0x47')](function(){const _0x3ecbaf=_0x2eb36b;if(!_0x36c978){if(_0x155390['query']['FaxAccountId']||_0x155390[_0x3ecbaf('0x78')][_0x3ecbaf('0x8c')])return;_0xe25745[_0x3ecbaf('0x25')](_0x3ecbaf('0xc')),_0x3d205d[_0x3ecbaf('0x25')](_0x3ecbaf('0xc'));return;}return _0x155390[_0x3ecbaf('0x60')][_0x3ecbaf('0x10')]({'attributes':['id'],'raw':!![]})[_0x3ecbaf('0x47')](function(_0x24eb6a){const _0x49df17=_0x3ecbaf;_[_0x49df17('0xc0')](_0x24eb6a)?(_0xe25745['where']('i.FaxAccountId\x20IS\x20NULL'),_0x3d205d[_0x49df17('0x25')](_0x49df17('0x12'))):(_0xe25745[_0x49df17('0x25')](_0x49df17('0x4c'),_[_0x49df17('0xa1')](_0x24eb6a,'id')),_0x3d205d['where'](_0x49df17('0x4c'),_[_0x49df17('0xa1')](_0x24eb6a,'id')));});})[_0x2eb36b('0x47')](function(){const _0x191858=_0x2eb36b;db['sequelize'][_0x191858('0x78')](_0xe25745['toString'](),_0x1d3b03)[_0x191858('0x47')](function(_0x1b6829){const _0x1bb6a=_0x191858;_0x1c6f7d[_0x1bb6a('0xad')]=_0x1b6829[_0x1bb6a('0x9e')];if(_0x1c6f7d[_0x1bb6a('0xad')]===0x0)return[];return db[_0x1bb6a('0xa4')]['query'](_0x53ee61[_0x1bb6a('0x2f')](),_0x1d3b03)[_0x1bb6a('0x47')](function(_0x506c5d){const _0x2628cd=_0x1bb6a;_0x165810=_[_0x2628cd('0x7b')](_0x506c5d,'id'),_0x1d3b03=_[_0x2628cd('0x92')](_0x1d3b03,{'model':db[_0x2628cd('0xc2')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x155390[_0x2628cd('0x78')]['fields']?_0x584c3f[_0x2628cd('0xc9')][_0x2628cd('0x75')](function(_0x5bfabb){_0x3d205d['field']('i.'+_0x5bfabb);}):(_0x3d205d[_0x2628cd('0xa0')](_0x2628cd('0xa6'),_0x2628cd('0x19')),_0x3d205d[_0x2628cd('0xa0')]('a.key','Account.key'),_0x3d205d['field'](_0x2628cd('0x9a'),_0x2628cd('0x30')),_0x3d205d[_0x2628cd('0xa0')](_0x2628cd('0xa7')),_0x3d205d[_0x2628cd('0xa0')](_0x2628cd('0x98'),_0x2628cd('0x4b')),_0x3d205d[_0x2628cd('0xa0')]('c.lastName','Contact.lastName'),_0x3d205d[_0x2628cd('0xa0')](_0x2628cd('0x5c'),_0x2628cd('0xc4')),_0x3d205d[_0x2628cd('0xa0')](_0x2628cd('0x36'),_0x2628cd('0x42')),_0x3d205d['field']('c.mobile',_0x2628cd('0xbc')),_0x3d205d[_0x2628cd('0xa0')](_0x2628cd('0x57'),_0x2628cd('0xc3')),_0x3d205d['field'](_0x2628cd('0x9'),'Owner.fullname'),_0x3d205d[_0x2628cd('0xa0')](_0x2628cd('0x6e'),_0x2628cd('0x16')),_0x3d205d[_0x2628cd('0xa0')](_0x2628cd('0x59'),_0x2628cd('0xd')));if(_0x584c3f[_0x2628cd('0x71')])_0x3d205d[_0x2628cd('0x71')](_0x584c3f['limit']);if(_0x584c3f['offset'])_0x3d205d[_0x2628cd('0x52')](_0x584c3f[_0x2628cd('0x52')]);return db[_0x2628cd('0xa4')][_0x2628cd('0x78')](_0x3d205d[_0x2628cd('0x2f')](),_0x1d3b03);})[_0x1bb6a('0x47')](function(_0x235b6f){const _0x22b8cd=_0x1bb6a;return _0x1eed86[_0x22b8cd('0x25')]('ui.FaxInteractionId\x20IN\x20?',_[_0x22b8cd('0xa1')](_0x235b6f,'id')),db['sequelize'][_0x22b8cd('0x78')](_0x1eed86['toString'](),_0x1d3b03)['then'](function(_0x5b977a){const _0x27df9a=_0x22b8cd,_0x1635a0=_[_0x27df9a('0xba')](_0x5b977a,_0x27df9a('0x4d')),_0x35795d=[];return _0x235b6f[_0x27df9a('0x75')](function(_0x4d747a){const _0x2c55bf=_0x27df9a;_0x35795d[_0x2c55bf('0x79')](updateFaxInteraction(_0x4d747a,_0x165810,_0x1635a0));}),Promise['all'](_0x35795d);});});})['then'](function(_0x58e7fb){const _0x4f8717=_0x191858;return _0x1c6f7d[_0x4f8717('0x1a')]=_0x58e7fb,_0x1c6f7d;})['then'](respondWithFilteredResult(_0x5984cd,_0x584c3f));})['catch'](handleError(_0x5984cd,null));},exports[_0x1fcc06('0x3f')]=function(_0x550727,_0x117f0b){const _0x42d79f=_0x1fcc06;let _0x891d7e={'raw':![],'where':{'id':_0x550727[_0x42d79f('0x72')]['id']}};const _0xea461e={};return _0xea461e['model']=_[_0x42d79f('0xb8')](db[_0x42d79f('0xc2')][_0x42d79f('0x6')]),_0xea461e[_0x42d79f('0x78')]=_[_0x42d79f('0xb8')](_0x550727['query']),_0xea461e[_0x42d79f('0xb1')]=_[_0x42d79f('0x21')](_0xea461e[_0x42d79f('0x7')],_0xea461e[_0x42d79f('0x78')]),_0x891d7e['attributes']=_[_0x42d79f('0x21')](_0xea461e[_0x42d79f('0x7')],qs['fields'](_0x550727[_0x42d79f('0x78')][_0x42d79f('0x2')])),_0x891d7e[_0x42d79f('0xc9')]=_0x891d7e[_0x42d79f('0xc9')][_0x42d79f('0x9e')]?_0x891d7e[_0x42d79f('0xc9')]:_0xea461e['model'],_0x550727[_0x42d79f('0x78')]['includeAll']&&(_0x891d7e[_0x42d79f('0x3e')]=[{'all':!![]}]),_0x891d7e=_[_0x42d79f('0x92')]({},_0x891d7e,_0x550727['options']),db['FaxInteraction'][_0x42d79f('0x4a')](_0x891d7e)[_0x42d79f('0x47')](handleEntityNotFound(_0x117f0b,null))[_0x42d79f('0x47')](respondWithResult(_0x117f0b,null))['catch'](handleError(_0x117f0b,null));},exports[_0x1fcc06('0x76')]=function(_0x102aac,_0x11127b){const _0x4d3b2e=_0x1fcc06;return db[_0x4d3b2e('0xc2')]['create'](_0x102aac[_0x4d3b2e('0x8b')],{})[_0x4d3b2e('0x47')](respondWithResult(_0x11127b,0xc9))[_0x4d3b2e('0x20')](handleError(_0x11127b,null));},exports['update']=function(_0x56596d,_0x39b5ae){const _0x4a1f32=_0x1fcc06;return _0x56596d[_0x4a1f32('0x8b')]['id']&&delete _0x56596d[_0x4a1f32('0x8b')]['id'],db[_0x4a1f32('0xc2')][_0x4a1f32('0x4a')]({'where':{'id':_0x56596d[_0x4a1f32('0x72')]['id']}})[_0x4a1f32('0x47')](handleEntityNotFound(_0x39b5ae,null))[_0x4a1f32('0x47')](saveUpdates(_0x56596d[_0x4a1f32('0x8b')],null))[_0x4a1f32('0x47')](respondWithResult(_0x39b5ae,null))[_0x4a1f32('0x20')](handleError(_0x39b5ae,null));},exports['destroy']=function(_0x4e04fc,_0xc9a912){const _0xd0fa33=_0x1fcc06;return db['FaxInteraction'][_0xd0fa33('0x4a')]({'where':{'id':_0x4e04fc[_0xd0fa33('0x72')]['id']}})[_0xd0fa33('0x47')](handleEntityNotFound(_0xc9a912,null))[_0xd0fa33('0x47')](removeEntity(_0xc9a912,null))['catch'](handleError(_0xc9a912,null));},exports[_0x1fcc06('0x39')]=function(_0x5c247f,_0xaf588){const _0x40794b=_0x1fcc06;return db[_0x40794b('0xc2')]['describe']()[_0x40794b('0x47')](respondWithResult(_0xaf588,null))['catch'](handleError(_0xaf588,null));},exports[_0x1fcc06('0xb6')]=function(_0x4e36ea,_0x526c73){const _0x570cf4=_0x1fcc06;return db[_0x570cf4('0x5d')][_0x570cf4('0x4a')]({'where':{'id':_0x4e36ea[_0x570cf4('0x72')]['id']}})[_0x570cf4('0x47')](function(_0x48d0e2){const _0x4caf3c=_0x570cf4;if(_0x48d0e2)return _0x48d0e2[_0x4caf3c('0xb6')](_0x4e36ea[_0x4caf3c('0x8b')][_0x4caf3c('0x68')],{'through':_[_0x4caf3c('0xbf')](_0x4e36ea[_0x4caf3c('0x8b')],[_0x4caf3c('0x68'),'id'])});})[_0x570cf4('0x47')](respondWithResult(_0x526c73,null))[_0x570cf4('0x20')](handleError(_0x526c73,null));},exports[_0x1fcc06('0x11')]=function(_0x1d5300,_0x1c6cd2){const _0x4e00ef=_0x1fcc06;let _0x3aa133={'raw':![],'where':{}};const _0x355c34={},_0x5b821c={'count':0x0,'rows':[]};return db[_0x4e00ef('0xc2')]['findOne']({'where':{'id':_0x1d5300[_0x4e00ef('0x72')]['id']}})['then'](handleEntityNotFound(_0x1c6cd2,null))[_0x4e00ef('0x47')](function(_0x1e9cfa){const _0x523600=_0x4e00ef;if(_0x1e9cfa){_0x355c34[_0x523600('0x7')]=_['keys'](db[_0x523600('0x5d')][_0x523600('0x6')]),_0x355c34[_0x523600('0x78')]=_[_0x523600('0xb8')](_0x1d5300['query']),_0x355c34[_0x523600('0xb1')]=_[_0x523600('0x21')](_0x355c34['model'],_0x355c34['query']),_0x3aa133['attributes']=_[_0x523600('0x21')](_0x355c34[_0x523600('0x7')],qs[_0x523600('0x2')](_0x1d5300[_0x523600('0x78')][_0x523600('0x2')])),_0x3aa133['attributes']=_0x3aa133[_0x523600('0xc9')][_0x523600('0x9e')]?_0x3aa133[_0x523600('0xc9')]:_0x355c34[_0x523600('0x7')];typeof _0x1d5300[_0x523600('0x78')][_0x523600('0x62')]===_0x523600('0x3b')&&(_0x3aa133['limit']=qs[_0x523600('0x71')](_0x1d5300[_0x523600('0x78')][_0x523600('0x71')]),_0x3aa133[_0x523600('0x52')]=qs['offset'](_0x1d5300[_0x523600('0x78')][_0x523600('0x52')]));_0x3aa133[_0x523600('0x91')]=qs[_0x523600('0x29')](_0x1d5300[_0x523600('0x78')]['sort']),_0x3aa133['where']=qs['filters'](_[_0x523600('0x14')](_0x1d5300[_0x523600('0x78')],_0x355c34[_0x523600('0xb1')])),_0x3aa133[_0x523600('0x25')]['FaxInteractionId']=_0x1e9cfa['id'];_0x1d5300[_0x523600('0x78')][_0x523600('0x5e')]&&(_0x3aa133[_0x523600('0x25')]=_[_0x523600('0x92')](_0x3aa133[_0x523600('0x25')],{[Op['or']]:_['map'](_0x3aa133['attributes'],function(_0x54f4ac){const _0x19b5e3=_0x523600,_0x28f846={};return _0x28f846[_0x54f4ac]={[Op[_0x19b5e3('0x77')]]:'%'+_0x1d5300[_0x19b5e3('0x78')]['filter']+'%'},_0x28f846;})}));if(_0x1d5300[_0x523600('0x78')][_0x523600('0x86')]){const _0xca83ca=_0x1d5300[_0x523600('0x78')][_0x523600('0x86')][_0x523600('0x24')](','),_0x12c2b2={};_0x12c2b2[_0xca83ca[0x0]]={[Op[_0x523600('0x95')]]:moment(_0xca83ca[0x1])[_0x523600('0x49')](_0x523600('0x5b'))},_0x3aa133[_0x523600('0x25')]=_[_0x523600('0x92')](_0x3aa133[_0x523600('0x25')],_0x12c2b2);}return _0x3aa133=_['merge']({},_0x3aa133,_0x1d5300[_0x523600('0x6b')]),db[_0x523600('0x5d')][_0x523600('0xad')]({'where':_0x3aa133[_0x523600('0x25')]})[_0x523600('0x47')](function(_0x560f15){const _0x1f18cf=_0x523600;return _0x5b821c['count']=_0x560f15,_0x1d5300[_0x1f18cf('0x78')][_0x1f18cf('0x90')]&&(_0x3aa133[_0x1f18cf('0x3e')]=[{'all':!![]}]),db[_0x1f18cf('0x5d')][_0x1f18cf('0xa5')](_0x3aa133);})[_0x523600('0x47')](function(_0x332156){const _0x123a2d=_0x523600;return _0x5b821c[_0x123a2d('0x1a')]=_0x332156,_0x5b821c;});}})[_0x4e00ef('0x47')](respondWithFilteredResult(_0x1c6cd2,_0x3aa133))['catch'](handleError(_0x1c6cd2,null));},exports[_0x1fcc06('0x6f')]=function(_0x196977,_0x499dd6){const _0x1eb980=_0x1fcc06;return db[_0x1eb980('0xc2')][_0x1eb980('0x4a')]({'where':{'id':_0x196977[_0x1eb980('0x72')]['id']}})['then'](function(_0x54d0e1){const _0x387b0b=_0x1eb980;if(_0x54d0e1)return _0x54d0e1[_0x387b0b('0x31')](_0x196977['body'][_0x387b0b('0x68')],{'through':_['omit'](_0x196977[_0x387b0b('0x8b')],[_0x387b0b('0x68'),'id'])})[_0x387b0b('0x47')](function(){const _0x4cca34=_0x387b0b;return db[_0x4cca34('0xbb')][_0x4cca34('0xa5')]({'attributes':['id',_0x4cca34('0x8'),'color'],'where':{'id':_0x196977[_0x4cca34('0x8b')][_0x4cca34('0x68')]}});})[_0x387b0b('0x47')](function(_0x4f1d8c){const _0x332476=_0x387b0b;return socket[_0x332476('0x1f')](_0x332476('0x9d'),{'id':Number(_0x196977[_0x332476('0x72')]['id']),'tags':_0x4f1d8c||[]}),{'id':Number(_0x196977['params']['id']),'tags':_0x4f1d8c||[]};});})[_0x1eb980('0x47')](respondWithResult(_0x499dd6,null))[_0x1eb980('0x20')](handleError(_0x499dd6,null));},exports[_0x1fcc06('0x56')]=function(_0x351eaa,_0xa7e272){const _0x56a302=_0x1fcc06;return db[_0x56a302('0xc2')][_0x56a302('0x4a')]({'where':{'id':_0x351eaa['params']['id']}})[_0x56a302('0x47')](handleEntityNotFound(_0xa7e272,null))['then'](function(_0x5b6e84){const _0x1b6336=_0x56a302;if(_0x5b6e84)return _0x5b6e84[_0x1b6336('0x56')](_0x351eaa[_0x1b6336('0x78')][_0x1b6336('0x68')]);})[_0x56a302('0x47')](respondWithStatusCode(_0xa7e272,null))[_0x56a302('0x20')](handleError(_0xa7e272,null));},exports[_0x1fcc06('0x6c')]=function(_0x391166,_0x1694b9){const _0x7eb453=_0x1fcc06,_0x25967e=moment()[_0x7eb453('0x7e')]()[_0x7eb453('0x2f')](),_0x168902=path[_0x7eb453('0x54')](config['root'],_0x7eb453('0xb2'),_0x7eb453('0x84'),'tmp'),_0x4585f6=path['join'](config[_0x7eb453('0x83')],_0x7eb453('0xb2'),_0x7eb453('0x84'),'attachments'),_0x5504cf=path['join'](_0x168902,_0x25967e),_0x2fe453=util[_0x7eb453('0x49')](_0x7eb453('0x1'),_0x391166[_0x7eb453('0x72')]['id'],_0x25967e),_0x433a59=path[_0x7eb453('0x54')](_0x168902,_0x2fe453),_0x353f8c=[];_0x353f8c['push']({'model':db['Attachment'],'as':_0x7eb453('0x63'),'raw':!![]});const _0x16bc8e=[{'model':db['FaxMessage'],'as':_0x7eb453('0x5'),'attributes':['id','body','createdAt'],'include':_0x353f8c}];return db[_0x7eb453('0xc2')][_0x7eb453('0x4a')]({'where':{'id':_0x391166[_0x7eb453('0x72')]['id']},'include':_0x16bc8e})[_0x7eb453('0x47')](handleEntityNotFound(_0x1694b9,null))[_0x7eb453('0x47')](function(_0x3c0b12){const _0x474b11=_0x7eb453;if(_0x3c0b12&&_0x3c0b12[_0x474b11('0x5')]){const _0x3fb3aa=_0x3c0b12[_0x474b11('0xac')]({'plain':!![]});fs[_0x474b11('0x82')](_0x5504cf);for(let _0x19d4e4=0x0;_0x19d4e4<_0x3fb3aa[_0x474b11('0x5')][_0x474b11('0x9e')];_0x19d4e4++){const _0x28831e=_0x3fb3aa[_0x474b11('0x5')][_0x19d4e4][_0x474b11('0x63')];if(_0x28831e){const _0x55d41a=path[_0x474b11('0x54')](_0x4585f6,_0x28831e[_0x474b11('0x87')]);fs['existsSync'](_0x55d41a)&&fs[_0x474b11('0x35')](_0x55d41a)[_0x474b11('0x69')](fs['createWriteStream'](path[_0x474b11('0x54')](_0x5504cf,_0x28831e[_0x474b11('0x87')])));}}return Promise[_0x474b11('0xb7')]()['then'](function(){const _0x2c9852=_0x474b11;return new Promise(function(_0x500540,_0x1d1941){zipdir(_0x5504cf,{'saveTo':_0x433a59},function(_0x1557fc,_0x8a764a){if(_0x1557fc)return _0x1d1941(_0x1557fc);return _0x500540(_0x8a764a);});})[_0x2c9852('0x47')](function(){return new Promise(function(_0x5b5965,_0x477034){rimraf(_0x5504cf,function(_0xac45c6){if(_0xac45c6)_0x477034(_0xac45c6);return _0x5b5965();});});})['then'](function(){const _0x36b085=_0x2c9852;return _0x1694b9[_0x36b085('0x6c')](_0x433a59,_0x2fe453,function(_0x56b0ac){const _0x5b62f4=_0x36b085;_0x56b0ac?console[_0x5b62f4('0x1d')](_0x5b62f4('0xe'),_0x56b0ac):fs[_0x5b62f4('0xa8')](_0x433a59);});});});}else return _0x1694b9[_0x474b11('0xc6')](0xc8);})[_0x7eb453('0x20')](handleError(_0x1694b9,null));};
\ No newline at end of file