Built motion from commit a9fb64cc6defd8fb3a5cc199221f878e91c0e969. Version 3.0.0...
[motion-next.git] / server / api / cmList / cmList.controller.js
index 0001e3c..8301738 100644 (file)
@@ -1 +1 @@
-const a157_0x530c=['count','CmList','TEXT','attributes','omit','writeFileSync','UserProfileSection','Disposition','Unable\x20to\x20retrieve\x20the\x20current\x20user','download','addCustomField','offset','then','filter','Malformed\x20request\x20syntax','filters','addCustomFields','Sequelize','error','json','includeAll','type','user','VIRTUAL','setHeader','autoAssociation','userProfileId','keys','Lists','queryInterface','findAll','ListId','../../config/logger','text','sort','nolimit','ids','query','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','end','body','join','findOne','cf_%s','CmCustomField','./cmList.socket','options','stack','update','tags','isEmpty','limit','model','fields','addAgents','where','getContactsCsv','format','pick','show','undefined','Content-disposition','CustomFields','Content-Range','INTEGER','/tmp/list_%d_%s.csv','order','Content-type','status','catch','index','name','CmContact','sequelize','api','include','text/csv','raw','get','emit','merge','create','describe','map','../../rediscache','findAndCountAll','isArray','register','lodash','destroy','getAgents','errors','removeDispositions','UserProfileResource','fieldName','sendStatus','length','defaultValue','to-csv','getDispositions','concat','message','role','like','params','key','now','rows','attachment;\x20filename=','intersection','userCmList:remove','getContacts','push','rawAttributes'];(function(_0x6d208d,_0x530c06){const _0x2d9111=function(_0x43c494){while(--_0x43c494){_0x6d208d['push'](_0x6d208d['shift']());}};_0x2d9111(++_0x530c06);}(a157_0x530c,0xd0));const a157_0x2d91=function(_0x6d208d,_0x530c06){_0x6d208d=_0x6d208d-0x0;let _0x2d9111=a157_0x530c[_0x6d208d];return _0x2d9111;};const _0x4f9395=a157_0x2d91;'use strict';const util=require('util'),fs=require('fs'),_=require(_0x4f9395('0x6c')),toCsv=require(_0x4f9395('0x4')),{getSocket}=require(_0x4f9395('0x68')),socket=getSocket(),qs=require('../../components/parsers/qs'),logger=require(_0x4f9395('0x34'))(_0x4f9395('0x5e')),db=require('../../mysqldb')['db'],{Op}=require('sequelize');require(_0x4f9395('0x41'))[_0x4f9395('0x6b')](socket);function respondWithStatusCode(_0x43c494,_0x49ef6c){return _0x49ef6c=_0x49ef6c||0xcc,function(_0x4fe904){const _0x49f7cd=a157_0x2d91;if(_0x4fe904)return _0x43c494['sendStatus'](_0x49ef6c);return _0x43c494[_0x49f7cd('0x58')](_0x49ef6c)['end']();};}function respondWithResult(_0x1f4f76,_0x553e5b){return _0x553e5b=_0x553e5b||0xc8,function(_0x594aca){const _0x2f5657=a157_0x2d91;if(_0x594aca)return _0x1f4f76[_0x2f5657('0x58')](_0x553e5b)[_0x2f5657('0x27')](_0x594aca);};}function respondWithFilteredResult(_0x4ce346,_0x4f90f3){return function(_0x1decc7){const _0x249252=a157_0x2d91;if(_0x1decc7){const _0x34fb03=_0x1decc7[_0x249252('0x14')],_0x30d1b4=_0x4f90f3[_0x249252('0x1f')];let _0x27e74a=_0x4f90f3[_0x249252('0x1f')]+_0x4f90f3[_0x249252('0x47')],_0x639880;return _0x27e74a>=_0x34fb03?(_0x27e74a=_0x34fb03,_0x639880=0xc8):_0x639880=0xce,_0x4ce346[_0x249252('0x58')](_0x639880),_0x4ce346['set'](_0x249252('0x53'),_0x30d1b4+'-'+_0x27e74a+'/'+_0x34fb03)[_0x249252('0x27')](_0x1decc7);}return null;};}function saveUpdates(_0x19c3ad){return function(_0x30dc14){const _0x32302a=a157_0x2d91;if(_0x30dc14)return _0x30dc14[_0x32302a('0x44')](_0x19c3ad)['then'](function(_0x36e9b6){return _0x36e9b6;});return null;};}function removeEntity(_0x33a513){return function(_0x2d55c4){const _0x2597d2=a157_0x2d91;if(_0x2d55c4)return _0x2d55c4[_0x2597d2('0x6d')]()[_0x2597d2('0x20')](function(){const _0x1fc656=_0x2597d2,_0x12cc3b=_0x2d55c4['get']({'plain':!![]}),_0x5875a0=_0x1fc656('0x30');return db[_0x1fc656('0x71')]['destroy']({'where':{'type':_0x5875a0,'resourceId':_0x12cc3b['id']}})['then'](function(){return _0x2d55c4;});})[_0x2597d2('0x20')](function(){const _0x13231d=_0x2597d2;_0x33a513[_0x13231d('0x58')](0xcc)[_0x13231d('0x3b')]();});};}function handleEntityNotFound(_0x169eac){return function(_0x4de657){return!_0x4de657&&_0x169eac['sendStatus'](0x194),_0x4de657;};}function handleError(_0x263017,_0x308e84){return _0x308e84=_0x308e84||0x1f4,function(_0x3795d2){const _0x575741=a157_0x2d91;logger['error'](_0x3795d2[_0x575741('0x43')]),_0x3795d2[_0x575741('0x5b')]&&delete _0x3795d2[_0x575741('0x5b')],_0x263017[_0x575741('0x58')](_0x308e84)['send'](_0x3795d2);};}exports[_0x4f9395('0x5a')]=function(_0x3a5de6,_0x298574){const _0x15af59=_0x4f9395;let _0x3680bc={};const _0x1d6732={},_0x1d6fde={'count':0x0,'rows':[]},_0x536ed3=_[_0x15af59('0x67')](db[_0x15af59('0x15')][_0x15af59('0x13')],function(_0x440006){const _0x5bd119=_0x15af59;return{'name':_0x440006[_0x5bd119('0x0')],'type':_0x440006[_0x5bd119('0x29')][_0x5bd119('0xb')]};});_0x1d6732[_0x15af59('0x48')]=_[_0x15af59('0x67')](_0x536ed3,'name'),_0x1d6732[_0x15af59('0x39')]=_['keys'](_0x3a5de6[_0x15af59('0x39')]),_0x1d6732[_0x15af59('0x23')]=_[_0x15af59('0xf')](_0x1d6732[_0x15af59('0x48')],_0x1d6732['query']),_0x3680bc[_0x15af59('0x17')]=_[_0x15af59('0xf')](_0x1d6732['model'],qs[_0x15af59('0x49')](_0x3a5de6[_0x15af59('0x39')][_0x15af59('0x49')])),_0x3680bc['attributes']=_0x3680bc[_0x15af59('0x17')]['length']?_0x3680bc[_0x15af59('0x17')]:_0x1d6732[_0x15af59('0x48')];typeof _0x3a5de6['query'][_0x15af59('0x37')]===_0x15af59('0x50')&&(_0x3680bc[_0x15af59('0x47')]=qs['limit'](_0x3a5de6['query'][_0x15af59('0x47')]),_0x3680bc[_0x15af59('0x1f')]=qs[_0x15af59('0x1f')](_0x3a5de6[_0x15af59('0x39')][_0x15af59('0x1f')]));_0x3680bc[_0x15af59('0x56')]=qs[_0x15af59('0x36')](_0x3a5de6[_0x15af59('0x39')][_0x15af59('0x36')]),_0x3680bc[_0x15af59('0x4b')]=qs[_0x15af59('0x23')](_[_0x15af59('0x4e')](_0x3a5de6[_0x15af59('0x39')],_0x1d6732[_0x15af59('0x23')]),_0x536ed3);_0x3a5de6[_0x15af59('0x39')][_0x15af59('0x21')]&&(_0x3680bc[_0x15af59('0x4b')]=_[_0x15af59('0x64')](_0x3680bc['where'],{[Op['or']]:_[_0x15af59('0x67')](_0x536ed3,function(_0x14cd82){const _0x48dd8e=_0x15af59;if(_0x14cd82[_0x48dd8e('0x29')]!==_0x48dd8e('0x2b')){const _0x57815f={};return _0x57815f[_0x14cd82['name']]={[Op['like']]:'%'+_0x3a5de6[_0x48dd8e('0x39')][_0x48dd8e('0x21')]+'%'},_0x57815f;}})}));_0x3680bc=_[_0x15af59('0x64')]({},_0x3680bc,_0x3a5de6[_0x15af59('0x42')]);const _0x183be1={'where':_0x3680bc[_0x15af59('0x4b')]};return db['CmList']['count'](_0x183be1)[_0x15af59('0x20')](function(_0x3a07de){const _0x4e9e0c=_0x15af59;return _0x1d6fde[_0x4e9e0c('0x14')]=_0x3a07de,_0x3a5de6['query'][_0x4e9e0c('0x28')]&&(_0x3680bc['include']=[{'all':!![]}]),db[_0x4e9e0c('0x15')][_0x4e9e0c('0x32')](_0x3680bc);})[_0x15af59('0x20')](function(_0xf1ffbf){return _0x1d6fde['rows']=_0xf1ffbf,_0x1d6fde;})[_0x15af59('0x20')](respondWithFilteredResult(_0x298574,_0x3680bc))[_0x15af59('0x59')](handleError(_0x298574,null));},exports[_0x4f9395('0x4f')]=function(_0x6e0538,_0x345e1f){const _0x261d2f=_0x4f9395;let _0xe75b06={'raw':![],'where':{'id':_0x6e0538[_0x261d2f('0xa')]['id']}};const _0x5233f1={};return _0x5233f1[_0x261d2f('0x48')]=_[_0x261d2f('0x2f')](db[_0x261d2f('0x15')][_0x261d2f('0x13')]),_0x5233f1[_0x261d2f('0x39')]=_[_0x261d2f('0x2f')](_0x6e0538[_0x261d2f('0x39')]),_0x5233f1[_0x261d2f('0x23')]=_[_0x261d2f('0xf')](_0x5233f1[_0x261d2f('0x48')],_0x5233f1[_0x261d2f('0x39')]),_0xe75b06[_0x261d2f('0x17')]=_[_0x261d2f('0xf')](_0x5233f1[_0x261d2f('0x48')],qs[_0x261d2f('0x49')](_0x6e0538['query']['fields'])),_0xe75b06[_0x261d2f('0x17')]=_0xe75b06[_0x261d2f('0x17')][_0x261d2f('0x2')]?_0xe75b06[_0x261d2f('0x17')]:_0x5233f1[_0x261d2f('0x48')],_0x6e0538['query'][_0x261d2f('0x28')]&&(_0xe75b06[_0x261d2f('0x5f')]=[{'all':!![]}]),_0xe75b06=_[_0x261d2f('0x64')]({},_0xe75b06,_0x6e0538[_0x261d2f('0x42')]),db[_0x261d2f('0x15')]['findOne'](_0xe75b06)[_0x261d2f('0x20')](handleEntityNotFound(_0x345e1f,null))['then'](respondWithResult(_0x345e1f,null))[_0x261d2f('0x59')](handleError(_0x345e1f,null));},exports['create']=function(_0x122ad4,_0x39293d){const _0x5084e4=_0x4f9395;return db[_0x5084e4('0x15')][_0x5084e4('0x65')](_0x122ad4[_0x5084e4('0x3c')],{})[_0x5084e4('0x20')](function(_0x22573b){const _0x1d757c=_0x5084e4,_0x24276e=_0x122ad4[_0x1d757c('0x2a')][_0x1d757c('0x62')]({'plain':!![]});if(!_0x24276e)throw new Error(_0x1d757c('0x1c'));if(_0x24276e[_0x1d757c('0x8')]===_0x1d757c('0x2a')){const _0x123f51=_0x22573b[_0x1d757c('0x62')]({'plain':!![]}),_0x4ab01c=_0x1d757c('0x30');return db[_0x1d757c('0x1a')][_0x1d757c('0x3e')]({'where':{'name':_0x4ab01c,'userProfileId':_0x24276e[_0x1d757c('0x2e')]},'raw':!![]})[_0x1d757c('0x20')](function(_0x56814c){const _0x11090f=_0x1d757c;return _0x56814c&&_0x56814c[_0x11090f('0x2d')]===0x0?db[_0x11090f('0x71')][_0x11090f('0x65')]({'name':_0x123f51[_0x11090f('0x5b')],'resourceId':_0x123f51['id'],'type':_0x56814c[_0x11090f('0x5b')],'sectionId':_0x56814c['id']},{})[_0x11090f('0x20')](function(){return _0x22573b;}):_0x22573b;})[_0x1d757c('0x59')](function(_0x1f1dbc){const _0x2793d8=_0x1d757c;logger[_0x2793d8('0x26')](_0x2793d8('0x3a'),_0x1f1dbc);throw _0x1f1dbc;});}return _0x22573b;})[_0x5084e4('0x20')](respondWithResult(_0x39293d,0xc9))['catch'](handleError(_0x39293d,null));},exports[_0x4f9395('0x44')]=function(_0x2e5f0b,_0x5b17e3){const _0x11b9d9=_0x4f9395;return _0x2e5f0b['body']['id']&&delete _0x2e5f0b[_0x11b9d9('0x3c')]['id'],db[_0x11b9d9('0x15')]['findOne']({'where':{'id':_0x2e5f0b[_0x11b9d9('0xa')]['id']}})['then'](handleEntityNotFound(_0x5b17e3,null))['then'](saveUpdates(_0x2e5f0b['body'],null))[_0x11b9d9('0x20')](respondWithResult(_0x5b17e3,null))[_0x11b9d9('0x59')](handleError(_0x5b17e3,null));},exports[_0x4f9395('0x6d')]=function(_0x4e89a5,_0x33f4d6){const _0x1ee24c=_0x4f9395;return db['CmList']['findOne']({'where':{'id':_0x4e89a5[_0x1ee24c('0xa')]['id']}})[_0x1ee24c('0x20')](handleEntityNotFound(_0x33f4d6,null))[_0x1ee24c('0x20')](removeEntity(_0x33f4d6,null))[_0x1ee24c('0x59')](handleError(_0x33f4d6,null));},exports[_0x4f9395('0x66')]=function(_0x227462,_0x42608c){const _0x3681a5=_0x4f9395;return db['CmList']['describe']()[_0x3681a5('0x20')](respondWithResult(_0x42608c,null))[_0x3681a5('0x59')](handleError(_0x42608c,null));},exports['addDisposition']=function(_0x395ebb,_0x20a053){const _0x5b17ab=_0x4f9395;return _0x395ebb[_0x5b17ab('0x3c')]['id']&&delete _0x395ebb[_0x5b17ab('0x3c')]['id'],db['CmList'][_0x5b17ab('0x3e')]({'where':{'id':_0x395ebb[_0x5b17ab('0xa')]['id']}})['then'](handleEntityNotFound(_0x20a053,null))[_0x5b17ab('0x20')](function(_0x2a23f2){const _0x3a316c=_0x5b17ab;if(_0x2a23f2)return _0x395ebb['body'][_0x3a316c('0x33')]=_0x2a23f2['id'],db[_0x3a316c('0x1b')][_0x3a316c('0x65')](_0x395ebb[_0x3a316c('0x3c')]);})[_0x5b17ab('0x20')](respondWithResult(_0x20a053,null))[_0x5b17ab('0x59')](handleError(_0x20a053,null));},exports[_0x4f9395('0x5')]=function(_0x41c93c,_0x552988){const _0x2972e3=_0x4f9395;let _0x9a7030={'raw':![],'where':{}};const _0x5bf8d4={},_0x15d914={'count':0x0,'rows':[]};return db[_0x2972e3('0x15')][_0x2972e3('0x3e')]({'where':{'id':_0x41c93c[_0x2972e3('0xa')]['id']}})[_0x2972e3('0x20')](handleEntityNotFound(_0x552988,null))[_0x2972e3('0x20')](function(_0x456cd8){const _0x298e73=_0x2972e3;if(_0x456cd8)return _0x5bf8d4[_0x298e73('0x48')]=_[_0x298e73('0x2f')](db['Disposition'][_0x298e73('0x13')]),_0x5bf8d4[_0x298e73('0x39')]=_[_0x298e73('0x2f')](_0x41c93c['query']),_0x5bf8d4[_0x298e73('0x23')]=_[_0x298e73('0xf')](_0x5bf8d4[_0x298e73('0x48')],_0x5bf8d4[_0x298e73('0x39')]),_0x9a7030[_0x298e73('0x17')]=_[_0x298e73('0xf')](_0x5bf8d4[_0x298e73('0x48')],qs['fields'](_0x41c93c[_0x298e73('0x39')][_0x298e73('0x49')])),_0x9a7030[_0x298e73('0x17')]=_0x9a7030['attributes']['length']?_0x9a7030[_0x298e73('0x17')]:_0x5bf8d4[_0x298e73('0x48')],typeof _0x41c93c['query'][_0x298e73('0x37')]==='undefined'&&(_0x9a7030['limit']=qs[_0x298e73('0x47')](_0x41c93c['query'][_0x298e73('0x47')]),_0x9a7030[_0x298e73('0x1f')]=qs[_0x298e73('0x1f')](_0x41c93c[_0x298e73('0x39')]['offset'])),_0x9a7030[_0x298e73('0x56')]=qs[_0x298e73('0x36')](_0x41c93c[_0x298e73('0x39')][_0x298e73('0x36')]),_0x9a7030['where']=qs[_0x298e73('0x23')](_['pick'](_0x41c93c[_0x298e73('0x39')],_0x5bf8d4[_0x298e73('0x23')])),_0x9a7030[_0x298e73('0x4b')][_0x298e73('0x33')]=_0x456cd8['id'],_0x41c93c[_0x298e73('0x39')][_0x298e73('0x21')]&&(_0x9a7030[_0x298e73('0x4b')]=_['merge'](_0x9a7030[_0x298e73('0x4b')],{[Op['or']]:_[_0x298e73('0x67')](_0x9a7030[_0x298e73('0x17')],function(_0x3b819f){const _0x3a1209=_0x298e73,_0x58e33e={};return _0x58e33e[_0x3b819f]={[Op[_0x3a1209('0x9')]]:'%'+_0x41c93c[_0x3a1209('0x39')][_0x3a1209('0x21')]+'%'},_0x58e33e;})})),_0x9a7030=_['merge']({},_0x9a7030,_0x41c93c[_0x298e73('0x42')]),db['Disposition'][_0x298e73('0x14')]({'where':_0x9a7030[_0x298e73('0x4b')]})[_0x298e73('0x20')](function(_0x44dc85){const _0x5d23a1=_0x298e73;return _0x15d914[_0x5d23a1('0x14')]=_0x44dc85,_0x41c93c[_0x5d23a1('0x39')][_0x5d23a1('0x28')]&&(_0x9a7030['include']=[{'all':!![]}]),db[_0x5d23a1('0x1b')]['findAll'](_0x9a7030);})[_0x298e73('0x20')](function(_0x457f04){const _0x48b3ab=_0x298e73;return _0x15d914[_0x48b3ab('0xd')]=_0x457f04,_0x15d914;});})[_0x2972e3('0x20')](respondWithFilteredResult(_0x552988,_0x9a7030))[_0x2972e3('0x59')](handleError(_0x552988,null));},exports[_0x4f9395('0x70')]=function(_0x1e4a81,_0x5469b){const _0x4da695=_0x4f9395;return db[_0x4da695('0x15')][_0x4da695('0x3e')]({'where':{'id':_0x1e4a81[_0x4da695('0xa')]['id']}})[_0x4da695('0x20')](handleEntityNotFound(_0x5469b,null))[_0x4da695('0x20')](function(_0x25a459){const _0x5ce7fa=_0x4da695;if(_0x25a459)return _0x25a459[_0x5ce7fa('0x70')](_0x1e4a81[_0x5ce7fa('0x39')][_0x5ce7fa('0x38')]);})[_0x4da695('0x20')](respondWithStatusCode(_0x5469b,null))['catch'](handleError(_0x5469b,null));},exports['addContacts']=function(_0x97404d,_0x47d656){const _0x5f47b1=_0x4f9395;return db[_0x5f47b1('0x15')][_0x5f47b1('0x3e')]({'where':{'id':_0x97404d[_0x5f47b1('0xa')]['id']}})[_0x5f47b1('0x20')](handleEntityNotFound(_0x47d656,null))[_0x5f47b1('0x20')](function(_0x2956f2){const _0x2ce9bc=_0x5f47b1;if(_0x2956f2){const _0x1075a3=[],_0x29250c={'success':[],'errors':[]};return db[_0x2ce9bc('0x5c')][_0x2ce9bc('0x66')]()[_0x2ce9bc('0x20')](function(_0x2dbfae){const _0x72a6c8=_0x2ce9bc;_0x97404d[_0x72a6c8('0x3c')][_0x72a6c8('0x45')]&&_[_0x72a6c8('0x6a')](_0x97404d[_0x72a6c8('0x3c')][_0x72a6c8('0x45')])?_0x97404d[_0x72a6c8('0x3c')]['tags'][_0x72a6c8('0x2')]?_0x97404d[_0x72a6c8('0x3c')][_0x72a6c8('0x45')]=_0x97404d['body']['tags'][_0x72a6c8('0x3d')](';')+';':_0x97404d[_0x72a6c8('0x3c')][_0x72a6c8('0x45')]=null:_0x97404d['body'][_0x72a6c8('0x45')]=null;if(_0x97404d['body']&&_[_0x72a6c8('0x6a')](_0x97404d['body'])){for(let _0x4d05ca=0x0;_0x4d05ca<_0x97404d[_0x72a6c8('0x3c')][_0x72a6c8('0x2')];_0x4d05ca+=0x1){_0x97404d[_0x72a6c8('0x3c')][_0x4d05ca][_0x72a6c8('0x33')]=_0x97404d[_0x72a6c8('0xa')]['id'],_0x1075a3[_0x72a6c8('0x12')](_0x97404d[_0x72a6c8('0x3c')][_0x4d05ca]);}return Promise['each'](_0x1075a3,function(_0x444d6a){const _0x1df388=_0x72a6c8;return db['CmContact']['create'](_[_0x1df388('0x18')](_0x444d6a,[_0x1df388('0x38'),'id'])||{},{'fields':_[_0x1df388('0x2f')](_0x2dbfae),'raw':!![]})[_0x1df388('0x20')](function(_0x337132){const _0x1b1857=_0x1df388;_0x29250c['success'][_0x1b1857('0x12')](_0x337132['dataValues']);})[_0x1df388('0x59')](function(_0x4cc60d){const _0x361d59=_0x1df388;_0x29250c[_0x361d59('0x6f')]['push']({'data':_0x444d6a,'error':_0x4cc60d[_0x361d59('0x7')]});});})[_0x72a6c8('0x20')](function(){return _0x29250c;})['catch'](function(_0x1104f5){return _0x1104f5;});}else _0x47d656['status'](0x190)['json']({'message':_0x72a6c8('0x22')});});}})[_0x5f47b1('0x20')](respondWithResult(_0x47d656,null))['catch'](handleError(_0x47d656,null));},exports[_0x4f9395('0x11')]=function(_0x1fa952,_0x1929db){const _0x980689=_0x4f9395;let _0x5698f1;return db['CmList']['findOne']({'where':{'id':_0x1fa952[_0x980689('0xa')]['id']},'include':[{'model':db[_0x980689('0x40')],'as':_0x980689('0x52')}]})['then'](handleEntityNotFound(_0x1929db,null))['then'](function(_0x4774ff){const _0x1a8026=_0x980689;if(_0x4774ff)return _0x5698f1=_0x4774ff,db[_0x1a8026('0x5c')][_0x1a8026('0x13')];})[_0x980689('0x20')](function(_0x7e4261){const _0x43b3e6=_0x980689;if(_0x7e4261){let _0x1ea4b6={};const _0x2a8f04={};return _0x2a8f04['model']=_[_0x43b3e6('0x6')](_[_0x43b3e6('0x2f')](_0x7e4261),_[_0x43b3e6('0x67')](_0x5698f1[_0x43b3e6('0x52')],function(_0x4f7318){return util['format']('cf_%d',_0x4f7318['id']);})),_0x2a8f04[_0x43b3e6('0x39')]=_['keys'](_0x1fa952[_0x43b3e6('0x39')]),_0x2a8f04[_0x43b3e6('0x23')]=_[_0x43b3e6('0xf')](_0x2a8f04[_0x43b3e6('0x48')],_0x2a8f04[_0x43b3e6('0x39')]),_0x1ea4b6[_0x43b3e6('0x17')]=_[_0x43b3e6('0xf')](_0x2a8f04[_0x43b3e6('0x48')],qs[_0x43b3e6('0x49')](_0x1fa952[_0x43b3e6('0x39')][_0x43b3e6('0x49')])),_0x1ea4b6['attributes']=_0x1ea4b6[_0x43b3e6('0x17')][_0x43b3e6('0x2')]?_0x1ea4b6[_0x43b3e6('0x17')]:_0x2a8f04[_0x43b3e6('0x48')],typeof _0x1fa952['query'][_0x43b3e6('0x37')]===_0x43b3e6('0x50')&&(_0x1ea4b6[_0x43b3e6('0x47')]=qs[_0x43b3e6('0x47')](_0x1fa952[_0x43b3e6('0x39')][_0x43b3e6('0x47')]),_0x1ea4b6[_0x43b3e6('0x1f')]=qs['offset'](_0x1fa952[_0x43b3e6('0x39')]['offset'])),_0x1ea4b6['order']=qs[_0x43b3e6('0x36')](_0x1fa952[_0x43b3e6('0x39')]['sort']),_0x1ea4b6[_0x43b3e6('0x4b')]=qs['filters'](_[_0x43b3e6('0x4e')](_0x1fa952[_0x43b3e6('0x39')],_0x2a8f04['filters'])),_0x1ea4b6[_0x43b3e6('0x61')]=!![],_0x1fa952[_0x43b3e6('0x39')][_0x43b3e6('0x21')]&&(_0x1ea4b6[_0x43b3e6('0x4b')]=_[_0x43b3e6('0x64')](_0x1ea4b6['where'],{[Op['or']]:_['map'](_0x1ea4b6[_0x43b3e6('0x17')],function(_0x19aa16){const _0x18f278=_0x43b3e6,_0x2be5e9={};return _0x2be5e9[_0x19aa16]={[Op[_0x18f278('0x9')]]:'%'+_0x1fa952[_0x18f278('0x39')][_0x18f278('0x21')]+'%'},_0x2be5e9;})})),_0x1ea4b6=_[_0x43b3e6('0x64')]({},_0x1ea4b6,_0x1fa952['options']),_0x5698f1['getContacts'](_0x1ea4b6);}})[_0x980689('0x20')](respondWithResult(_0x1929db,null))[_0x980689('0x59')](handleError(_0x1929db,null));},exports[_0x4f9395('0x4c')]=function(_0x505560,_0x3ca9e5){const _0x43ac5c=_0x4f9395;let _0x3bc082;return db[_0x43ac5c('0x15')][_0x43ac5c('0x3e')]({'where':{'id':_0x505560[_0x43ac5c('0xa')]['id']},'include':[{'model':db[_0x43ac5c('0x40')],'as':_0x43ac5c('0x52')}]})[_0x43ac5c('0x20')](handleEntityNotFound(_0x3ca9e5,null))[_0x43ac5c('0x20')](function(_0x30561a){const _0x10a98e=_0x43ac5c;if(_0x30561a)return _0x3bc082=_0x30561a,db['CmContact'][_0x10a98e('0x13')];})[_0x43ac5c('0x20')](function(_0x26423c){const _0x4f57c0=_0x43ac5c;if(_0x26423c){let _0x2becfc={};const _0x276c0f={};return _0x276c0f[_0x4f57c0('0x48')]=_[_0x4f57c0('0x6')](_[_0x4f57c0('0x2f')](_0x26423c),_[_0x4f57c0('0x67')](_0x3bc082[_0x4f57c0('0x52')],function(_0x143855){const _0x1a8f9a=_0x4f57c0;return util[_0x1a8f9a('0x4d')]('cf_%d',_0x143855['id']);})),_0x276c0f[_0x4f57c0('0x39')]=_[_0x4f57c0('0x2f')](_0x505560[_0x4f57c0('0x39')]),_0x276c0f[_0x4f57c0('0x23')]=_['intersection'](_0x276c0f[_0x4f57c0('0x48')],_0x276c0f[_0x4f57c0('0x39')]),_0x2becfc[_0x4f57c0('0x17')]=_[_0x4f57c0('0xf')](_0x276c0f[_0x4f57c0('0x48')],qs[_0x4f57c0('0x49')](_0x505560[_0x4f57c0('0x39')]['fields'])),_0x2becfc[_0x4f57c0('0x17')]=_0x2becfc['attributes']['length']?_0x2becfc['attributes']:_0x276c0f[_0x4f57c0('0x48')],typeof _0x505560['query'][_0x4f57c0('0x37')]==='undefined'&&(_0x2becfc[_0x4f57c0('0x47')]=qs[_0x4f57c0('0x47')](_0x505560[_0x4f57c0('0x39')]['limit']),_0x2becfc[_0x4f57c0('0x1f')]=qs[_0x4f57c0('0x1f')](_0x505560[_0x4f57c0('0x39')]['offset'])),_0x2becfc[_0x4f57c0('0x56')]=qs[_0x4f57c0('0x36')](_0x505560[_0x4f57c0('0x39')]['sort']),_0x2becfc[_0x4f57c0('0x4b')]=qs[_0x4f57c0('0x23')](_[_0x4f57c0('0x4e')](_0x505560[_0x4f57c0('0x39')],_0x276c0f['filters'])),_0x2becfc[_0x4f57c0('0x61')]=!![],_0x505560['query'][_0x4f57c0('0x21')]&&(_0x2becfc[_0x4f57c0('0x4b')]=_[_0x4f57c0('0x64')](_0x2becfc['where'],{[Op['or']]:_[_0x4f57c0('0x67')](_0x2becfc[_0x4f57c0('0x17')],function(_0x582826){const _0xe826e9=_0x4f57c0,_0x33e614={};return _0x33e614[_0x582826]={[Op['like']]:'%'+_0x505560[_0xe826e9('0x39')][_0xe826e9('0x21')]+'%'},_0x33e614;})})),_0x2becfc=_[_0x4f57c0('0x64')]({},_0x2becfc,_0x505560[_0x4f57c0('0x42')]),_0x3bc082[_0x4f57c0('0x11')](_0x2becfc);}})['then'](function(_0x128801){const _0x19a2ec=_0x43ac5c;if(!_[_0x19a2ec('0x46')](_0x128801)){const _0x5a571c=toCsv(_0x128801),_0x3fb36e=Date[_0x19a2ec('0xc')]();return fs[_0x19a2ec('0x19')](util[_0x19a2ec('0x4d')](_0x19a2ec('0x55'),_0x3bc082['id'],_0x3fb36e),_0x5a571c),_0x3ca9e5['setHeader'](_0x19a2ec('0x51'),_0x19a2ec('0xe')+util[_0x19a2ec('0x4d')]('list_%d_%s.csv',_0x3bc082['id'],_0x3fb36e)),_0x3ca9e5[_0x19a2ec('0x2c')](_0x19a2ec('0x57'),_0x19a2ec('0x60')),_0x3ca9e5[_0x19a2ec('0x1d')](util[_0x19a2ec('0x4d')](_0x19a2ec('0x55'),_0x3bc082['id'],_0x3fb36e));}else return _0x3ca9e5[_0x19a2ec('0x1')](0xcc);})[_0x43ac5c('0x59')](handleError(_0x3ca9e5,null));},exports[_0x4f9395('0x1e')]=function(_0x142911,_0xcbeb2b){const _0x4674af=_0x4f9395;let _0x2d1ccc;return delete _0x142911[_0x4674af('0x3c')]['id'],db[_0x4674af('0x15')]['findOne']({'where':{'id':_0x142911['params']['id']}})['then'](handleEntityNotFound(_0xcbeb2b,null))['then'](function(_0x1b4776){const _0x1fc7cb=_0x4674af;if(_0x1b4776)return db[_0x1fc7cb('0x5d')]['transaction'](function(_0x4e5df5){const _0x4feaa4=_0x1fc7cb;return db[_0x4feaa4('0x40')][_0x4feaa4('0x65')](_0x142911['body'],{'transaction':_0x4e5df5})[_0x4feaa4('0x20')](function(_0x6a0cbd){const _0x1af598=_0x4feaa4;return _0x2d1ccc=_0x6a0cbd,_0x1b4776[_0x1af598('0x24')](_0x6a0cbd,{'transaction':_0x4e5df5});})[_0x4feaa4('0x20')](function(){const _0x47fbc1=_0x4feaa4,_0x14ebb5={'type':db['Sequelize'][_0x47fbc1('0x16')],'transaction':_0x4e5df5};switch(_0x142911[_0x47fbc1('0x3c')][_0x47fbc1('0x29')]){case _0x47fbc1('0x35'):_0x14ebb5[_0x47fbc1('0x29')]=db['Sequelize'][_0x47fbc1('0x16')];break;case'number':_0x14ebb5[_0x47fbc1('0x29')]=db[_0x47fbc1('0x25')][_0x47fbc1('0x54')];break;case'switch':_0x14ebb5[_0x47fbc1('0x29')]=db[_0x47fbc1('0x25')]['BOOLEAN'],_0x14ebb5[_0x47fbc1('0x3')]=![];break;default:}return db[_0x47fbc1('0x5d')][_0x47fbc1('0x31')]['addColumn']('cm_contacts',util['format'](_0x47fbc1('0x3f'),_0x2d1ccc['id']),_0x14ebb5);})['then'](function(){return _0x2d1ccc;});});})[_0x4674af('0x20')](respondWithResult(_0xcbeb2b,null))[_0x4674af('0x59')](handleError(_0xcbeb2b,null));},exports['getCustomFields']=function(_0x4bf92b,_0x38820c){const _0x23b727=_0x4f9395;let _0x2f8fa2={};const _0x5d0a88={};return db[_0x23b727('0x15')]['findOne']({'where':{'id':_0x4bf92b[_0x23b727('0xa')]['id']}})['then'](handleEntityNotFound(_0x38820c,null))['then'](function(_0x5cb55){const _0x5a75b0=_0x23b727;if(_0x5cb55)return _0x5d0a88[_0x5a75b0('0x48')]=_['keys'](db['CmCustomField'][_0x5a75b0('0x13')]),_0x5d0a88[_0x5a75b0('0x39')]=_[_0x5a75b0('0x2f')](_0x4bf92b[_0x5a75b0('0x39')]),_0x5d0a88[_0x5a75b0('0x23')]=_['intersection'](_0x5d0a88['model'],_0x5d0a88[_0x5a75b0('0x39')]),_0x2f8fa2[_0x5a75b0('0x17')]=_[_0x5a75b0('0xf')](_0x5d0a88[_0x5a75b0('0x48')],qs[_0x5a75b0('0x49')](_0x4bf92b[_0x5a75b0('0x39')]['fields'])),_0x2f8fa2[_0x5a75b0('0x17')]=_0x2f8fa2[_0x5a75b0('0x17')][_0x5a75b0('0x2')]?_0x2f8fa2[_0x5a75b0('0x17')]:_0x5d0a88[_0x5a75b0('0x48')],_0x2f8fa2[_0x5a75b0('0x56')]=qs[_0x5a75b0('0x36')](_0x4bf92b[_0x5a75b0('0x39')][_0x5a75b0('0x36')]),_0x2f8fa2[_0x5a75b0('0x4b')]=qs['filters'](_['pick'](_0x4bf92b['query'],_0x5d0a88[_0x5a75b0('0x23')])),_0x2f8fa2['where']=_['merge'](_0x2f8fa2[_0x5a75b0('0x4b')],{[Op['or']]:[{'ListId':_0x5cb55['id']},{'ListId':null}]}),_0x4bf92b[_0x5a75b0('0x39')]['filter']&&(_0x2f8fa2[_0x5a75b0('0x4b')]=_[_0x5a75b0('0x64')](_0x2f8fa2[_0x5a75b0('0x4b')],{[Op['or']]:_[_0x5a75b0('0x67')](_0x2f8fa2['attributes'],function(_0x22b57a){const _0x5df476=_0x5a75b0,_0x13a22f={};return _0x13a22f[_0x22b57a]={[Op[_0x5df476('0x9')]]:'%'+_0x4bf92b['query'][_0x5df476('0x21')]+'%'},_0x13a22f;})})),_0x2f8fa2=_[_0x5a75b0('0x64')]({},_0x2f8fa2,_0x4bf92b[_0x5a75b0('0x42')]),db[_0x5a75b0('0x40')][_0x5a75b0('0x69')](_0x2f8fa2);})['then'](respondWithResult(_0x38820c,null))[_0x23b727('0x59')](handleError(_0x38820c,null));},exports[_0x4f9395('0x4a')]=function(_0x7879dc,_0x1e84f9){const _0x121a48=_0x4f9395;return db[_0x121a48('0x15')][_0x121a48('0x3e')]({'where':{'id':_0x7879dc[_0x121a48('0xa')]['id']}})[_0x121a48('0x20')](function(_0x47c85c){const _0x20f315=_0x121a48;if(_0x47c85c)return _0x47c85c[_0x20f315('0x4a')](_0x7879dc[_0x20f315('0x3c')][_0x20f315('0x38')],{'through':_[_0x20f315('0x18')](_0x7879dc[_0x20f315('0x3c')],[_0x20f315('0x38'),'id'])})[_0x20f315('0x20')](function(_0x3cc731){const _0x3e7ce7=_0x20f315;for(let _0x587b39=0x0;_0x587b39<_0x7879dc[_0x3e7ce7('0x3c')]['ids'][_0x3e7ce7('0x2')];_0x587b39+=0x1){socket['emit']('userCmList:save',{'UserId':_0x7879dc[_0x3e7ce7('0x3c')]['ids'][_0x587b39],'CmListId':_0x7879dc[_0x3e7ce7('0xa')]['id']});}return _0x3cc731;});})['then'](respondWithResult(_0x1e84f9,null))[_0x121a48('0x59')](handleError(_0x1e84f9,null));},exports['removeAgents']=function(_0x5e9830,_0x39f063){const _0x31bf75=_0x4f9395;return db[_0x31bf75('0x15')][_0x31bf75('0x3e')]({'where':{'id':_0x5e9830[_0x31bf75('0xa')]['id']}})[_0x31bf75('0x20')](handleEntityNotFound(_0x39f063,null))[_0x31bf75('0x20')](function(_0x1fa6a4){const _0x1816e7=_0x31bf75;if(_0x1fa6a4)return _0x1fa6a4['removeAgents'](_0x5e9830[_0x1816e7('0x39')][_0x1816e7('0x38')])['then'](function(){const _0x39d893=_0x1816e7;if(_[_0x39d893('0x6a')](_0x5e9830['query']['ids']))for(let _0x324271=0x0;_0x324271<_0x5e9830[_0x39d893('0x39')][_0x39d893('0x38')]['length'];_0x324271+=0x1){socket[_0x39d893('0x63')](_0x39d893('0x10'),{'UserId':Number(_0x5e9830[_0x39d893('0x39')][_0x39d893('0x38')][_0x324271]),'CmListId':Number(_0x5e9830[_0x39d893('0xa')]['id'])});}else socket[_0x39d893('0x63')]('userCmList:remove',{'UserId':Number(_0x5e9830[_0x39d893('0x39')]['ids']),'CmListId':Number(_0x5e9830['params']['id'])});});})[_0x31bf75('0x20')](respondWithStatusCode(_0x39f063,null))[_0x31bf75('0x59')](handleError(_0x39f063,null));},exports['getAgents']=function(_0x35f55a,_0x96f6ab){const _0x2c509a=_0x4f9395;let _0x4a530c={};const _0xa5624f={};let _0x6bc577,_0x1b862e;return db[_0x2c509a('0x15')][_0x2c509a('0x3e')]({'where':{'id':_0x35f55a[_0x2c509a('0xa')]['id']}})['then'](handleEntityNotFound(_0x96f6ab,null))[_0x2c509a('0x20')](function(_0x532b9c){const _0x1f6bc7=_0x2c509a;if(_0x532b9c)return _0x6bc577=_0x532b9c,_0xa5624f['model']=_['keys'](db['User']['rawAttributes']),_0xa5624f[_0x1f6bc7('0x39')]=_['keys'](_0x35f55a[_0x1f6bc7('0x39')]),_0xa5624f[_0x1f6bc7('0x23')]=_['intersection'](_0xa5624f[_0x1f6bc7('0x48')],_0xa5624f[_0x1f6bc7('0x39')]),_0x4a530c['attributes']=_['intersection'](_0xa5624f['model'],qs[_0x1f6bc7('0x49')](_0x35f55a[_0x1f6bc7('0x39')][_0x1f6bc7('0x49')])),_0x4a530c[_0x1f6bc7('0x17')]=_0x4a530c[_0x1f6bc7('0x17')][_0x1f6bc7('0x2')]?_0x4a530c[_0x1f6bc7('0x17')]:_0xa5624f[_0x1f6bc7('0x48')],_0x4a530c['order']=qs[_0x1f6bc7('0x36')](_0x35f55a[_0x1f6bc7('0x39')]['sort']),_0x4a530c['where']=qs['filters'](_[_0x1f6bc7('0x4e')](_0x35f55a[_0x1f6bc7('0x39')],_0xa5624f['filters'])),_0x35f55a[_0x1f6bc7('0x39')][_0x1f6bc7('0x21')]&&(_0x4a530c[_0x1f6bc7('0x4b')]=_[_0x1f6bc7('0x64')](_0x4a530c[_0x1f6bc7('0x4b')],{[Op['or']]:_['map'](_0x4a530c['attributes'],function(_0x729279){const _0x57de5e=_0x1f6bc7,_0x44a7c7={};return _0x44a7c7[_0x729279]={[Op[_0x57de5e('0x9')]]:'%'+_0x35f55a[_0x57de5e('0x39')][_0x57de5e('0x21')]+'%'},_0x44a7c7;})})),_0x4a530c=_[_0x1f6bc7('0x64')]({},_0x4a530c,_0x35f55a[_0x1f6bc7('0x42')]),_0x6bc577['getAgents'](_0x4a530c);})[_0x2c509a('0x20')](function(_0x404f30){const _0x458992=_0x2c509a;if(_0x404f30)return _0x1b862e=_0x404f30[_0x458992('0x2')],typeof _0x35f55a[_0x458992('0x39')][_0x458992('0x37')]===_0x458992('0x50')&&(_0x4a530c[_0x458992('0x47')]=qs['limit'](_0x35f55a['query'][_0x458992('0x47')]),_0x4a530c[_0x458992('0x1f')]=qs[_0x458992('0x1f')](_0x35f55a[_0x458992('0x39')][_0x458992('0x1f')])),_0x6bc577[_0x458992('0x6e')](_0x4a530c);})[_0x2c509a('0x20')](function(_0x354bd6){if(_0x354bd6)return _0x354bd6?{'count':_0x1b862e,'rows':_0x354bd6}:null;})[_0x2c509a('0x20')](respondWithResult(_0x96f6ab,null))[_0x2c509a('0x59')](handleError(_0x96f6ab,null));};
\ No newline at end of file
+const a157_0x2ba4=['offset','UserProfileResource','create','nolimit','params','ids','number','Content-disposition','api','rawAttributes','../../rediscache','cf_%d','Malformed\x20request\x20syntax','undefined','get','getContacts','UserProfileSection','sendStatus','show','TEXT','length','raw','tags','options','lodash','transaction','concat','isEmpty','type','message','merge','queryInterface','map','attachment;\x20filename=','includeAll','register','destroy','stack','Lists','switch','count','Content-type','order','intersection','role','Sequelize','sequelize','userCmList:remove','dataValues','model','send','ListId','getAgents','errors','attributes','like','end','now','catch','userCmList:save','then','pick','getContactsCsv','fieldName','setHeader','describe','filters','addContacts','CmList','fields','findAll','keys','defaultValue','CmContact','status','./cmList.socket','VIRTUAL','CmCustomField','json','autoAssociation','index','text/csv','sort','filter','isArray','limit','findOne','util','Disposition','rows','name','removeAgents','query','addAgents','Content-Range','include','key','body','to-csv','update','/tmp/list_%d_%s.csv','../../config/logger','addColumn','User','where','download','user','omit','../../mysqldb','CustomFields','addDisposition','Unable\x20to\x20retrieve\x20the\x20current\x20user','getDispositions','format','addCustomFields','text','removeDispositions','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','writeFileSync','push','emit','cm_contacts','join'];(function(_0x1a4777,_0x2ba4ad){const _0x18585a=function(_0x3311be){while(--_0x3311be){_0x1a4777['push'](_0x1a4777['shift']());}};_0x18585a(++_0x2ba4ad);}(a157_0x2ba4,0xa3));const a157_0x1858=function(_0x1a4777,_0x2ba4ad){_0x1a4777=_0x1a4777-0x0;let _0x18585a=a157_0x2ba4[_0x1a4777];return _0x18585a;};const _0xedfc6e=a157_0x1858;'use strict';const util=require(_0xedfc6e('0x2f')),fs=require('fs'),_=require(_0xedfc6e('0x6b')),toCsv=require(_0xedfc6e('0x3a')),{getSocket}=require(_0xedfc6e('0x5d')),socket=getSocket(),qs=require('../../components/parsers/qs'),logger=require(_0xedfc6e('0x3d'))(_0xedfc6e('0x5b')),db=require(_0xedfc6e('0x44'))['db'],{Op}=require('sequelize');require(_0xedfc6e('0x23'))[_0xedfc6e('0x76')](socket);function respondWithStatusCode(_0x3311be,_0x49720e){return _0x49720e=_0x49720e||0xcc,function(_0x505a45){const _0x53a2f8=a157_0x1858;if(_0x505a45)return _0x3311be[_0x53a2f8('0x64')](_0x49720e);return _0x3311be[_0x53a2f8('0x22')](_0x49720e)[_0x53a2f8('0x10')]();};}function respondWithResult(_0x4eebf7,_0x3051af){return _0x3051af=_0x3051af||0xc8,function(_0x54b420){const _0x3ab14d=a157_0x1858;if(_0x54b420)return _0x4eebf7[_0x3ab14d('0x22')](_0x3051af)['json'](_0x54b420);};}function respondWithFilteredResult(_0x484589,_0x5ea4a4){return function(_0x3761ea){const _0x2a663a=a157_0x1858;if(_0x3761ea){const _0x1703ae=_0x3761ea[_0x2a663a('0x0')],_0x32af89=_0x5ea4a4['offset'];let _0x1afa26=_0x5ea4a4['offset']+_0x5ea4a4[_0x2a663a('0x2d')],_0x343959;return _0x1afa26>=_0x1703ae?(_0x1afa26=_0x1703ae,_0x343959=0xc8):_0x343959=0xce,_0x484589[_0x2a663a('0x22')](_0x343959),_0x484589['set'](_0x2a663a('0x36'),_0x32af89+'-'+_0x1afa26+'/'+_0x1703ae)[_0x2a663a('0x26')](_0x3761ea);}return null;};}function saveUpdates(_0x429dbc){return function(_0xc15ef1){const _0x5dc216=a157_0x1858;if(_0xc15ef1)return _0xc15ef1[_0x5dc216('0x3b')](_0x429dbc)['then'](function(_0x4b4535){return _0x4b4535;});return null;};}function removeEntity(_0x310e90){return function(_0x13e55e){const _0x140dc5=a157_0x1858;if(_0x13e55e)return _0x13e55e[_0x140dc5('0x77')]()['then'](function(){const _0x250f94=_0x140dc5,_0x3cba81=_0x13e55e['get']({'plain':!![]}),_0x17b46e=_0x250f94('0x79');return db[_0x250f94('0x54')][_0x250f94('0x77')]({'where':{'type':_0x17b46e,'resourceId':_0x3cba81['id']}})[_0x250f94('0x14')](function(){return _0x13e55e;});})[_0x140dc5('0x14')](function(){_0x310e90['status'](0xcc)['end']();});};}function handleEntityNotFound(_0x199d08){return function(_0x4faa5e){const _0x53f4e2=a157_0x1858;return!_0x4faa5e&&_0x199d08[_0x53f4e2('0x64')](0x194),_0x4faa5e;};}function handleError(_0x6734a7,_0x4b9152){return _0x4b9152=_0x4b9152||0x1f4,function(_0x451a74){const _0x475800=a157_0x1858;logger['error'](_0x451a74[_0x475800('0x78')]),_0x451a74[_0x475800('0x32')]&&delete _0x451a74[_0x475800('0x32')],_0x6734a7[_0x475800('0x22')](_0x4b9152)[_0x475800('0xa')](_0x451a74);};}exports[_0xedfc6e('0x28')]=function(_0x4fd1af,_0xa56780){const _0x271984=_0xedfc6e;let _0x8c67ce={};const _0x4ce016={},_0x2e7b05={'count':0x0,'rows':[]},_0x299081=_[_0x271984('0x73')](db[_0x271984('0x1c')]['rawAttributes'],function(_0x308c92){const _0x51c968=_0x271984;return{'name':_0x308c92[_0x51c968('0x17')],'type':_0x308c92['type'][_0x51c968('0x38')]};});_0x4ce016['model']=_[_0x271984('0x73')](_0x299081,'name'),_0x4ce016['query']=_[_0x271984('0x1f')](_0x4fd1af[_0x271984('0x34')]),_0x4ce016[_0x271984('0x1a')]=_[_0x271984('0x3')](_0x4ce016['model'],_0x4ce016[_0x271984('0x34')]),_0x8c67ce['attributes']=_['intersection'](_0x4ce016[_0x271984('0x9')],qs[_0x271984('0x1d')](_0x4fd1af['query'][_0x271984('0x1d')])),_0x8c67ce[_0x271984('0xe')]=_0x8c67ce[_0x271984('0xe')]['length']?_0x8c67ce[_0x271984('0xe')]:_0x4ce016[_0x271984('0x9')];typeof _0x4fd1af[_0x271984('0x34')][_0x271984('0x56')]===_0x271984('0x60')&&(_0x8c67ce[_0x271984('0x2d')]=qs[_0x271984('0x2d')](_0x4fd1af[_0x271984('0x34')][_0x271984('0x2d')]),_0x8c67ce['offset']=qs[_0x271984('0x53')](_0x4fd1af[_0x271984('0x34')][_0x271984('0x53')]));_0x8c67ce['order']=qs['sort'](_0x4fd1af[_0x271984('0x34')]['sort']),_0x8c67ce[_0x271984('0x40')]=qs[_0x271984('0x1a')](_[_0x271984('0x15')](_0x4fd1af['query'],_0x4ce016[_0x271984('0x1a')]),_0x299081);_0x4fd1af[_0x271984('0x34')]['filter']&&(_0x8c67ce['where']=_[_0x271984('0x71')](_0x8c67ce[_0x271984('0x40')],{[Op['or']]:_[_0x271984('0x73')](_0x299081,function(_0x321f69){const _0x483147=_0x271984;if(_0x321f69[_0x483147('0x6f')]!==_0x483147('0x24')){const _0x196f2f={};return _0x196f2f[_0x321f69[_0x483147('0x32')]]={[Op[_0x483147('0xf')]]:'%'+_0x4fd1af[_0x483147('0x34')][_0x483147('0x2b')]+'%'},_0x196f2f;}})}));_0x8c67ce=_[_0x271984('0x71')]({},_0x8c67ce,_0x4fd1af[_0x271984('0x6a')]);const _0x14bdab={'where':_0x8c67ce[_0x271984('0x40')]};return db[_0x271984('0x1c')][_0x271984('0x0')](_0x14bdab)['then'](function(_0x49cdd9){const _0x65580a=_0x271984;return _0x2e7b05[_0x65580a('0x0')]=_0x49cdd9,_0x4fd1af[_0x65580a('0x34')][_0x65580a('0x75')]&&(_0x8c67ce[_0x65580a('0x37')]=[{'all':!![]}]),db[_0x65580a('0x1c')][_0x65580a('0x1e')](_0x8c67ce);})[_0x271984('0x14')](function(_0x294ad1){const _0x5c02ad=_0x271984;return _0x2e7b05[_0x5c02ad('0x31')]=_0x294ad1,_0x2e7b05;})[_0x271984('0x14')](respondWithFilteredResult(_0xa56780,_0x8c67ce))['catch'](handleError(_0xa56780,null));},exports[_0xedfc6e('0x65')]=function(_0x55ff17,_0x2c7191){const _0x4b401a=_0xedfc6e;let _0x8661cf={'raw':![],'where':{'id':_0x55ff17['params']['id']}};const _0x5e60b6={};return _0x5e60b6[_0x4b401a('0x9')]=_[_0x4b401a('0x1f')](db[_0x4b401a('0x1c')][_0x4b401a('0x5c')]),_0x5e60b6[_0x4b401a('0x34')]=_[_0x4b401a('0x1f')](_0x55ff17[_0x4b401a('0x34')]),_0x5e60b6['filters']=_[_0x4b401a('0x3')](_0x5e60b6['model'],_0x5e60b6[_0x4b401a('0x34')]),_0x8661cf[_0x4b401a('0xe')]=_[_0x4b401a('0x3')](_0x5e60b6['model'],qs['fields'](_0x55ff17[_0x4b401a('0x34')][_0x4b401a('0x1d')])),_0x8661cf[_0x4b401a('0xe')]=_0x8661cf[_0x4b401a('0xe')][_0x4b401a('0x67')]?_0x8661cf[_0x4b401a('0xe')]:_0x5e60b6[_0x4b401a('0x9')],_0x55ff17['query']['includeAll']&&(_0x8661cf[_0x4b401a('0x37')]=[{'all':!![]}]),_0x8661cf=_[_0x4b401a('0x71')]({},_0x8661cf,_0x55ff17['options']),db[_0x4b401a('0x1c')][_0x4b401a('0x2e')](_0x8661cf)['then'](handleEntityNotFound(_0x2c7191,null))[_0x4b401a('0x14')](respondWithResult(_0x2c7191,null))[_0x4b401a('0x12')](handleError(_0x2c7191,null));},exports[_0xedfc6e('0x55')]=function(_0x3755f6,_0x281351){const _0x446106=_0xedfc6e;return db['CmList'][_0x446106('0x55')](_0x3755f6[_0x446106('0x39')],{})[_0x446106('0x14')](function(_0x769ad7){const _0x58f3db=_0x446106,_0x4398b8=_0x3755f6[_0x58f3db('0x42')]['get']({'plain':!![]});if(!_0x4398b8)throw new Error(_0x58f3db('0x47'));if(_0x4398b8[_0x58f3db('0x4')]===_0x58f3db('0x42')){const _0x30cfff=_0x769ad7[_0x58f3db('0x61')]({'plain':!![]}),_0x255f92='Lists';return db[_0x58f3db('0x63')][_0x58f3db('0x2e')]({'where':{'name':_0x255f92,'userProfileId':_0x4398b8['userProfileId']},'raw':!![]})[_0x58f3db('0x14')](function(_0x2fc70f){const _0xb6be1f=_0x58f3db;return _0x2fc70f&&_0x2fc70f[_0xb6be1f('0x27')]===0x0?db[_0xb6be1f('0x54')][_0xb6be1f('0x55')]({'name':_0x30cfff['name'],'resourceId':_0x30cfff['id'],'type':_0x2fc70f['name'],'sectionId':_0x2fc70f['id']},{})['then'](function(){return _0x769ad7;}):_0x769ad7;})[_0x58f3db('0x12')](function(_0x14de4e){const _0x3b9f3d=_0x58f3db;logger['error'](_0x3b9f3d('0x4d'),_0x14de4e);throw _0x14de4e;});}return _0x769ad7;})[_0x446106('0x14')](respondWithResult(_0x281351,0xc9))['catch'](handleError(_0x281351,null));},exports['update']=function(_0x3e53a3,_0x5a1ebf){const _0x4fd148=_0xedfc6e;return _0x3e53a3[_0x4fd148('0x39')]['id']&&delete _0x3e53a3[_0x4fd148('0x39')]['id'],db['CmList']['findOne']({'where':{'id':_0x3e53a3['params']['id']}})['then'](handleEntityNotFound(_0x5a1ebf,null))[_0x4fd148('0x14')](saveUpdates(_0x3e53a3[_0x4fd148('0x39')],null))[_0x4fd148('0x14')](respondWithResult(_0x5a1ebf,null))['catch'](handleError(_0x5a1ebf,null));},exports[_0xedfc6e('0x77')]=function(_0x62243e,_0x1adf8f){const _0x1ddbf1=_0xedfc6e;return db[_0x1ddbf1('0x1c')][_0x1ddbf1('0x2e')]({'where':{'id':_0x62243e[_0x1ddbf1('0x57')]['id']}})['then'](handleEntityNotFound(_0x1adf8f,null))['then'](removeEntity(_0x1adf8f,null))[_0x1ddbf1('0x12')](handleError(_0x1adf8f,null));},exports[_0xedfc6e('0x19')]=function(_0x1f8ec7,_0x3e4c8b){const _0x4d85b7=_0xedfc6e;return db[_0x4d85b7('0x1c')][_0x4d85b7('0x19')]()[_0x4d85b7('0x14')](respondWithResult(_0x3e4c8b,null))[_0x4d85b7('0x12')](handleError(_0x3e4c8b,null));},exports[_0xedfc6e('0x46')]=function(_0xf061c7,_0x50bf42){const _0x1d0229=_0xedfc6e;return _0xf061c7[_0x1d0229('0x39')]['id']&&delete _0xf061c7[_0x1d0229('0x39')]['id'],db[_0x1d0229('0x1c')][_0x1d0229('0x2e')]({'where':{'id':_0xf061c7[_0x1d0229('0x57')]['id']}})[_0x1d0229('0x14')](handleEntityNotFound(_0x50bf42,null))[_0x1d0229('0x14')](function(_0x333e38){const _0x11f268=_0x1d0229;if(_0x333e38)return _0xf061c7[_0x11f268('0x39')][_0x11f268('0xb')]=_0x333e38['id'],db[_0x11f268('0x30')][_0x11f268('0x55')](_0xf061c7[_0x11f268('0x39')]);})[_0x1d0229('0x14')](respondWithResult(_0x50bf42,null))[_0x1d0229('0x12')](handleError(_0x50bf42,null));},exports[_0xedfc6e('0x48')]=function(_0x2724ae,_0x5195c9){const _0x5c418c=_0xedfc6e;let _0x4209a1={'raw':![],'where':{}};const _0x2e373a={},_0x32b5c2={'count':0x0,'rows':[]};return db['CmList'][_0x5c418c('0x2e')]({'where':{'id':_0x2724ae[_0x5c418c('0x57')]['id']}})['then'](handleEntityNotFound(_0x5195c9,null))[_0x5c418c('0x14')](function(_0x1e9997){const _0x28db8e=_0x5c418c;if(_0x1e9997)return _0x2e373a[_0x28db8e('0x9')]=_[_0x28db8e('0x1f')](db[_0x28db8e('0x30')][_0x28db8e('0x5c')]),_0x2e373a[_0x28db8e('0x34')]=_[_0x28db8e('0x1f')](_0x2724ae[_0x28db8e('0x34')]),_0x2e373a[_0x28db8e('0x1a')]=_[_0x28db8e('0x3')](_0x2e373a[_0x28db8e('0x9')],_0x2e373a[_0x28db8e('0x34')]),_0x4209a1[_0x28db8e('0xe')]=_[_0x28db8e('0x3')](_0x2e373a[_0x28db8e('0x9')],qs['fields'](_0x2724ae[_0x28db8e('0x34')][_0x28db8e('0x1d')])),_0x4209a1['attributes']=_0x4209a1[_0x28db8e('0xe')][_0x28db8e('0x67')]?_0x4209a1[_0x28db8e('0xe')]:_0x2e373a['model'],typeof _0x2724ae[_0x28db8e('0x34')]['nolimit']===_0x28db8e('0x60')&&(_0x4209a1['limit']=qs['limit'](_0x2724ae[_0x28db8e('0x34')][_0x28db8e('0x2d')]),_0x4209a1[_0x28db8e('0x53')]=qs[_0x28db8e('0x53')](_0x2724ae[_0x28db8e('0x34')][_0x28db8e('0x53')])),_0x4209a1[_0x28db8e('0x2')]=qs[_0x28db8e('0x2a')](_0x2724ae[_0x28db8e('0x34')][_0x28db8e('0x2a')]),_0x4209a1[_0x28db8e('0x40')]=qs['filters'](_[_0x28db8e('0x15')](_0x2724ae[_0x28db8e('0x34')],_0x2e373a['filters'])),_0x4209a1[_0x28db8e('0x40')][_0x28db8e('0xb')]=_0x1e9997['id'],_0x2724ae[_0x28db8e('0x34')][_0x28db8e('0x2b')]&&(_0x4209a1[_0x28db8e('0x40')]=_[_0x28db8e('0x71')](_0x4209a1[_0x28db8e('0x40')],{[Op['or']]:_['map'](_0x4209a1[_0x28db8e('0xe')],function(_0x56ed9a){const _0x5eaac3=_0x28db8e,_0x1f601a={};return _0x1f601a[_0x56ed9a]={[Op[_0x5eaac3('0xf')]]:'%'+_0x2724ae[_0x5eaac3('0x34')]['filter']+'%'},_0x1f601a;})})),_0x4209a1=_[_0x28db8e('0x71')]({},_0x4209a1,_0x2724ae[_0x28db8e('0x6a')]),db['Disposition']['count']({'where':_0x4209a1['where']})[_0x28db8e('0x14')](function(_0x9252dd){const _0x40c38d=_0x28db8e;return _0x32b5c2[_0x40c38d('0x0')]=_0x9252dd,_0x2724ae['query']['includeAll']&&(_0x4209a1[_0x40c38d('0x37')]=[{'all':!![]}]),db[_0x40c38d('0x30')]['findAll'](_0x4209a1);})[_0x28db8e('0x14')](function(_0x4ff5f5){const _0x20709a=_0x28db8e;return _0x32b5c2[_0x20709a('0x31')]=_0x4ff5f5,_0x32b5c2;});})['then'](respondWithFilteredResult(_0x5195c9,_0x4209a1))[_0x5c418c('0x12')](handleError(_0x5195c9,null));},exports['removeDispositions']=function(_0x3a0429,_0x397ecd){const _0x3977d2=_0xedfc6e;return db[_0x3977d2('0x1c')]['findOne']({'where':{'id':_0x3a0429[_0x3977d2('0x57')]['id']}})[_0x3977d2('0x14')](handleEntityNotFound(_0x397ecd,null))[_0x3977d2('0x14')](function(_0x55cda5){const _0x5d840f=_0x3977d2;if(_0x55cda5)return _0x55cda5[_0x5d840f('0x4c')](_0x3a0429[_0x5d840f('0x34')][_0x5d840f('0x58')]);})[_0x3977d2('0x14')](respondWithStatusCode(_0x397ecd,null))['catch'](handleError(_0x397ecd,null));},exports[_0xedfc6e('0x1b')]=function(_0x2d1d9a,_0x30a5a2){const _0xf62a76=_0xedfc6e;return db[_0xf62a76('0x1c')]['findOne']({'where':{'id':_0x2d1d9a[_0xf62a76('0x57')]['id']}})[_0xf62a76('0x14')](handleEntityNotFound(_0x30a5a2,null))[_0xf62a76('0x14')](function(_0x278030){const _0x53e05e=_0xf62a76;if(_0x278030){const _0x2d7872=[],_0x2e315d={'success':[],'errors':[]};return db['CmContact'][_0x53e05e('0x19')]()[_0x53e05e('0x14')](function(_0x171f92){const _0x367bbd=_0x53e05e;_0x2d1d9a[_0x367bbd('0x39')][_0x367bbd('0x69')]&&_[_0x367bbd('0x2c')](_0x2d1d9a['body']['tags'])?_0x2d1d9a[_0x367bbd('0x39')][_0x367bbd('0x69')]['length']?_0x2d1d9a[_0x367bbd('0x39')][_0x367bbd('0x69')]=_0x2d1d9a['body'][_0x367bbd('0x69')][_0x367bbd('0x52')](';')+';':_0x2d1d9a['body'][_0x367bbd('0x69')]=null:_0x2d1d9a[_0x367bbd('0x39')]['tags']=null;if(_0x2d1d9a[_0x367bbd('0x39')]&&_[_0x367bbd('0x2c')](_0x2d1d9a['body'])){for(let _0x3c5f62=0x0;_0x3c5f62<_0x2d1d9a[_0x367bbd('0x39')]['length'];_0x3c5f62+=0x1){_0x2d1d9a[_0x367bbd('0x39')][_0x3c5f62][_0x367bbd('0xb')]=_0x2d1d9a[_0x367bbd('0x57')]['id'],_0x2d7872[_0x367bbd('0x4f')](_0x2d1d9a['body'][_0x3c5f62]);}return Promise['each'](_0x2d7872,function(_0x22ef8d){const _0x29464f=_0x367bbd;return db['CmContact']['create'](_['omit'](_0x22ef8d,[_0x29464f('0x58'),'id'])||{},{'fields':_[_0x29464f('0x1f')](_0x171f92),'raw':!![]})['then'](function(_0x373c7b){const _0x5bf86e=_0x29464f;_0x2e315d['success'][_0x5bf86e('0x4f')](_0x373c7b[_0x5bf86e('0x8')]);})[_0x29464f('0x12')](function(_0x3b62d9){const _0x2e1f34=_0x29464f;_0x2e315d[_0x2e1f34('0xd')]['push']({'data':_0x22ef8d,'error':_0x3b62d9[_0x2e1f34('0x70')]});});})[_0x367bbd('0x14')](function(){return _0x2e315d;})[_0x367bbd('0x12')](function(_0x2f6044){return _0x2f6044;});}else _0x30a5a2[_0x367bbd('0x22')](0x190)[_0x367bbd('0x26')]({'message':_0x367bbd('0x5f')});});}})[_0xf62a76('0x14')](respondWithResult(_0x30a5a2,null))['catch'](handleError(_0x30a5a2,null));},exports[_0xedfc6e('0x62')]=function(_0x4ab152,_0x4286ce){const _0x4dec8f=_0xedfc6e;let _0x12fa85;return db[_0x4dec8f('0x1c')]['findOne']({'where':{'id':_0x4ab152[_0x4dec8f('0x57')]['id']},'include':[{'model':db[_0x4dec8f('0x25')],'as':_0x4dec8f('0x45')}]})[_0x4dec8f('0x14')](handleEntityNotFound(_0x4286ce,null))[_0x4dec8f('0x14')](function(_0x12db8f){const _0x5ba71e=_0x4dec8f;if(_0x12db8f)return _0x12fa85=_0x12db8f,db[_0x5ba71e('0x21')][_0x5ba71e('0x5c')];})['then'](function(_0x419b51){const _0x5b71ea=_0x4dec8f;if(_0x419b51){let _0x8c0e57={};const _0x20a874={};return _0x20a874[_0x5b71ea('0x9')]=_[_0x5b71ea('0x6d')](_[_0x5b71ea('0x1f')](_0x419b51),_[_0x5b71ea('0x73')](_0x12fa85[_0x5b71ea('0x45')],function(_0x1f2767){const _0x4a52c1=_0x5b71ea;return util[_0x4a52c1('0x49')](_0x4a52c1('0x5e'),_0x1f2767['id']);})),_0x20a874[_0x5b71ea('0x34')]=_[_0x5b71ea('0x1f')](_0x4ab152[_0x5b71ea('0x34')]),_0x20a874[_0x5b71ea('0x1a')]=_[_0x5b71ea('0x3')](_0x20a874['model'],_0x20a874[_0x5b71ea('0x34')]),_0x8c0e57['attributes']=_[_0x5b71ea('0x3')](_0x20a874[_0x5b71ea('0x9')],qs[_0x5b71ea('0x1d')](_0x4ab152[_0x5b71ea('0x34')][_0x5b71ea('0x1d')])),_0x8c0e57['attributes']=_0x8c0e57[_0x5b71ea('0xe')]['length']?_0x8c0e57['attributes']:_0x20a874['model'],typeof _0x4ab152[_0x5b71ea('0x34')][_0x5b71ea('0x56')]===_0x5b71ea('0x60')&&(_0x8c0e57[_0x5b71ea('0x2d')]=qs[_0x5b71ea('0x2d')](_0x4ab152[_0x5b71ea('0x34')][_0x5b71ea('0x2d')]),_0x8c0e57[_0x5b71ea('0x53')]=qs[_0x5b71ea('0x53')](_0x4ab152[_0x5b71ea('0x34')][_0x5b71ea('0x53')])),_0x8c0e57[_0x5b71ea('0x2')]=qs['sort'](_0x4ab152['query'][_0x5b71ea('0x2a')]),_0x8c0e57['where']=qs[_0x5b71ea('0x1a')](_['pick'](_0x4ab152[_0x5b71ea('0x34')],_0x20a874['filters'])),_0x8c0e57[_0x5b71ea('0x68')]=!![],_0x4ab152[_0x5b71ea('0x34')]['filter']&&(_0x8c0e57['where']=_[_0x5b71ea('0x71')](_0x8c0e57[_0x5b71ea('0x40')],{[Op['or']]:_[_0x5b71ea('0x73')](_0x8c0e57[_0x5b71ea('0xe')],function(_0x49670b){const _0xa9e486=_0x5b71ea,_0xa96dc6={};return _0xa96dc6[_0x49670b]={[Op[_0xa9e486('0xf')]]:'%'+_0x4ab152[_0xa9e486('0x34')]['filter']+'%'},_0xa96dc6;})})),_0x8c0e57=_[_0x5b71ea('0x71')]({},_0x8c0e57,_0x4ab152['options']),_0x12fa85[_0x5b71ea('0x62')](_0x8c0e57);}})[_0x4dec8f('0x14')](respondWithResult(_0x4286ce,null))[_0x4dec8f('0x12')](handleError(_0x4286ce,null));},exports[_0xedfc6e('0x16')]=function(_0x25a11b,_0x4cd0e0){const _0x974261=_0xedfc6e;let _0x36add4;return db['CmList']['findOne']({'where':{'id':_0x25a11b['params']['id']},'include':[{'model':db[_0x974261('0x25')],'as':_0x974261('0x45')}]})[_0x974261('0x14')](handleEntityNotFound(_0x4cd0e0,null))[_0x974261('0x14')](function(_0x36ca8b){const _0x47a589=_0x974261;if(_0x36ca8b)return _0x36add4=_0x36ca8b,db[_0x47a589('0x21')][_0x47a589('0x5c')];})['then'](function(_0x5f344d){const _0x1cff1e=_0x974261;if(_0x5f344d){let _0x599a1d={};const _0x580786={};return _0x580786['model']=_[_0x1cff1e('0x6d')](_[_0x1cff1e('0x1f')](_0x5f344d),_[_0x1cff1e('0x73')](_0x36add4[_0x1cff1e('0x45')],function(_0x3ec3d2){const _0x35c025=_0x1cff1e;return util[_0x35c025('0x49')](_0x35c025('0x5e'),_0x3ec3d2['id']);})),_0x580786[_0x1cff1e('0x34')]=_[_0x1cff1e('0x1f')](_0x25a11b[_0x1cff1e('0x34')]),_0x580786['filters']=_[_0x1cff1e('0x3')](_0x580786['model'],_0x580786[_0x1cff1e('0x34')]),_0x599a1d['attributes']=_['intersection'](_0x580786[_0x1cff1e('0x9')],qs['fields'](_0x25a11b[_0x1cff1e('0x34')][_0x1cff1e('0x1d')])),_0x599a1d['attributes']=_0x599a1d['attributes']['length']?_0x599a1d[_0x1cff1e('0xe')]:_0x580786[_0x1cff1e('0x9')],typeof _0x25a11b['query'][_0x1cff1e('0x56')]===_0x1cff1e('0x60')&&(_0x599a1d[_0x1cff1e('0x2d')]=qs[_0x1cff1e('0x2d')](_0x25a11b[_0x1cff1e('0x34')]['limit']),_0x599a1d[_0x1cff1e('0x53')]=qs[_0x1cff1e('0x53')](_0x25a11b[_0x1cff1e('0x34')][_0x1cff1e('0x53')])),_0x599a1d[_0x1cff1e('0x2')]=qs[_0x1cff1e('0x2a')](_0x25a11b[_0x1cff1e('0x34')][_0x1cff1e('0x2a')]),_0x599a1d[_0x1cff1e('0x40')]=qs['filters'](_['pick'](_0x25a11b[_0x1cff1e('0x34')],_0x580786[_0x1cff1e('0x1a')])),_0x599a1d['raw']=!![],_0x25a11b[_0x1cff1e('0x34')][_0x1cff1e('0x2b')]&&(_0x599a1d[_0x1cff1e('0x40')]=_['merge'](_0x599a1d['where'],{[Op['or']]:_[_0x1cff1e('0x73')](_0x599a1d['attributes'],function(_0x32f559){const _0x411ff3=_0x1cff1e,_0x1e63dc={};return _0x1e63dc[_0x32f559]={[Op[_0x411ff3('0xf')]]:'%'+_0x25a11b[_0x411ff3('0x34')][_0x411ff3('0x2b')]+'%'},_0x1e63dc;})})),_0x599a1d=_[_0x1cff1e('0x71')]({},_0x599a1d,_0x25a11b['options']),_0x36add4['getContacts'](_0x599a1d);}})['then'](function(_0x25d631){const _0x3a768d=_0x974261;if(!_[_0x3a768d('0x6e')](_0x25d631)){const _0x207e0c=toCsv(_0x25d631),_0x1fb3aa=Date[_0x3a768d('0x11')]();return fs[_0x3a768d('0x4e')](util[_0x3a768d('0x49')](_0x3a768d('0x3c'),_0x36add4['id'],_0x1fb3aa),_0x207e0c),_0x4cd0e0['setHeader'](_0x3a768d('0x5a'),_0x3a768d('0x74')+util[_0x3a768d('0x49')]('list_%d_%s.csv',_0x36add4['id'],_0x1fb3aa)),_0x4cd0e0[_0x3a768d('0x18')](_0x3a768d('0x1'),_0x3a768d('0x29')),_0x4cd0e0[_0x3a768d('0x41')](util[_0x3a768d('0x49')]('/tmp/list_%d_%s.csv',_0x36add4['id'],_0x1fb3aa));}else return _0x4cd0e0[_0x3a768d('0x64')](0xcc);})[_0x974261('0x12')](handleError(_0x4cd0e0,null));},exports['addCustomField']=function(_0x425590,_0x3d588d){const _0x4fb167=_0xedfc6e;let _0x232eb1;return delete _0x425590[_0x4fb167('0x39')]['id'],db[_0x4fb167('0x1c')][_0x4fb167('0x2e')]({'where':{'id':_0x425590[_0x4fb167('0x57')]['id']}})[_0x4fb167('0x14')](handleEntityNotFound(_0x3d588d,null))[_0x4fb167('0x14')](function(_0x1fb7ac){const _0x46de00=_0x4fb167;if(_0x1fb7ac)return db[_0x46de00('0x6')][_0x46de00('0x6c')](function(_0x4d340c){const _0x2d3fc0=_0x46de00;return db[_0x2d3fc0('0x25')][_0x2d3fc0('0x55')](_0x425590[_0x2d3fc0('0x39')],{'transaction':_0x4d340c})[_0x2d3fc0('0x14')](function(_0x5de007){const _0x3996dc=_0x2d3fc0;return _0x232eb1=_0x5de007,_0x1fb7ac[_0x3996dc('0x4a')](_0x5de007,{'transaction':_0x4d340c});})['then'](function(){const _0x4c804b=_0x2d3fc0,_0x220cb4={'type':db[_0x4c804b('0x5')]['TEXT'],'transaction':_0x4d340c};switch(_0x425590[_0x4c804b('0x39')][_0x4c804b('0x6f')]){case _0x4c804b('0x4b'):_0x220cb4[_0x4c804b('0x6f')]=db['Sequelize'][_0x4c804b('0x66')];break;case _0x4c804b('0x59'):_0x220cb4[_0x4c804b('0x6f')]=db[_0x4c804b('0x5')]['INTEGER'];break;case _0x4c804b('0x7a'):_0x220cb4[_0x4c804b('0x6f')]=db[_0x4c804b('0x5')]['BOOLEAN'],_0x220cb4[_0x4c804b('0x20')]=![];break;default:}return db[_0x4c804b('0x6')][_0x4c804b('0x72')][_0x4c804b('0x3e')](_0x4c804b('0x51'),util[_0x4c804b('0x49')]('cf_%s',_0x232eb1['id']),_0x220cb4);})[_0x2d3fc0('0x14')](function(){return _0x232eb1;});});})[_0x4fb167('0x14')](respondWithResult(_0x3d588d,null))[_0x4fb167('0x12')](handleError(_0x3d588d,null));},exports['getCustomFields']=function(_0x555680,_0x1dd1f5){const _0x8f9fa3=_0xedfc6e;let _0xbef08a={};const _0x5b83ea={};return db[_0x8f9fa3('0x1c')]['findOne']({'where':{'id':_0x555680[_0x8f9fa3('0x57')]['id']}})[_0x8f9fa3('0x14')](handleEntityNotFound(_0x1dd1f5,null))['then'](function(_0x28a402){const _0x47aece=_0x8f9fa3;if(_0x28a402)return _0x5b83ea[_0x47aece('0x9')]=_[_0x47aece('0x1f')](db[_0x47aece('0x25')][_0x47aece('0x5c')]),_0x5b83ea[_0x47aece('0x34')]=_['keys'](_0x555680[_0x47aece('0x34')]),_0x5b83ea['filters']=_[_0x47aece('0x3')](_0x5b83ea[_0x47aece('0x9')],_0x5b83ea[_0x47aece('0x34')]),_0xbef08a[_0x47aece('0xe')]=_[_0x47aece('0x3')](_0x5b83ea['model'],qs['fields'](_0x555680[_0x47aece('0x34')]['fields'])),_0xbef08a[_0x47aece('0xe')]=_0xbef08a[_0x47aece('0xe')][_0x47aece('0x67')]?_0xbef08a['attributes']:_0x5b83ea[_0x47aece('0x9')],_0xbef08a[_0x47aece('0x2')]=qs[_0x47aece('0x2a')](_0x555680[_0x47aece('0x34')]['sort']),_0xbef08a[_0x47aece('0x40')]=qs[_0x47aece('0x1a')](_[_0x47aece('0x15')](_0x555680[_0x47aece('0x34')],_0x5b83ea[_0x47aece('0x1a')])),_0xbef08a[_0x47aece('0x40')]=_['merge'](_0xbef08a['where'],{[Op['or']]:[{'ListId':_0x28a402['id']},{'ListId':null}]}),_0x555680[_0x47aece('0x34')][_0x47aece('0x2b')]&&(_0xbef08a[_0x47aece('0x40')]=_['merge'](_0xbef08a[_0x47aece('0x40')],{[Op['or']]:_[_0x47aece('0x73')](_0xbef08a[_0x47aece('0xe')],function(_0x58787b){const _0x1d2800=_0x47aece,_0x331112={};return _0x331112[_0x58787b]={[Op[_0x1d2800('0xf')]]:'%'+_0x555680[_0x1d2800('0x34')][_0x1d2800('0x2b')]+'%'},_0x331112;})})),_0xbef08a=_[_0x47aece('0x71')]({},_0xbef08a,_0x555680['options']),db['CmCustomField']['findAndCountAll'](_0xbef08a);})['then'](respondWithResult(_0x1dd1f5,null))['catch'](handleError(_0x1dd1f5,null));},exports[_0xedfc6e('0x35')]=function(_0x5a605e,_0x337376){const _0x900c79=_0xedfc6e;return db[_0x900c79('0x1c')][_0x900c79('0x2e')]({'where':{'id':_0x5a605e['params']['id']}})[_0x900c79('0x14')](function(_0x271432){const _0x18d6e1=_0x900c79;if(_0x271432)return _0x271432['addAgents'](_0x5a605e[_0x18d6e1('0x39')]['ids'],{'through':_[_0x18d6e1('0x43')](_0x5a605e[_0x18d6e1('0x39')],[_0x18d6e1('0x58'),'id'])})[_0x18d6e1('0x14')](function(_0x186c57){const _0x5048c8=_0x18d6e1;for(let _0x561ee1=0x0;_0x561ee1<_0x5a605e['body'][_0x5048c8('0x58')][_0x5048c8('0x67')];_0x561ee1+=0x1){socket[_0x5048c8('0x50')](_0x5048c8('0x13'),{'UserId':_0x5a605e[_0x5048c8('0x39')][_0x5048c8('0x58')][_0x561ee1],'CmListId':_0x5a605e[_0x5048c8('0x57')]['id']});}return _0x186c57;});})[_0x900c79('0x14')](respondWithResult(_0x337376,null))[_0x900c79('0x12')](handleError(_0x337376,null));},exports[_0xedfc6e('0x33')]=function(_0x32321e,_0x181967){const _0x2c4aa9=_0xedfc6e;return db[_0x2c4aa9('0x1c')][_0x2c4aa9('0x2e')]({'where':{'id':_0x32321e['params']['id']}})[_0x2c4aa9('0x14')](handleEntityNotFound(_0x181967,null))['then'](function(_0x5ec44f){const _0x463528=_0x2c4aa9;if(_0x5ec44f)return _0x5ec44f[_0x463528('0x33')](_0x32321e[_0x463528('0x34')][_0x463528('0x58')])[_0x463528('0x14')](function(){const _0x1e1560=_0x463528;if(_[_0x1e1560('0x2c')](_0x32321e[_0x1e1560('0x34')][_0x1e1560('0x58')]))for(let _0x4a22d6=0x0;_0x4a22d6<_0x32321e['query'][_0x1e1560('0x58')]['length'];_0x4a22d6+=0x1){socket[_0x1e1560('0x50')](_0x1e1560('0x7'),{'UserId':Number(_0x32321e[_0x1e1560('0x34')]['ids'][_0x4a22d6]),'CmListId':Number(_0x32321e['params']['id'])});}else socket[_0x1e1560('0x50')](_0x1e1560('0x7'),{'UserId':Number(_0x32321e[_0x1e1560('0x34')][_0x1e1560('0x58')]),'CmListId':Number(_0x32321e['params']['id'])});});})[_0x2c4aa9('0x14')](respondWithStatusCode(_0x181967,null))[_0x2c4aa9('0x12')](handleError(_0x181967,null));},exports[_0xedfc6e('0xc')]=function(_0x52d6d2,_0x4c30b4){const _0x580c56=_0xedfc6e;let _0x509b2b={};const _0x191ff1={};let _0x5f4d98,_0x21d920;return db[_0x580c56('0x1c')]['findOne']({'where':{'id':_0x52d6d2[_0x580c56('0x57')]['id']}})[_0x580c56('0x14')](handleEntityNotFound(_0x4c30b4,null))[_0x580c56('0x14')](function(_0x230e0f){const _0x518505=_0x580c56;if(_0x230e0f)return _0x5f4d98=_0x230e0f,_0x191ff1['model']=_[_0x518505('0x1f')](db[_0x518505('0x3f')][_0x518505('0x5c')]),_0x191ff1[_0x518505('0x34')]=_[_0x518505('0x1f')](_0x52d6d2[_0x518505('0x34')]),_0x191ff1[_0x518505('0x1a')]=_[_0x518505('0x3')](_0x191ff1[_0x518505('0x9')],_0x191ff1[_0x518505('0x34')]),_0x509b2b[_0x518505('0xe')]=_['intersection'](_0x191ff1[_0x518505('0x9')],qs[_0x518505('0x1d')](_0x52d6d2[_0x518505('0x34')][_0x518505('0x1d')])),_0x509b2b['attributes']=_0x509b2b[_0x518505('0xe')]['length']?_0x509b2b[_0x518505('0xe')]:_0x191ff1['model'],_0x509b2b[_0x518505('0x2')]=qs[_0x518505('0x2a')](_0x52d6d2[_0x518505('0x34')][_0x518505('0x2a')]),_0x509b2b[_0x518505('0x40')]=qs[_0x518505('0x1a')](_['pick'](_0x52d6d2['query'],_0x191ff1[_0x518505('0x1a')])),_0x52d6d2[_0x518505('0x34')][_0x518505('0x2b')]&&(_0x509b2b[_0x518505('0x40')]=_['merge'](_0x509b2b['where'],{[Op['or']]:_[_0x518505('0x73')](_0x509b2b[_0x518505('0xe')],function(_0x5416aa){const _0x2535dd=_0x518505,_0x256da0={};return _0x256da0[_0x5416aa]={[Op[_0x2535dd('0xf')]]:'%'+_0x52d6d2[_0x2535dd('0x34')][_0x2535dd('0x2b')]+'%'},_0x256da0;})})),_0x509b2b=_['merge']({},_0x509b2b,_0x52d6d2[_0x518505('0x6a')]),_0x5f4d98['getAgents'](_0x509b2b);})['then'](function(_0x26e192){const _0x374520=_0x580c56;if(_0x26e192)return _0x21d920=_0x26e192['length'],typeof _0x52d6d2['query'][_0x374520('0x56')]===_0x374520('0x60')&&(_0x509b2b[_0x374520('0x2d')]=qs['limit'](_0x52d6d2[_0x374520('0x34')][_0x374520('0x2d')]),_0x509b2b[_0x374520('0x53')]=qs['offset'](_0x52d6d2['query']['offset'])),_0x5f4d98[_0x374520('0xc')](_0x509b2b);})[_0x580c56('0x14')](function(_0xed1a41){if(_0xed1a41)return _0xed1a41?{'count':_0x21d920,'rows':_0xed1a41}:null;})[_0x580c56('0x14')](respondWithResult(_0x4c30b4,null))['catch'](handleError(_0x4c30b4,null));};
\ No newline at end of file