Built motion from commit 4a18b36e645f5fa4a517d36f9783bde259878164. Version 3.0.0...
[motion-next.git] / server / api / cmList / cmList.controller.js
index df2f5bc..f3c42f2 100644 (file)
@@ -1 +1 @@
-const a157_0x549d=['cm_contacts','fieldName','autoAssociation','VIRTUAL','../../rediscache','addContacts','ids','Content-Range','download','switch','order','sort','INTEGER','intersection','user','./cmList.socket','removeDispositions','include','userCmList:remove','nolimit','model','type','addColumn','cf_%d','map','merge','dataValues','addCustomFields','Malformed\x20request\x20syntax','rawAttributes','getAgents','like','writeFileSync','create','errors','getContacts','filter','findAll','UserProfileResource','status','where','count','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','attachment;\x20filename=','destroy','show','fields','emit','stack','role','format','set','error','text','UserProfileSection','getCustomFields','isEmpty','Lists','to-csv','update','limit','util','body','number','findOne','addAgents','name','offset','filters','Unable\x20to\x20retrieve\x20the\x20current\x20user','undefined','raw','rows','push','defaultValue','omit','catch','json','sequelize','cf_%s','api','join','keys','send','length','tags','concat','describe','options','attributes','isArray','params','CmList','get','sendStatus','CmCustomField','setHeader','removeAgents','then','Sequelize','pick','success','CustomFields','lodash','text/csv','Disposition','ListId','transaction','/tmp/list_%d_%s.csv','includeAll','query','Content-type','User'];(function(_0x4fa610,_0x549d54){const _0x4ad813=function(_0x44823a){while(--_0x44823a){_0x4fa610['push'](_0x4fa610['shift']());}};_0x4ad813(++_0x549d54);}(a157_0x549d,0x80));const a157_0x4ad8=function(_0x4fa610,_0x549d54){_0x4fa610=_0x4fa610-0x0;let _0x4ad813=a157_0x549d[_0x4fa610];return _0x4ad813;};const _0x11abdc=a157_0x4ad8;'use strict';const util=require(_0x11abdc('0x30')),fs=require('fs'),_=require(_0x11abdc('0x5a')),toCsv=require(_0x11abdc('0x2d')),{getSocket}=require(_0x11abdc('0x68')),socket=getSocket(),qs=require('../../components/parsers/qs'),logger=require('../../config/logger')(_0x11abdc('0x43')),db=require('../../mysqldb')['db'],{Op}=require(_0x11abdc('0x41'));require(_0x11abdc('0x1'))['register'](socket);function respondWithStatusCode(_0x44823a,_0x4e2d88){return _0x4e2d88=_0x4e2d88||0xcc,function(_0x554c91){const _0x2e2b1a=a157_0x4ad8;if(_0x554c91)return _0x44823a[_0x2e2b1a('0x51')](_0x4e2d88);return _0x44823a['status'](_0x4e2d88)['end']();};}function respondWithResult(_0x5930cb,_0x36a329){return _0x36a329=_0x36a329||0xc8,function(_0x4dd2d1){const _0x5e1a80=a157_0x4ad8;if(_0x4dd2d1)return _0x5930cb[_0x5e1a80('0x19')](_0x36a329)['json'](_0x4dd2d1);};}function respondWithFilteredResult(_0x493eb5,_0x5e2d1d){return function(_0x4754da){const _0x2a3195=a157_0x4ad8;if(_0x4754da){const _0x24a32e=_0x4754da['count'],_0xd8a1cc=_0x5e2d1d['offset'];let _0x4a1414=_0x5e2d1d[_0x2a3195('0x36')]+_0x5e2d1d[_0x2a3195('0x2f')],_0x5d3c74;return _0x4a1414>=_0x24a32e?(_0x4a1414=_0x24a32e,_0x5d3c74=0xc8):_0x5d3c74=0xce,_0x493eb5[_0x2a3195('0x19')](_0x5d3c74),_0x493eb5[_0x2a3195('0x26')](_0x2a3195('0x6b'),_0xd8a1cc+'-'+_0x4a1414+'/'+_0x24a32e)[_0x2a3195('0x40')](_0x4754da);}return null;};}function saveUpdates(_0x8f6d40){return function(_0x49e083){const _0x3b9a34=a157_0x4ad8;if(_0x49e083)return _0x49e083[_0x3b9a34('0x2e')](_0x8f6d40)[_0x3b9a34('0x55')](function(_0x497258){return _0x497258;});return null;};}function removeEntity(_0x1b632a){return function(_0x5e5ec9){const _0x4c415b=a157_0x4ad8;if(_0x5e5ec9)return _0x5e5ec9[_0x4c415b('0x1f')]()[_0x4c415b('0x55')](function(){const _0x1af3b5=_0x4c415b,_0x5bbd22=_0x5e5ec9['get']({'plain':!![]}),_0x4ffcdb=_0x1af3b5('0x2c');return db[_0x1af3b5('0x18')][_0x1af3b5('0x1f')]({'where':{'type':_0x4ffcdb,'resourceId':_0x5bbd22['id']}})[_0x1af3b5('0x55')](function(){return _0x5e5ec9;});})['then'](function(){const _0x371560=_0x4c415b;_0x1b632a[_0x371560('0x19')](0xcc)['end']();});};}function handleEntityNotFound(_0x349d4a){return function(_0x4b4616){const _0x5905d9=a157_0x4ad8;return!_0x4b4616&&_0x349d4a[_0x5905d9('0x51')](0x194),_0x4b4616;};}function handleError(_0x58bf49,_0x485008){return _0x485008=_0x485008||0x1f4,function(_0x3d9066){const _0x5772fb=a157_0x4ad8;logger[_0x5772fb('0x27')](_0x3d9066[_0x5772fb('0x23')]),_0x3d9066[_0x5772fb('0x35')]&&delete _0x3d9066['name'],_0x58bf49[_0x5772fb('0x19')](_0x485008)[_0x5772fb('0x46')](_0x3d9066);};}exports['index']=function(_0x4d2e0e,_0x3bd080){const _0x7f88a=_0x11abdc;let _0x5e122b={};const _0x34b82c={},_0x28a7e4={'count':0x0,'rows':[]},_0x5d10c1=_[_0x7f88a('0xa')](db[_0x7f88a('0x4f')][_0x7f88a('0xf')],function(_0x1b810f){const _0x2362bc=_0x7f88a;return{'name':_0x1b810f[_0x2362bc('0x65')],'type':_0x1b810f[_0x2362bc('0x7')]['key']};});_0x34b82c['model']=_[_0x7f88a('0xa')](_0x5d10c1,_0x7f88a('0x35')),_0x34b82c[_0x7f88a('0x61')]=_['keys'](_0x4d2e0e[_0x7f88a('0x61')]),_0x34b82c[_0x7f88a('0x37')]=_[_0x7f88a('0x71')](_0x34b82c[_0x7f88a('0x6')],_0x34b82c[_0x7f88a('0x61')]),_0x5e122b['attributes']=_[_0x7f88a('0x71')](_0x34b82c['model'],qs['fields'](_0x4d2e0e[_0x7f88a('0x61')][_0x7f88a('0x21')])),_0x5e122b[_0x7f88a('0x4c')]=_0x5e122b[_0x7f88a('0x4c')]['length']?_0x5e122b[_0x7f88a('0x4c')]:_0x34b82c[_0x7f88a('0x6')];typeof _0x4d2e0e['query'][_0x7f88a('0x5')]==='undefined'&&(_0x5e122b[_0x7f88a('0x2f')]=qs[_0x7f88a('0x2f')](_0x4d2e0e['query'][_0x7f88a('0x2f')]),_0x5e122b[_0x7f88a('0x36')]=qs[_0x7f88a('0x36')](_0x4d2e0e['query'][_0x7f88a('0x36')]));_0x5e122b['order']=qs['sort'](_0x4d2e0e[_0x7f88a('0x61')]['sort']),_0x5e122b[_0x7f88a('0x1a')]=qs['filters'](_[_0x7f88a('0x57')](_0x4d2e0e['query'],_0x34b82c['filters']),_0x5d10c1);_0x4d2e0e[_0x7f88a('0x61')][_0x7f88a('0x16')]&&(_0x5e122b[_0x7f88a('0x1a')]=_[_0x7f88a('0xb')](_0x5e122b['where'],{[Op['or']]:_[_0x7f88a('0xa')](_0x5d10c1,function(_0x11b8e2){const _0x1f38ab=_0x7f88a;if(_0x11b8e2[_0x1f38ab('0x7')]!==_0x1f38ab('0x67')){const _0xd0d6a1={};return _0xd0d6a1[_0x11b8e2['name']]={[Op['like']]:'%'+_0x4d2e0e[_0x1f38ab('0x61')]['filter']+'%'},_0xd0d6a1;}})}));_0x5e122b=_[_0x7f88a('0xb')]({},_0x5e122b,_0x4d2e0e[_0x7f88a('0x4b')]);const _0x15d6ec={'where':_0x5e122b[_0x7f88a('0x1a')]};return db[_0x7f88a('0x4f')][_0x7f88a('0x1b')](_0x15d6ec)[_0x7f88a('0x55')](function(_0x1cb89a){const _0x2e1b87=_0x7f88a;return _0x28a7e4['count']=_0x1cb89a,_0x4d2e0e['query'][_0x2e1b87('0x60')]&&(_0x5e122b[_0x2e1b87('0x3')]=[{'all':!![]}]),db['CmList'][_0x2e1b87('0x17')](_0x5e122b);})['then'](function(_0x2456f0){const _0x5ebbec=_0x7f88a;return _0x28a7e4[_0x5ebbec('0x3b')]=_0x2456f0,_0x28a7e4;})[_0x7f88a('0x55')](respondWithFilteredResult(_0x3bd080,_0x5e122b))[_0x7f88a('0x3f')](handleError(_0x3bd080,null));},exports[_0x11abdc('0x20')]=function(_0x4b5b6d,_0x38687d){const _0x5ac6ac=_0x11abdc;let _0x2030b9={'raw':![],'where':{'id':_0x4b5b6d[_0x5ac6ac('0x4e')]['id']}};const _0x1344cd={};return _0x1344cd['model']=_['keys'](db[_0x5ac6ac('0x4f')][_0x5ac6ac('0xf')]),_0x1344cd[_0x5ac6ac('0x61')]=_[_0x5ac6ac('0x45')](_0x4b5b6d[_0x5ac6ac('0x61')]),_0x1344cd[_0x5ac6ac('0x37')]=_[_0x5ac6ac('0x71')](_0x1344cd[_0x5ac6ac('0x6')],_0x1344cd[_0x5ac6ac('0x61')]),_0x2030b9[_0x5ac6ac('0x4c')]=_[_0x5ac6ac('0x71')](_0x1344cd[_0x5ac6ac('0x6')],qs[_0x5ac6ac('0x21')](_0x4b5b6d[_0x5ac6ac('0x61')][_0x5ac6ac('0x21')])),_0x2030b9[_0x5ac6ac('0x4c')]=_0x2030b9['attributes'][_0x5ac6ac('0x47')]?_0x2030b9['attributes']:_0x1344cd['model'],_0x4b5b6d[_0x5ac6ac('0x61')][_0x5ac6ac('0x60')]&&(_0x2030b9[_0x5ac6ac('0x3')]=[{'all':!![]}]),_0x2030b9=_[_0x5ac6ac('0xb')]({},_0x2030b9,_0x4b5b6d[_0x5ac6ac('0x4b')]),db[_0x5ac6ac('0x4f')][_0x5ac6ac('0x33')](_0x2030b9)[_0x5ac6ac('0x55')](handleEntityNotFound(_0x38687d,null))[_0x5ac6ac('0x55')](respondWithResult(_0x38687d,null))[_0x5ac6ac('0x3f')](handleError(_0x38687d,null));},exports[_0x11abdc('0x13')]=function(_0x529f1f,_0x10f4c8){const _0x2dc2de=_0x11abdc;return db[_0x2dc2de('0x4f')][_0x2dc2de('0x13')](_0x529f1f['body'],{})[_0x2dc2de('0x55')](function(_0x1b24fb){const _0x54ecf4=_0x2dc2de,_0x346412=_0x529f1f[_0x54ecf4('0x0')][_0x54ecf4('0x50')]({'plain':!![]});if(!_0x346412)throw new Error(_0x54ecf4('0x38'));if(_0x346412[_0x54ecf4('0x24')]===_0x54ecf4('0x0')){const _0x5bf4b5=_0x1b24fb['get']({'plain':!![]}),_0x205f24=_0x54ecf4('0x2c');return db[_0x54ecf4('0x29')]['findOne']({'where':{'name':_0x205f24,'userProfileId':_0x346412['userProfileId']},'raw':!![]})[_0x54ecf4('0x55')](function(_0x28c6f4){const _0x1d112a=_0x54ecf4;return _0x28c6f4&&_0x28c6f4[_0x1d112a('0x66')]===0x0?db[_0x1d112a('0x18')]['create']({'name':_0x5bf4b5[_0x1d112a('0x35')],'resourceId':_0x5bf4b5['id'],'type':_0x28c6f4[_0x1d112a('0x35')],'sectionId':_0x28c6f4['id']},{})[_0x1d112a('0x55')](function(){return _0x1b24fb;}):_0x1b24fb;})[_0x54ecf4('0x3f')](function(_0x53b365){const _0x2ce8c5=_0x54ecf4;logger[_0x2ce8c5('0x27')](_0x2ce8c5('0x1c'),_0x53b365);throw _0x53b365;});}return _0x1b24fb;})[_0x2dc2de('0x55')](respondWithResult(_0x10f4c8,0xc9))['catch'](handleError(_0x10f4c8,null));},exports[_0x11abdc('0x2e')]=function(_0x416240,_0x1a5ff2){const _0x3da3ff=_0x11abdc;return _0x416240[_0x3da3ff('0x31')]['id']&&delete _0x416240[_0x3da3ff('0x31')]['id'],db[_0x3da3ff('0x4f')][_0x3da3ff('0x33')]({'where':{'id':_0x416240[_0x3da3ff('0x4e')]['id']}})[_0x3da3ff('0x55')](handleEntityNotFound(_0x1a5ff2,null))[_0x3da3ff('0x55')](saveUpdates(_0x416240[_0x3da3ff('0x31')],null))[_0x3da3ff('0x55')](respondWithResult(_0x1a5ff2,null))['catch'](handleError(_0x1a5ff2,null));},exports[_0x11abdc('0x1f')]=function(_0x50cb16,_0x28bb20){const _0x3b9263=_0x11abdc;return db[_0x3b9263('0x4f')][_0x3b9263('0x33')]({'where':{'id':_0x50cb16[_0x3b9263('0x4e')]['id']}})[_0x3b9263('0x55')](handleEntityNotFound(_0x28bb20,null))['then'](removeEntity(_0x28bb20,null))[_0x3b9263('0x3f')](handleError(_0x28bb20,null));},exports[_0x11abdc('0x4a')]=function(_0x4f8969,_0x3ee2d8){const _0x28221a=_0x11abdc;return db['CmList'][_0x28221a('0x4a')]()[_0x28221a('0x55')](respondWithResult(_0x3ee2d8,null))[_0x28221a('0x3f')](handleError(_0x3ee2d8,null));},exports['addDisposition']=function(_0x255454,_0x56697c){const _0x3e3419=_0x11abdc;return _0x255454[_0x3e3419('0x31')]['id']&&delete _0x255454[_0x3e3419('0x31')]['id'],db[_0x3e3419('0x4f')][_0x3e3419('0x33')]({'where':{'id':_0x255454['params']['id']}})[_0x3e3419('0x55')](handleEntityNotFound(_0x56697c,null))[_0x3e3419('0x55')](function(_0x4ebaf3){const _0x591cae=_0x3e3419;if(_0x4ebaf3)return _0x255454['body'][_0x591cae('0x5d')]=_0x4ebaf3['id'],db['Disposition'][_0x591cae('0x13')](_0x255454[_0x591cae('0x31')]);})['then'](respondWithResult(_0x56697c,null))[_0x3e3419('0x3f')](handleError(_0x56697c,null));},exports['getDispositions']=function(_0x4bf870,_0x2acbb6){const _0x5ba61c=_0x11abdc;let _0xdbd6f1={'raw':![],'where':{}};const _0x3d220c={},_0x5c3a8d={'count':0x0,'rows':[]};return db[_0x5ba61c('0x4f')][_0x5ba61c('0x33')]({'where':{'id':_0x4bf870[_0x5ba61c('0x4e')]['id']}})[_0x5ba61c('0x55')](handleEntityNotFound(_0x2acbb6,null))[_0x5ba61c('0x55')](function(_0xab6430){const _0x32a0c1=_0x5ba61c;if(_0xab6430)return _0x3d220c[_0x32a0c1('0x6')]=_[_0x32a0c1('0x45')](db['Disposition'][_0x32a0c1('0xf')]),_0x3d220c[_0x32a0c1('0x61')]=_[_0x32a0c1('0x45')](_0x4bf870[_0x32a0c1('0x61')]),_0x3d220c[_0x32a0c1('0x37')]=_[_0x32a0c1('0x71')](_0x3d220c[_0x32a0c1('0x6')],_0x3d220c[_0x32a0c1('0x61')]),_0xdbd6f1[_0x32a0c1('0x4c')]=_[_0x32a0c1('0x71')](_0x3d220c[_0x32a0c1('0x6')],qs['fields'](_0x4bf870[_0x32a0c1('0x61')][_0x32a0c1('0x21')])),_0xdbd6f1[_0x32a0c1('0x4c')]=_0xdbd6f1[_0x32a0c1('0x4c')][_0x32a0c1('0x47')]?_0xdbd6f1[_0x32a0c1('0x4c')]:_0x3d220c[_0x32a0c1('0x6')],typeof _0x4bf870['query'][_0x32a0c1('0x5')]===_0x32a0c1('0x39')&&(_0xdbd6f1[_0x32a0c1('0x2f')]=qs[_0x32a0c1('0x2f')](_0x4bf870[_0x32a0c1('0x61')][_0x32a0c1('0x2f')]),_0xdbd6f1['offset']=qs[_0x32a0c1('0x36')](_0x4bf870[_0x32a0c1('0x61')][_0x32a0c1('0x36')])),_0xdbd6f1[_0x32a0c1('0x6e')]=qs[_0x32a0c1('0x6f')](_0x4bf870[_0x32a0c1('0x61')][_0x32a0c1('0x6f')]),_0xdbd6f1[_0x32a0c1('0x1a')]=qs[_0x32a0c1('0x37')](_['pick'](_0x4bf870[_0x32a0c1('0x61')],_0x3d220c[_0x32a0c1('0x37')])),_0xdbd6f1[_0x32a0c1('0x1a')][_0x32a0c1('0x5d')]=_0xab6430['id'],_0x4bf870[_0x32a0c1('0x61')][_0x32a0c1('0x16')]&&(_0xdbd6f1['where']=_['merge'](_0xdbd6f1[_0x32a0c1('0x1a')],{[Op['or']]:_[_0x32a0c1('0xa')](_0xdbd6f1[_0x32a0c1('0x4c')],function(_0x42e7e9){const _0x118e86=_0x32a0c1,_0x519cc5={};return _0x519cc5[_0x42e7e9]={[Op[_0x118e86('0x11')]]:'%'+_0x4bf870[_0x118e86('0x61')][_0x118e86('0x16')]+'%'},_0x519cc5;})})),_0xdbd6f1=_[_0x32a0c1('0xb')]({},_0xdbd6f1,_0x4bf870['options']),db[_0x32a0c1('0x5c')][_0x32a0c1('0x1b')]({'where':_0xdbd6f1['where']})[_0x32a0c1('0x55')](function(_0x408268){const _0x1e2ab2=_0x32a0c1;return _0x5c3a8d[_0x1e2ab2('0x1b')]=_0x408268,_0x4bf870[_0x1e2ab2('0x61')][_0x1e2ab2('0x60')]&&(_0xdbd6f1['include']=[{'all':!![]}]),db['Disposition'][_0x1e2ab2('0x17')](_0xdbd6f1);})[_0x32a0c1('0x55')](function(_0x253b52){const _0x38212c=_0x32a0c1;return _0x5c3a8d[_0x38212c('0x3b')]=_0x253b52,_0x5c3a8d;});})['then'](respondWithFilteredResult(_0x2acbb6,_0xdbd6f1))[_0x5ba61c('0x3f')](handleError(_0x2acbb6,null));},exports[_0x11abdc('0x2')]=function(_0x392a8d,_0x41b1c8){const _0x14df04=_0x11abdc;return db[_0x14df04('0x4f')][_0x14df04('0x33')]({'where':{'id':_0x392a8d['params']['id']}})[_0x14df04('0x55')](handleEntityNotFound(_0x41b1c8,null))['then'](function(_0x1fcab9){const _0x366d59=_0x14df04;if(_0x1fcab9)return _0x1fcab9['removeDispositions'](_0x392a8d[_0x366d59('0x61')][_0x366d59('0x6a')]);})['then'](respondWithStatusCode(_0x41b1c8,null))['catch'](handleError(_0x41b1c8,null));},exports[_0x11abdc('0x69')]=function(_0x2f3271,_0x5c3de7){const _0x304a89=_0x11abdc;return db[_0x304a89('0x4f')]['findOne']({'where':{'id':_0x2f3271[_0x304a89('0x4e')]['id']}})[_0x304a89('0x55')](handleEntityNotFound(_0x5c3de7,null))[_0x304a89('0x55')](function(_0x1d47aa){const _0x2aae9a=_0x304a89;if(_0x1d47aa){const _0x7c018d=[],_0x5e29b3={'success':[],'errors':[]};return db[_0x2aae9a('0x1d')][_0x2aae9a('0x4a')]()[_0x2aae9a('0x55')](function(_0x22173a){const _0x2f3c43=_0x2aae9a;_0x2f3271[_0x2f3c43('0x31')][_0x2f3c43('0x48')]&&_[_0x2f3c43('0x4d')](_0x2f3271[_0x2f3c43('0x31')][_0x2f3c43('0x48')])?_0x2f3271[_0x2f3c43('0x31')]['tags']['length']?_0x2f3271[_0x2f3c43('0x31')]['tags']=_0x2f3271['body'][_0x2f3c43('0x48')][_0x2f3c43('0x44')](';')+';':_0x2f3271[_0x2f3c43('0x31')]['tags']=null:_0x2f3271[_0x2f3c43('0x31')][_0x2f3c43('0x48')]=null;if(_0x2f3271[_0x2f3c43('0x31')]&&_[_0x2f3c43('0x4d')](_0x2f3271[_0x2f3c43('0x31')])){for(let _0x2145f2=0x0;_0x2145f2<_0x2f3271[_0x2f3c43('0x31')][_0x2f3c43('0x47')];_0x2145f2+=0x1){_0x2f3271['body'][_0x2145f2][_0x2f3c43('0x5d')]=_0x2f3271[_0x2f3c43('0x4e')]['id'],_0x7c018d['push'](_0x2f3271[_0x2f3c43('0x31')][_0x2145f2]);}return Promise['each'](_0x7c018d,function(_0x566c1a){const _0xdeb384=_0x2f3c43;return db[_0xdeb384('0x1d')][_0xdeb384('0x13')](_['omit'](_0x566c1a,[_0xdeb384('0x6a'),'id'])||{},{'fields':_[_0xdeb384('0x45')](_0x22173a),'raw':!![]})[_0xdeb384('0x55')](function(_0x4eca31){const _0x20c2c9=_0xdeb384;_0x5e29b3[_0x20c2c9('0x58')][_0x20c2c9('0x3c')](_0x4eca31[_0x20c2c9('0xc')]);})[_0xdeb384('0x3f')](function(_0x3c7436){const _0xf3194=_0xdeb384;_0x5e29b3[_0xf3194('0x14')][_0xf3194('0x3c')]({'data':_0x566c1a,'error':_0x3c7436['message']});});})[_0x2f3c43('0x55')](function(){return _0x5e29b3;})[_0x2f3c43('0x3f')](function(_0x3bf41f){return _0x3bf41f;});}else _0x5c3de7[_0x2f3c43('0x19')](0x190)['json']({'message':_0x2f3c43('0xe')});});}})[_0x304a89('0x55')](respondWithResult(_0x5c3de7,null))[_0x304a89('0x3f')](handleError(_0x5c3de7,null));},exports[_0x11abdc('0x15')]=function(_0x5eb52e,_0x5c0d83){const _0x4c03c8=_0x11abdc;let _0x46c924;return db[_0x4c03c8('0x4f')][_0x4c03c8('0x33')]({'where':{'id':_0x5eb52e[_0x4c03c8('0x4e')]['id']},'include':[{'model':db[_0x4c03c8('0x52')],'as':_0x4c03c8('0x59')}]})[_0x4c03c8('0x55')](handleEntityNotFound(_0x5c0d83,null))[_0x4c03c8('0x55')](function(_0x3ff955){const _0x29f37a=_0x4c03c8;if(_0x3ff955)return _0x46c924=_0x3ff955,db[_0x29f37a('0x1d')]['rawAttributes'];})['then'](function(_0x43897d){const _0x5299d6=_0x4c03c8;if(_0x43897d){let _0x2e7200={};const _0x37e661={};return _0x37e661['model']=_[_0x5299d6('0x49')](_[_0x5299d6('0x45')](_0x43897d),_[_0x5299d6('0xa')](_0x46c924[_0x5299d6('0x59')],function(_0x5d8e31){const _0x5923e2=_0x5299d6;return util['format'](_0x5923e2('0x9'),_0x5d8e31['id']);})),_0x37e661['query']=_[_0x5299d6('0x45')](_0x5eb52e[_0x5299d6('0x61')]),_0x37e661[_0x5299d6('0x37')]=_[_0x5299d6('0x71')](_0x37e661[_0x5299d6('0x6')],_0x37e661[_0x5299d6('0x61')]),_0x2e7200[_0x5299d6('0x4c')]=_['intersection'](_0x37e661['model'],qs['fields'](_0x5eb52e['query'][_0x5299d6('0x21')])),_0x2e7200['attributes']=_0x2e7200[_0x5299d6('0x4c')][_0x5299d6('0x47')]?_0x2e7200[_0x5299d6('0x4c')]:_0x37e661[_0x5299d6('0x6')],typeof _0x5eb52e[_0x5299d6('0x61')][_0x5299d6('0x5')]===_0x5299d6('0x39')&&(_0x2e7200[_0x5299d6('0x2f')]=qs['limit'](_0x5eb52e[_0x5299d6('0x61')]['limit']),_0x2e7200[_0x5299d6('0x36')]=qs[_0x5299d6('0x36')](_0x5eb52e[_0x5299d6('0x61')][_0x5299d6('0x36')])),_0x2e7200[_0x5299d6('0x6e')]=qs['sort'](_0x5eb52e[_0x5299d6('0x61')][_0x5299d6('0x6f')]),_0x2e7200[_0x5299d6('0x1a')]=qs[_0x5299d6('0x37')](_[_0x5299d6('0x57')](_0x5eb52e[_0x5299d6('0x61')],_0x37e661[_0x5299d6('0x37')])),_0x2e7200[_0x5299d6('0x3a')]=!![],_0x5eb52e[_0x5299d6('0x61')][_0x5299d6('0x16')]&&(_0x2e7200[_0x5299d6('0x1a')]=_[_0x5299d6('0xb')](_0x2e7200[_0x5299d6('0x1a')],{[Op['or']]:_['map'](_0x2e7200[_0x5299d6('0x4c')],function(_0x413cd8){const _0x12223c=_0x5299d6,_0x270c90={};return _0x270c90[_0x413cd8]={[Op[_0x12223c('0x11')]]:'%'+_0x5eb52e[_0x12223c('0x61')][_0x12223c('0x16')]+'%'},_0x270c90;})})),_0x2e7200=_[_0x5299d6('0xb')]({},_0x2e7200,_0x5eb52e[_0x5299d6('0x4b')]),_0x46c924[_0x5299d6('0x15')](_0x2e7200);}})[_0x4c03c8('0x55')](respondWithResult(_0x5c0d83,null))[_0x4c03c8('0x3f')](handleError(_0x5c0d83,null));},exports['getContactsCsv']=function(_0xfbbe61,_0x19016e){const _0x27c870=_0x11abdc;let _0x347e12;return db[_0x27c870('0x4f')][_0x27c870('0x33')]({'where':{'id':_0xfbbe61[_0x27c870('0x4e')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x27c870('0x55')](handleEntityNotFound(_0x19016e,null))['then'](function(_0x43df8e){const _0x24243b=_0x27c870;if(_0x43df8e)return _0x347e12=_0x43df8e,db[_0x24243b('0x1d')][_0x24243b('0xf')];})[_0x27c870('0x55')](function(_0x14ffd5){const _0x118c51=_0x27c870;if(_0x14ffd5){let _0x51e2fb={};const _0x127748={};return _0x127748[_0x118c51('0x6')]=_[_0x118c51('0x49')](_['keys'](_0x14ffd5),_[_0x118c51('0xa')](_0x347e12[_0x118c51('0x59')],function(_0x221bfb){const _0x5531df=_0x118c51;return util[_0x5531df('0x25')](_0x5531df('0x9'),_0x221bfb['id']);})),_0x127748[_0x118c51('0x61')]=_[_0x118c51('0x45')](_0xfbbe61[_0x118c51('0x61')]),_0x127748[_0x118c51('0x37')]=_[_0x118c51('0x71')](_0x127748[_0x118c51('0x6')],_0x127748[_0x118c51('0x61')]),_0x51e2fb[_0x118c51('0x4c')]=_[_0x118c51('0x71')](_0x127748['model'],qs[_0x118c51('0x21')](_0xfbbe61['query']['fields'])),_0x51e2fb[_0x118c51('0x4c')]=_0x51e2fb[_0x118c51('0x4c')]['length']?_0x51e2fb[_0x118c51('0x4c')]:_0x127748[_0x118c51('0x6')],typeof _0xfbbe61[_0x118c51('0x61')][_0x118c51('0x5')]==='undefined'&&(_0x51e2fb[_0x118c51('0x2f')]=qs['limit'](_0xfbbe61[_0x118c51('0x61')][_0x118c51('0x2f')]),_0x51e2fb[_0x118c51('0x36')]=qs[_0x118c51('0x36')](_0xfbbe61[_0x118c51('0x61')]['offset'])),_0x51e2fb[_0x118c51('0x6e')]=qs[_0x118c51('0x6f')](_0xfbbe61[_0x118c51('0x61')][_0x118c51('0x6f')]),_0x51e2fb[_0x118c51('0x1a')]=qs[_0x118c51('0x37')](_[_0x118c51('0x57')](_0xfbbe61[_0x118c51('0x61')],_0x127748[_0x118c51('0x37')])),_0x51e2fb['raw']=!![],_0xfbbe61['query']['filter']&&(_0x51e2fb['where']=_[_0x118c51('0xb')](_0x51e2fb[_0x118c51('0x1a')],{[Op['or']]:_[_0x118c51('0xa')](_0x51e2fb[_0x118c51('0x4c')],function(_0x8e5886){const _0xee7528=_0x118c51,_0x4b2ca5={};return _0x4b2ca5[_0x8e5886]={[Op[_0xee7528('0x11')]]:'%'+_0xfbbe61[_0xee7528('0x61')]['filter']+'%'},_0x4b2ca5;})})),_0x51e2fb=_[_0x118c51('0xb')]({},_0x51e2fb,_0xfbbe61[_0x118c51('0x4b')]),_0x347e12[_0x118c51('0x15')](_0x51e2fb);}})[_0x27c870('0x55')](function(_0x474d73){const _0x43977a=_0x27c870;if(!_[_0x43977a('0x2b')](_0x474d73)){const _0x255bf7=toCsv(_0x474d73),_0x341ecb=Date['now']();return fs[_0x43977a('0x12')](util[_0x43977a('0x25')](_0x43977a('0x5f'),_0x347e12['id'],_0x341ecb),_0x255bf7),_0x19016e[_0x43977a('0x53')]('Content-disposition',_0x43977a('0x1e')+util[_0x43977a('0x25')]('list_%d_%s.csv',_0x347e12['id'],_0x341ecb)),_0x19016e[_0x43977a('0x53')](_0x43977a('0x62'),_0x43977a('0x5b')),_0x19016e[_0x43977a('0x6c')](util[_0x43977a('0x25')](_0x43977a('0x5f'),_0x347e12['id'],_0x341ecb));}else return _0x19016e[_0x43977a('0x51')](0xcc);})[_0x27c870('0x3f')](handleError(_0x19016e,null));},exports['addCustomField']=function(_0x4623ea,_0x76ea23){const _0x25fb15=_0x11abdc;let _0x42fe85;return delete _0x4623ea['body']['id'],db[_0x25fb15('0x4f')][_0x25fb15('0x33')]({'where':{'id':_0x4623ea[_0x25fb15('0x4e')]['id']}})[_0x25fb15('0x55')](handleEntityNotFound(_0x76ea23,null))['then'](function(_0x4d61c6){const _0x304f4f=_0x25fb15;if(_0x4d61c6)return db[_0x304f4f('0x41')][_0x304f4f('0x5e')](function(_0x2f6a86){const _0x2b7291=_0x304f4f;return db['CmCustomField']['create'](_0x4623ea[_0x2b7291('0x31')],{'transaction':_0x2f6a86})[_0x2b7291('0x55')](function(_0x22811f){const _0x48b3e3=_0x2b7291;return _0x42fe85=_0x22811f,_0x4d61c6[_0x48b3e3('0xd')](_0x22811f,{'transaction':_0x2f6a86});})[_0x2b7291('0x55')](function(){const _0x5c7748=_0x2b7291,_0x3a9987={'type':db[_0x5c7748('0x56')]['TEXT'],'transaction':_0x2f6a86};switch(_0x4623ea[_0x5c7748('0x31')][_0x5c7748('0x7')]){case _0x5c7748('0x28'):_0x3a9987['type']=db['Sequelize']['TEXT'];break;case _0x5c7748('0x32'):_0x3a9987[_0x5c7748('0x7')]=db[_0x5c7748('0x56')][_0x5c7748('0x70')];break;case _0x5c7748('0x6d'):_0x3a9987[_0x5c7748('0x7')]=db['Sequelize']['BOOLEAN'],_0x3a9987[_0x5c7748('0x3d')]=![];break;default:}return db[_0x5c7748('0x41')]['queryInterface'][_0x5c7748('0x8')](_0x5c7748('0x64'),util['format'](_0x5c7748('0x42'),_0x42fe85['id']),_0x3a9987);})['then'](function(){return _0x42fe85;});});})[_0x25fb15('0x55')](respondWithResult(_0x76ea23,null))[_0x25fb15('0x3f')](handleError(_0x76ea23,null));},exports[_0x11abdc('0x2a')]=function(_0x57c783,_0x5c9406){const _0x3c07de=_0x11abdc;let _0x354b89={};const _0x4a8d16={};return db[_0x3c07de('0x4f')][_0x3c07de('0x33')]({'where':{'id':_0x57c783[_0x3c07de('0x4e')]['id']}})[_0x3c07de('0x55')](handleEntityNotFound(_0x5c9406,null))[_0x3c07de('0x55')](function(_0xf7729d){const _0x29ccff=_0x3c07de;if(_0xf7729d)return _0x4a8d16[_0x29ccff('0x6')]=_[_0x29ccff('0x45')](db[_0x29ccff('0x52')][_0x29ccff('0xf')]),_0x4a8d16['query']=_[_0x29ccff('0x45')](_0x57c783[_0x29ccff('0x61')]),_0x4a8d16[_0x29ccff('0x37')]=_[_0x29ccff('0x71')](_0x4a8d16[_0x29ccff('0x6')],_0x4a8d16[_0x29ccff('0x61')]),_0x354b89[_0x29ccff('0x4c')]=_['intersection'](_0x4a8d16['model'],qs[_0x29ccff('0x21')](_0x57c783[_0x29ccff('0x61')][_0x29ccff('0x21')])),_0x354b89[_0x29ccff('0x4c')]=_0x354b89[_0x29ccff('0x4c')][_0x29ccff('0x47')]?_0x354b89[_0x29ccff('0x4c')]:_0x4a8d16[_0x29ccff('0x6')],_0x354b89[_0x29ccff('0x6e')]=qs[_0x29ccff('0x6f')](_0x57c783[_0x29ccff('0x61')][_0x29ccff('0x6f')]),_0x354b89[_0x29ccff('0x1a')]=qs[_0x29ccff('0x37')](_[_0x29ccff('0x57')](_0x57c783[_0x29ccff('0x61')],_0x4a8d16[_0x29ccff('0x37')])),_0x354b89[_0x29ccff('0x1a')]=_['merge'](_0x354b89[_0x29ccff('0x1a')],{[Op['or']]:[{'ListId':_0xf7729d['id']},{'ListId':null}]}),_0x57c783['query'][_0x29ccff('0x16')]&&(_0x354b89[_0x29ccff('0x1a')]=_['merge'](_0x354b89['where'],{[Op['or']]:_['map'](_0x354b89['attributes'],function(_0x32cc16){const _0x3827d9=_0x29ccff,_0x25ff8f={};return _0x25ff8f[_0x32cc16]={[Op[_0x3827d9('0x11')]]:'%'+_0x57c783['query'][_0x3827d9('0x16')]+'%'},_0x25ff8f;})})),_0x354b89=_['merge']({},_0x354b89,_0x57c783[_0x29ccff('0x4b')]),db[_0x29ccff('0x52')]['findAndCountAll'](_0x354b89);})[_0x3c07de('0x55')](respondWithResult(_0x5c9406,null))[_0x3c07de('0x3f')](handleError(_0x5c9406,null));},exports[_0x11abdc('0x34')]=function(_0x21d00a,_0x40b983){const _0x1a075b=_0x11abdc;return db[_0x1a075b('0x4f')][_0x1a075b('0x33')]({'where':{'id':_0x21d00a[_0x1a075b('0x4e')]['id']}})[_0x1a075b('0x55')](function(_0x36b877){const _0x41b838=_0x1a075b;if(_0x36b877)return _0x36b877[_0x41b838('0x34')](_0x21d00a[_0x41b838('0x31')][_0x41b838('0x6a')],{'through':_[_0x41b838('0x3e')](_0x21d00a[_0x41b838('0x31')],[_0x41b838('0x6a'),'id'])})[_0x41b838('0x55')](function(_0x4f781d){const _0x45e6aa=_0x41b838;for(let _0x5024b8=0x0;_0x5024b8<_0x21d00a[_0x45e6aa('0x31')][_0x45e6aa('0x6a')][_0x45e6aa('0x47')];_0x5024b8+=0x1){socket[_0x45e6aa('0x22')]('userCmList:save',{'UserId':_0x21d00a[_0x45e6aa('0x31')][_0x45e6aa('0x6a')][_0x5024b8],'CmListId':_0x21d00a[_0x45e6aa('0x4e')]['id']});}return _0x4f781d;});})[_0x1a075b('0x55')](respondWithResult(_0x40b983,null))[_0x1a075b('0x3f')](handleError(_0x40b983,null));},exports[_0x11abdc('0x54')]=function(_0x1b8892,_0x40342f){const _0x5b8399=_0x11abdc;return db[_0x5b8399('0x4f')][_0x5b8399('0x33')]({'where':{'id':_0x1b8892['params']['id']}})[_0x5b8399('0x55')](handleEntityNotFound(_0x40342f,null))[_0x5b8399('0x55')](function(_0x247370){const _0x5718e2=_0x5b8399;if(_0x247370)return _0x247370[_0x5718e2('0x54')](_0x1b8892[_0x5718e2('0x61')][_0x5718e2('0x6a')])[_0x5718e2('0x55')](function(){const _0x107c3f=_0x5718e2;if(_['isArray'](_0x1b8892[_0x107c3f('0x61')]['ids']))for(let _0x24b994=0x0;_0x24b994<_0x1b8892[_0x107c3f('0x61')]['ids']['length'];_0x24b994+=0x1){socket['emit'](_0x107c3f('0x4'),{'UserId':Number(_0x1b8892[_0x107c3f('0x61')][_0x107c3f('0x6a')][_0x24b994]),'CmListId':Number(_0x1b8892[_0x107c3f('0x4e')]['id'])});}else socket['emit'](_0x107c3f('0x4'),{'UserId':Number(_0x1b8892['query']['ids']),'CmListId':Number(_0x1b8892[_0x107c3f('0x4e')]['id'])});});})[_0x5b8399('0x55')](respondWithStatusCode(_0x40342f,null))['catch'](handleError(_0x40342f,null));},exports[_0x11abdc('0x10')]=function(_0x2daa01,_0x253589){const _0x3f5d46=_0x11abdc;let _0x35e9a7={};const _0x4f4ada={};let _0x56660e,_0x44eba8;return db['CmList'][_0x3f5d46('0x33')]({'where':{'id':_0x2daa01[_0x3f5d46('0x4e')]['id']}})['then'](handleEntityNotFound(_0x253589,null))[_0x3f5d46('0x55')](function(_0x5bf78f){const _0x23398f=_0x3f5d46;if(_0x5bf78f)return _0x56660e=_0x5bf78f,_0x4f4ada[_0x23398f('0x6')]=_[_0x23398f('0x45')](db[_0x23398f('0x63')][_0x23398f('0xf')]),_0x4f4ada[_0x23398f('0x61')]=_[_0x23398f('0x45')](_0x2daa01[_0x23398f('0x61')]),_0x4f4ada[_0x23398f('0x37')]=_[_0x23398f('0x71')](_0x4f4ada['model'],_0x4f4ada[_0x23398f('0x61')]),_0x35e9a7['attributes']=_[_0x23398f('0x71')](_0x4f4ada[_0x23398f('0x6')],qs[_0x23398f('0x21')](_0x2daa01['query'][_0x23398f('0x21')])),_0x35e9a7[_0x23398f('0x4c')]=_0x35e9a7[_0x23398f('0x4c')]['length']?_0x35e9a7[_0x23398f('0x4c')]:_0x4f4ada[_0x23398f('0x6')],_0x35e9a7['order']=qs[_0x23398f('0x6f')](_0x2daa01[_0x23398f('0x61')]['sort']),_0x35e9a7[_0x23398f('0x1a')]=qs[_0x23398f('0x37')](_[_0x23398f('0x57')](_0x2daa01[_0x23398f('0x61')],_0x4f4ada['filters'])),_0x2daa01[_0x23398f('0x61')][_0x23398f('0x16')]&&(_0x35e9a7[_0x23398f('0x1a')]=_[_0x23398f('0xb')](_0x35e9a7[_0x23398f('0x1a')],{[Op['or']]:_['map'](_0x35e9a7[_0x23398f('0x4c')],function(_0x6e1b67){const _0x244dea=_0x23398f,_0x179bdf={};return _0x179bdf[_0x6e1b67]={[Op['like']]:'%'+_0x2daa01[_0x244dea('0x61')][_0x244dea('0x16')]+'%'},_0x179bdf;})})),_0x35e9a7=_[_0x23398f('0xb')]({},_0x35e9a7,_0x2daa01[_0x23398f('0x4b')]),_0x56660e['getAgents'](_0x35e9a7);})[_0x3f5d46('0x55')](function(_0x2e52a9){const _0x218f06=_0x3f5d46;if(_0x2e52a9)return _0x44eba8=_0x2e52a9[_0x218f06('0x47')],typeof _0x2daa01[_0x218f06('0x61')][_0x218f06('0x5')]==='undefined'&&(_0x35e9a7[_0x218f06('0x2f')]=qs[_0x218f06('0x2f')](_0x2daa01['query'][_0x218f06('0x2f')]),_0x35e9a7[_0x218f06('0x36')]=qs['offset'](_0x2daa01['query'][_0x218f06('0x36')])),_0x56660e[_0x218f06('0x10')](_0x35e9a7);})[_0x3f5d46('0x55')](function(_0x4692d1){if(_0x4692d1)return _0x4692d1?{'count':_0x44eba8,'rows':_0x4692d1}:null;})[_0x3f5d46('0x55')](respondWithResult(_0x253589,null))[_0x3f5d46('0x3f')](handleError(_0x253589,null));};
\ No newline at end of file
+const a157_0x1b27=['destroy','ListId','rows','getCustomFields','fieldName','sort','stack','keys','tags','undefined','error','addColumn','create','catch','success','./cmList.socket','transaction','describe','findAll','../../components/parsers/qs','rawAttributes','length','INTEGER','omit','TEXT','order','getContacts','fields','findOne','like','../../mysqldb','text/csv','cf_%s','text','offset','lodash','isEmpty','Disposition','Content-Range','Lists','getDispositions','where','BOOLEAN','status','UserProfileSection','end','get','push','update','../../rediscache','isArray','addDisposition','query','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sendStatus','queryInterface','nolimit','raw','role','options','concat','ids','show','model','getAgents','body','message','filter','json','intersection','autoAssociation','join','includeAll','removeAgents','index','sequelize','addCustomFields','removeDispositions','Unable\x20to\x20retrieve\x20the\x20current\x20user','limit','name','CustomFields','Sequelize','user','pick','VIRTUAL','to-csv','type','/tmp/list_%d_%s.csv','attachment;\x20filename=','CmCustomField','util','findAndCountAll','writeFileSync','userCmList:save','api','dataValues','addCustomField','attributes','CmList','merge','format','emit','download','UserProfileResource','then','count','params','map','userProfileId','setHeader','list_%d_%s.csv','CmContact','now','Content-disposition','cf_%d','../../config/logger','filters','all','userCmList:remove'];(function(_0x18b5b3,_0x1b27f6){const _0x35699f=function(_0x2452a1){while(--_0x2452a1){_0x18b5b3['push'](_0x18b5b3['shift']());}};_0x35699f(++_0x1b27f6);}(a157_0x1b27,0x72));const a157_0x3569=function(_0x18b5b3,_0x1b27f6){_0x18b5b3=_0x18b5b3-0x0;let _0x35699f=a157_0x1b27[_0x18b5b3];return _0x35699f;};const _0x30b7b2=a157_0x3569;'use strict';const util=require(_0x30b7b2('0x61')),fs=require('fs'),_=require(_0x30b7b2('0x29')),toCsv=require(_0x30b7b2('0x5c')),{getSocket}=require(_0x30b7b2('0x37')),socket=getSocket(),qs=require(_0x30b7b2('0x19')),logger=require(_0x30b7b2('0x2'))(_0x30b7b2('0x65')),db=require(_0x30b7b2('0x24'))['db'],{Op}=require(_0x30b7b2('0x51'));require(_0x30b7b2('0x15'))['register'](socket);function respondWithStatusCode(_0x2452a1,_0x4ebe46){return _0x4ebe46=_0x4ebe46||0xcc,function(_0x1f11a8){const _0x5ee8b1=a157_0x3569;if(_0x1f11a8)return _0x2452a1[_0x5ee8b1('0x3c')](_0x4ebe46);return _0x2452a1['status'](_0x4ebe46)[_0x5ee8b1('0x33')]();};}function respondWithResult(_0x2e30b0,_0xd2fa5c){return _0xd2fa5c=_0xd2fa5c||0xc8,function(_0x1afd41){const _0x4a7474=a157_0x3569;if(_0x1afd41)return _0x2e30b0[_0x4a7474('0x31')](_0xd2fa5c)['json'](_0x1afd41);};}function respondWithFilteredResult(_0x20b3ad,_0x5d56f3){return function(_0x4c3775){const _0x234704=a157_0x3569;if(_0x4c3775){const _0x538f7a=_0x4c3775[_0x234704('0x70')],_0x4a2885=_0x5d56f3[_0x234704('0x28')];let _0x26ad35=_0x5d56f3[_0x234704('0x28')]+_0x5d56f3[_0x234704('0x55')],_0x3657d6;return _0x26ad35>=_0x538f7a?(_0x26ad35=_0x538f7a,_0x3657d6=0xc8):_0x3657d6=0xce,_0x20b3ad[_0x234704('0x31')](_0x3657d6),_0x20b3ad['set'](_0x234704('0x2c'),_0x4a2885+'-'+_0x26ad35+'/'+_0x538f7a)[_0x234704('0x4a')](_0x4c3775);}return null;};}function saveUpdates(_0x226307){return function(_0x5308df){const _0x6e238c=a157_0x3569;if(_0x5308df)return _0x5308df['update'](_0x226307)[_0x6e238c('0x6f')](function(_0xc7bdc7){return _0xc7bdc7;});return null;};}function removeEntity(_0x4c6649){return function(_0x4dae22){const _0x2f5896=a157_0x3569;if(_0x4dae22)return _0x4dae22[_0x2f5896('0x6')]()['then'](function(){const _0x4616a2=_0x2f5896,_0x4d521f=_0x4dae22[_0x4616a2('0x34')]({'plain':!![]}),_0x4e1e4a='Lists';return db[_0x4616a2('0x6e')][_0x4616a2('0x6')]({'where':{'type':_0x4e1e4a,'resourceId':_0x4d521f['id']}})['then'](function(){return _0x4dae22;});})[_0x2f5896('0x6f')](function(){const _0x537b50=_0x2f5896;_0x4c6649[_0x537b50('0x31')](0xcc)[_0x537b50('0x33')]();});};}function handleEntityNotFound(_0x46263a){return function(_0x396f80){const _0x516cfb=a157_0x3569;return!_0x396f80&&_0x46263a[_0x516cfb('0x3c')](0x194),_0x396f80;};}function handleError(_0x4a3b8d,_0x532bc0){return _0x532bc0=_0x532bc0||0x1f4,function(_0x183e6f){const _0x20ea17=a157_0x3569;logger[_0x20ea17('0x10')](_0x183e6f[_0x20ea17('0xc')]),_0x183e6f['name']&&delete _0x183e6f[_0x20ea17('0x56')],_0x4a3b8d['status'](_0x532bc0)['send'](_0x183e6f);};}exports[_0x30b7b2('0x50')]=function(_0x414d22,_0x1cf107){const _0x25deef=_0x30b7b2;let _0x534169={};const _0x22284b={},_0x20fba5={'count':0x0,'rows':[]},_0xd4b741=_[_0x25deef('0x72')](db[_0x25deef('0x69')]['rawAttributes'],function(_0x5d7d1b){const _0x3bad5e=_0x25deef;return{'name':_0x5d7d1b[_0x3bad5e('0xa')],'type':_0x5d7d1b[_0x3bad5e('0x5d')]['key']};});_0x22284b[_0x25deef('0x45')]=_[_0x25deef('0x72')](_0xd4b741,_0x25deef('0x56')),_0x22284b[_0x25deef('0x3a')]=_[_0x25deef('0xd')](_0x414d22[_0x25deef('0x3a')]),_0x22284b['filters']=_[_0x25deef('0x4b')](_0x22284b[_0x25deef('0x45')],_0x22284b[_0x25deef('0x3a')]),_0x534169[_0x25deef('0x68')]=_['intersection'](_0x22284b[_0x25deef('0x45')],qs[_0x25deef('0x21')](_0x414d22[_0x25deef('0x3a')][_0x25deef('0x21')])),_0x534169['attributes']=_0x534169[_0x25deef('0x68')][_0x25deef('0x1b')]?_0x534169['attributes']:_0x22284b[_0x25deef('0x45')];typeof _0x414d22['query'][_0x25deef('0x3e')]===_0x25deef('0xf')&&(_0x534169['limit']=qs[_0x25deef('0x55')](_0x414d22[_0x25deef('0x3a')][_0x25deef('0x55')]),_0x534169[_0x25deef('0x28')]=qs[_0x25deef('0x28')](_0x414d22['query'][_0x25deef('0x28')]));_0x534169[_0x25deef('0x1f')]=qs[_0x25deef('0xb')](_0x414d22['query'][_0x25deef('0xb')]),_0x534169[_0x25deef('0x2f')]=qs['filters'](_[_0x25deef('0x5a')](_0x414d22[_0x25deef('0x3a')],_0x22284b[_0x25deef('0x3')]),_0xd4b741);_0x414d22['query']['filter']&&(_0x534169[_0x25deef('0x2f')]=_['merge'](_0x534169['where'],{[Op['or']]:_[_0x25deef('0x72')](_0xd4b741,function(_0x465573){const _0x2ab44a=_0x25deef;if(_0x465573[_0x2ab44a('0x5d')]!==_0x2ab44a('0x5b')){const _0x55d4cc={};return _0x55d4cc[_0x465573[_0x2ab44a('0x56')]]={[Op[_0x2ab44a('0x23')]]:'%'+_0x414d22[_0x2ab44a('0x3a')][_0x2ab44a('0x49')]+'%'},_0x55d4cc;}})}));_0x534169=_[_0x25deef('0x6a')]({},_0x534169,_0x414d22[_0x25deef('0x41')]);const _0x272bf1={'where':_0x534169[_0x25deef('0x2f')]};return db[_0x25deef('0x69')][_0x25deef('0x70')](_0x272bf1)[_0x25deef('0x6f')](function(_0x151f92){const _0x584702=_0x25deef;return _0x20fba5[_0x584702('0x70')]=_0x151f92,_0x414d22['query'][_0x584702('0x4e')]&&(_0x534169['include']=[{'all':!![]}]),db[_0x584702('0x69')]['findAll'](_0x534169);})[_0x25deef('0x6f')](function(_0x3ec65f){const _0x333b84=_0x25deef;return _0x20fba5[_0x333b84('0x8')]=_0x3ec65f,_0x20fba5;})[_0x25deef('0x6f')](respondWithFilteredResult(_0x1cf107,_0x534169))[_0x25deef('0x13')](handleError(_0x1cf107,null));},exports[_0x30b7b2('0x44')]=function(_0x5d125f,_0x56b150){const _0x33bbaf=_0x30b7b2;let _0x1d395b={'raw':![],'where':{'id':_0x5d125f[_0x33bbaf('0x71')]['id']}};const _0x51e950={};return _0x51e950[_0x33bbaf('0x45')]=_[_0x33bbaf('0xd')](db[_0x33bbaf('0x69')]['rawAttributes']),_0x51e950[_0x33bbaf('0x3a')]=_['keys'](_0x5d125f[_0x33bbaf('0x3a')]),_0x51e950['filters']=_[_0x33bbaf('0x4b')](_0x51e950[_0x33bbaf('0x45')],_0x51e950[_0x33bbaf('0x3a')]),_0x1d395b[_0x33bbaf('0x68')]=_[_0x33bbaf('0x4b')](_0x51e950['model'],qs[_0x33bbaf('0x21')](_0x5d125f['query'][_0x33bbaf('0x21')])),_0x1d395b[_0x33bbaf('0x68')]=_0x1d395b['attributes'][_0x33bbaf('0x1b')]?_0x1d395b[_0x33bbaf('0x68')]:_0x51e950[_0x33bbaf('0x45')],_0x5d125f[_0x33bbaf('0x3a')][_0x33bbaf('0x4e')]&&(_0x1d395b['include']=[{'all':!![]}]),_0x1d395b=_[_0x33bbaf('0x6a')]({},_0x1d395b,_0x5d125f[_0x33bbaf('0x41')]),db['CmList']['findOne'](_0x1d395b)['then'](handleEntityNotFound(_0x56b150,null))[_0x33bbaf('0x6f')](respondWithResult(_0x56b150,null))[_0x33bbaf('0x13')](handleError(_0x56b150,null));},exports[_0x30b7b2('0x12')]=function(_0x4d05cd,_0x89eafc){const _0x1c9a3b=_0x30b7b2;return db[_0x1c9a3b('0x69')]['create'](_0x4d05cd['body'],{})[_0x1c9a3b('0x6f')](function(_0x5a9062){const _0x25d357=_0x1c9a3b,_0xdee2c7=_0x4d05cd[_0x25d357('0x59')][_0x25d357('0x34')]({'plain':!![]});if(!_0xdee2c7)throw new Error(_0x25d357('0x54'));if(_0xdee2c7[_0x25d357('0x40')]==='user'){const _0x271c7d=_0x5a9062[_0x25d357('0x34')]({'plain':!![]}),_0x307533=_0x25d357('0x2d');return db[_0x25d357('0x32')][_0x25d357('0x22')]({'where':{'name':_0x307533,'userProfileId':_0xdee2c7[_0x25d357('0x73')]},'raw':!![]})['then'](function(_0x23eafe){const _0x10a507=_0x25d357;return _0x23eafe&&_0x23eafe[_0x10a507('0x4c')]===0x0?db['UserProfileResource'][_0x10a507('0x12')]({'name':_0x271c7d[_0x10a507('0x56')],'resourceId':_0x271c7d['id'],'type':_0x23eafe['name'],'sectionId':_0x23eafe['id']},{})['then'](function(){return _0x5a9062;}):_0x5a9062;})[_0x25d357('0x13')](function(_0x5c788b){const _0x3ee717=_0x25d357;logger[_0x3ee717('0x10')](_0x3ee717('0x3b'),_0x5c788b);throw _0x5c788b;});}return _0x5a9062;})[_0x1c9a3b('0x6f')](respondWithResult(_0x89eafc,0xc9))[_0x1c9a3b('0x13')](handleError(_0x89eafc,null));},exports[_0x30b7b2('0x36')]=function(_0x57f296,_0x756481){const _0xd7f6b5=_0x30b7b2;return _0x57f296[_0xd7f6b5('0x47')]['id']&&delete _0x57f296[_0xd7f6b5('0x47')]['id'],db[_0xd7f6b5('0x69')]['findOne']({'where':{'id':_0x57f296[_0xd7f6b5('0x71')]['id']}})['then'](handleEntityNotFound(_0x756481,null))[_0xd7f6b5('0x6f')](saveUpdates(_0x57f296[_0xd7f6b5('0x47')],null))[_0xd7f6b5('0x6f')](respondWithResult(_0x756481,null))[_0xd7f6b5('0x13')](handleError(_0x756481,null));},exports[_0x30b7b2('0x6')]=function(_0x4201b3,_0x1557ab){const _0xd1b942=_0x30b7b2;return db[_0xd1b942('0x69')]['findOne']({'where':{'id':_0x4201b3[_0xd1b942('0x71')]['id']}})[_0xd1b942('0x6f')](handleEntityNotFound(_0x1557ab,null))[_0xd1b942('0x6f')](removeEntity(_0x1557ab,null))[_0xd1b942('0x13')](handleError(_0x1557ab,null));},exports[_0x30b7b2('0x17')]=function(_0x1de410,_0x63d8cc){const _0x48c532=_0x30b7b2;return db['CmList'][_0x48c532('0x17')]()[_0x48c532('0x6f')](respondWithResult(_0x63d8cc,null))[_0x48c532('0x13')](handleError(_0x63d8cc,null));},exports[_0x30b7b2('0x39')]=function(_0x3a66c5,_0x24842e){const _0x44627f=_0x30b7b2;return _0x3a66c5[_0x44627f('0x47')]['id']&&delete _0x3a66c5[_0x44627f('0x47')]['id'],db[_0x44627f('0x69')]['findOne']({'where':{'id':_0x3a66c5[_0x44627f('0x71')]['id']}})[_0x44627f('0x6f')](handleEntityNotFound(_0x24842e,null))['then'](function(_0x138be2){const _0x3cd31c=_0x44627f;if(_0x138be2)return _0x3a66c5[_0x3cd31c('0x47')][_0x3cd31c('0x7')]=_0x138be2['id'],db[_0x3cd31c('0x2b')][_0x3cd31c('0x12')](_0x3a66c5['body']);})[_0x44627f('0x6f')](respondWithResult(_0x24842e,null))[_0x44627f('0x13')](handleError(_0x24842e,null));},exports[_0x30b7b2('0x2e')]=function(_0x3952a0,_0x21a949){const _0x2ee422=_0x30b7b2;let _0x2fab48={'raw':![],'where':{}};const _0x47bcfc={},_0x292daa={'count':0x0,'rows':[]};return db[_0x2ee422('0x69')][_0x2ee422('0x22')]({'where':{'id':_0x3952a0['params']['id']}})[_0x2ee422('0x6f')](handleEntityNotFound(_0x21a949,null))[_0x2ee422('0x6f')](function(_0x286b7a){const _0x176f72=_0x2ee422;if(_0x286b7a)return _0x47bcfc[_0x176f72('0x45')]=_[_0x176f72('0xd')](db['Disposition']['rawAttributes']),_0x47bcfc[_0x176f72('0x3a')]=_[_0x176f72('0xd')](_0x3952a0['query']),_0x47bcfc[_0x176f72('0x3')]=_['intersection'](_0x47bcfc[_0x176f72('0x45')],_0x47bcfc[_0x176f72('0x3a')]),_0x2fab48[_0x176f72('0x68')]=_[_0x176f72('0x4b')](_0x47bcfc['model'],qs[_0x176f72('0x21')](_0x3952a0[_0x176f72('0x3a')][_0x176f72('0x21')])),_0x2fab48[_0x176f72('0x68')]=_0x2fab48[_0x176f72('0x68')][_0x176f72('0x1b')]?_0x2fab48[_0x176f72('0x68')]:_0x47bcfc[_0x176f72('0x45')],typeof _0x3952a0[_0x176f72('0x3a')][_0x176f72('0x3e')]===_0x176f72('0xf')&&(_0x2fab48[_0x176f72('0x55')]=qs[_0x176f72('0x55')](_0x3952a0['query'][_0x176f72('0x55')]),_0x2fab48['offset']=qs[_0x176f72('0x28')](_0x3952a0['query'][_0x176f72('0x28')])),_0x2fab48[_0x176f72('0x1f')]=qs['sort'](_0x3952a0[_0x176f72('0x3a')][_0x176f72('0xb')]),_0x2fab48['where']=qs[_0x176f72('0x3')](_['pick'](_0x3952a0['query'],_0x47bcfc[_0x176f72('0x3')])),_0x2fab48[_0x176f72('0x2f')][_0x176f72('0x7')]=_0x286b7a['id'],_0x3952a0['query'][_0x176f72('0x49')]&&(_0x2fab48[_0x176f72('0x2f')]=_[_0x176f72('0x6a')](_0x2fab48[_0x176f72('0x2f')],{[Op['or']]:_[_0x176f72('0x72')](_0x2fab48['attributes'],function(_0x5c2b7a){const _0x36afa4=_0x176f72,_0x37caa3={};return _0x37caa3[_0x5c2b7a]={[Op[_0x36afa4('0x23')]]:'%'+_0x3952a0[_0x36afa4('0x3a')]['filter']+'%'},_0x37caa3;})})),_0x2fab48=_[_0x176f72('0x6a')]({},_0x2fab48,_0x3952a0[_0x176f72('0x41')]),db[_0x176f72('0x2b')][_0x176f72('0x70')]({'where':_0x2fab48[_0x176f72('0x2f')]})[_0x176f72('0x6f')](function(_0x464e04){const _0x3b933d=_0x176f72;return _0x292daa[_0x3b933d('0x70')]=_0x464e04,_0x3952a0[_0x3b933d('0x3a')]['includeAll']&&(_0x2fab48['include']=[{'all':!![]}]),db[_0x3b933d('0x2b')][_0x3b933d('0x18')](_0x2fab48);})[_0x176f72('0x6f')](function(_0x238994){return _0x292daa['rows']=_0x238994,_0x292daa;});})[_0x2ee422('0x6f')](respondWithFilteredResult(_0x21a949,_0x2fab48))[_0x2ee422('0x13')](handleError(_0x21a949,null));},exports[_0x30b7b2('0x53')]=function(_0x1fdf95,_0x1316bd){const _0x1a6c49=_0x30b7b2;return db['CmList'][_0x1a6c49('0x22')]({'where':{'id':_0x1fdf95[_0x1a6c49('0x71')]['id']}})['then'](handleEntityNotFound(_0x1316bd,null))['then'](function(_0x25772a){const _0x2b617d=_0x1a6c49;if(_0x25772a)return _0x25772a[_0x2b617d('0x53')](_0x1fdf95['query'][_0x2b617d('0x43')]);})[_0x1a6c49('0x6f')](respondWithStatusCode(_0x1316bd,null))[_0x1a6c49('0x13')](handleError(_0x1316bd,null));},exports['addContacts']=function(_0xc72798,_0x298fa9){const _0x135535=_0x30b7b2;return db['CmList']['findOne']({'where':{'id':_0xc72798['params']['id']}})[_0x135535('0x6f')](handleEntityNotFound(_0x298fa9,null))[_0x135535('0x6f')](function(_0x46d8a3){const _0x3fc347=_0x135535;if(_0x46d8a3){const _0x426a7a=[],_0x5bb168={'success':[],'errors':[]};return db[_0x3fc347('0x76')][_0x3fc347('0x17')]()[_0x3fc347('0x6f')](function(_0x5b3c78){const _0x2c0306=_0x3fc347;_0xc72798[_0x2c0306('0x47')][_0x2c0306('0xe')]&&_[_0x2c0306('0x38')](_0xc72798[_0x2c0306('0x47')][_0x2c0306('0xe')])?_0xc72798[_0x2c0306('0x47')]['tags'][_0x2c0306('0x1b')]?_0xc72798[_0x2c0306('0x47')][_0x2c0306('0xe')]=_0xc72798[_0x2c0306('0x47')][_0x2c0306('0xe')][_0x2c0306('0x4d')](';')+';':_0xc72798['body']['tags']=null:_0xc72798[_0x2c0306('0x47')]['tags']=null;if(_0xc72798[_0x2c0306('0x47')]&&_[_0x2c0306('0x38')](_0xc72798[_0x2c0306('0x47')])){for(let _0x4c3857=0x0;_0x4c3857<_0xc72798['body']['length'];_0x4c3857+=0x1){_0xc72798['body'][_0x4c3857][_0x2c0306('0x7')]=_0xc72798[_0x2c0306('0x71')]['id'],_0x426a7a[_0x2c0306('0x35')](_0xc72798['body'][_0x4c3857]);}return Promise[_0x2c0306('0x4')](_0x426a7a[_0x2c0306('0x72')](_0x4acb24=>{const _0xd4b737=_0x2c0306;return db[_0xd4b737('0x76')]['create'](_[_0xd4b737('0x1d')](_0x4acb24,['ids','id'])||{},{'fields':_[_0xd4b737('0xd')](_0x5b3c78),'raw':!![]})[_0xd4b737('0x6f')](function(_0x4c6f53){const _0x7970d7=_0xd4b737;_0x5bb168[_0x7970d7('0x14')][_0x7970d7('0x35')](_0x4c6f53[_0x7970d7('0x66')]);})[_0xd4b737('0x13')](function(_0x4b8366){const _0x4a65f0=_0xd4b737;_0x5bb168['errors'][_0x4a65f0('0x35')]({'data':_0x4acb24,'error':_0x4b8366[_0x4a65f0('0x48')]});});}))[_0x2c0306('0x6f')](function(){return _0x5bb168;})[_0x2c0306('0x13')](function(_0x17cdde){return _0x17cdde;});}else _0x298fa9[_0x2c0306('0x31')](0x190)[_0x2c0306('0x4a')]({'message':'Malformed\x20request\x20syntax'});});}})['then'](respondWithResult(_0x298fa9,null))[_0x135535('0x13')](handleError(_0x298fa9,null));},exports[_0x30b7b2('0x20')]=function(_0x2078b5,_0x1734d2){const _0x5c67b2=_0x30b7b2;let _0x45f30a;return db['CmList'][_0x5c67b2('0x22')]({'where':{'id':_0x2078b5[_0x5c67b2('0x71')]['id']},'include':[{'model':db[_0x5c67b2('0x60')],'as':_0x5c67b2('0x57')}]})[_0x5c67b2('0x6f')](handleEntityNotFound(_0x1734d2,null))['then'](function(_0x493489){const _0x167500=_0x5c67b2;if(_0x493489)return _0x45f30a=_0x493489,db[_0x167500('0x76')][_0x167500('0x1a')];})[_0x5c67b2('0x6f')](function(_0x455bfb){const _0x403837=_0x5c67b2;if(_0x455bfb){let _0x53fd4e={};const _0x2d9e60={};return _0x2d9e60[_0x403837('0x45')]=_[_0x403837('0x42')](_[_0x403837('0xd')](_0x455bfb),_[_0x403837('0x72')](_0x45f30a[_0x403837('0x57')],function(_0x3e523d){const _0x185a64=_0x403837;return util[_0x185a64('0x6b')]('cf_%d',_0x3e523d['id']);})),_0x2d9e60[_0x403837('0x3a')]=_[_0x403837('0xd')](_0x2078b5[_0x403837('0x3a')]),_0x2d9e60['filters']=_[_0x403837('0x4b')](_0x2d9e60[_0x403837('0x45')],_0x2d9e60[_0x403837('0x3a')]),_0x53fd4e[_0x403837('0x68')]=_[_0x403837('0x4b')](_0x2d9e60[_0x403837('0x45')],qs[_0x403837('0x21')](_0x2078b5[_0x403837('0x3a')][_0x403837('0x21')])),_0x53fd4e['attributes']=_0x53fd4e[_0x403837('0x68')]['length']?_0x53fd4e[_0x403837('0x68')]:_0x2d9e60[_0x403837('0x45')],typeof _0x2078b5[_0x403837('0x3a')][_0x403837('0x3e')]===_0x403837('0xf')&&(_0x53fd4e['limit']=qs['limit'](_0x2078b5[_0x403837('0x3a')]['limit']),_0x53fd4e['offset']=qs[_0x403837('0x28')](_0x2078b5[_0x403837('0x3a')][_0x403837('0x28')])),_0x53fd4e[_0x403837('0x1f')]=qs[_0x403837('0xb')](_0x2078b5[_0x403837('0x3a')]['sort']),_0x53fd4e[_0x403837('0x2f')]=qs[_0x403837('0x3')](_[_0x403837('0x5a')](_0x2078b5[_0x403837('0x3a')],_0x2d9e60['filters'])),_0x53fd4e['raw']=!![],_0x2078b5[_0x403837('0x3a')][_0x403837('0x49')]&&(_0x53fd4e[_0x403837('0x2f')]=_[_0x403837('0x6a')](_0x53fd4e[_0x403837('0x2f')],{[Op['or']]:_[_0x403837('0x72')](_0x53fd4e[_0x403837('0x68')],function(_0x579016){const _0x33fb67=_0x403837,_0x1e1e86={};return _0x1e1e86[_0x579016]={[Op[_0x33fb67('0x23')]]:'%'+_0x2078b5[_0x33fb67('0x3a')][_0x33fb67('0x49')]+'%'},_0x1e1e86;})})),_0x53fd4e=_[_0x403837('0x6a')]({},_0x53fd4e,_0x2078b5[_0x403837('0x41')]),_0x45f30a[_0x403837('0x20')](_0x53fd4e);}})['then'](respondWithResult(_0x1734d2,null))[_0x5c67b2('0x13')](handleError(_0x1734d2,null));},exports['getContactsCsv']=function(_0x17959c,_0x270117){const _0x69a45a=_0x30b7b2;let _0x227fa3;return db['CmList'][_0x69a45a('0x22')]({'where':{'id':_0x17959c[_0x69a45a('0x71')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x69a45a('0x57')}]})[_0x69a45a('0x6f')](handleEntityNotFound(_0x270117,null))[_0x69a45a('0x6f')](function(_0x21319c){const _0x578417=_0x69a45a;if(_0x21319c)return _0x227fa3=_0x21319c,db['CmContact'][_0x578417('0x1a')];})[_0x69a45a('0x6f')](function(_0x2c5e2e){const _0x106010=_0x69a45a;if(_0x2c5e2e){let _0x2c8891={};const _0x199302={};return _0x199302[_0x106010('0x45')]=_[_0x106010('0x42')](_[_0x106010('0xd')](_0x2c5e2e),_[_0x106010('0x72')](_0x227fa3['CustomFields'],function(_0xdf08c3){const _0x24bf35=_0x106010;return util[_0x24bf35('0x6b')](_0x24bf35('0x1'),_0xdf08c3['id']);})),_0x199302[_0x106010('0x3a')]=_[_0x106010('0xd')](_0x17959c['query']),_0x199302[_0x106010('0x3')]=_[_0x106010('0x4b')](_0x199302['model'],_0x199302[_0x106010('0x3a')]),_0x2c8891['attributes']=_[_0x106010('0x4b')](_0x199302[_0x106010('0x45')],qs[_0x106010('0x21')](_0x17959c['query'][_0x106010('0x21')])),_0x2c8891[_0x106010('0x68')]=_0x2c8891['attributes'][_0x106010('0x1b')]?_0x2c8891[_0x106010('0x68')]:_0x199302[_0x106010('0x45')],typeof _0x17959c[_0x106010('0x3a')][_0x106010('0x3e')]===_0x106010('0xf')&&(_0x2c8891[_0x106010('0x55')]=qs['limit'](_0x17959c[_0x106010('0x3a')][_0x106010('0x55')]),_0x2c8891[_0x106010('0x28')]=qs[_0x106010('0x28')](_0x17959c[_0x106010('0x3a')]['offset'])),_0x2c8891['order']=qs[_0x106010('0xb')](_0x17959c[_0x106010('0x3a')][_0x106010('0xb')]),_0x2c8891[_0x106010('0x2f')]=qs['filters'](_[_0x106010('0x5a')](_0x17959c[_0x106010('0x3a')],_0x199302['filters'])),_0x2c8891[_0x106010('0x3f')]=!![],_0x17959c['query'][_0x106010('0x49')]&&(_0x2c8891['where']=_[_0x106010('0x6a')](_0x2c8891[_0x106010('0x2f')],{[Op['or']]:_[_0x106010('0x72')](_0x2c8891[_0x106010('0x68')],function(_0x1a67a8){const _0x58c279=_0x106010,_0x3b160c={};return _0x3b160c[_0x1a67a8]={[Op[_0x58c279('0x23')]]:'%'+_0x17959c[_0x58c279('0x3a')][_0x58c279('0x49')]+'%'},_0x3b160c;})})),_0x2c8891=_['merge']({},_0x2c8891,_0x17959c['options']),_0x227fa3[_0x106010('0x20')](_0x2c8891);}})[_0x69a45a('0x6f')](function(_0xac650){const _0x5b6498=_0x69a45a;if(!_[_0x5b6498('0x2a')](_0xac650)){const _0x33f937=toCsv(_0xac650),_0x1b0c9c=Date[_0x5b6498('0x77')]();return fs[_0x5b6498('0x63')](util[_0x5b6498('0x6b')](_0x5b6498('0x5e'),_0x227fa3['id'],_0x1b0c9c),_0x33f937),_0x270117[_0x5b6498('0x74')](_0x5b6498('0x0'),_0x5b6498('0x5f')+util[_0x5b6498('0x6b')](_0x5b6498('0x75'),_0x227fa3['id'],_0x1b0c9c)),_0x270117[_0x5b6498('0x74')]('Content-type',_0x5b6498('0x25')),_0x270117[_0x5b6498('0x6d')](util['format']('/tmp/list_%d_%s.csv',_0x227fa3['id'],_0x1b0c9c));}else return _0x270117[_0x5b6498('0x3c')](0xcc);})[_0x69a45a('0x13')](handleError(_0x270117,null));},exports[_0x30b7b2('0x67')]=function(_0x89aa4a,_0x2f2f40){const _0x247a9a=_0x30b7b2;let _0x19bd24;return delete _0x89aa4a[_0x247a9a('0x47')]['id'],db[_0x247a9a('0x69')][_0x247a9a('0x22')]({'where':{'id':_0x89aa4a[_0x247a9a('0x71')]['id']}})[_0x247a9a('0x6f')](handleEntityNotFound(_0x2f2f40,null))[_0x247a9a('0x6f')](function(_0x440ce7){const _0x33f4a5=_0x247a9a;if(_0x440ce7)return db[_0x33f4a5('0x51')][_0x33f4a5('0x16')](function(_0x21e8b2){const _0xe588d6=_0x33f4a5;return db[_0xe588d6('0x60')][_0xe588d6('0x12')](_0x89aa4a['body'],{'transaction':_0x21e8b2})[_0xe588d6('0x6f')](function(_0x1bbace){const _0x5e4cf2=_0xe588d6;return _0x19bd24=_0x1bbace,_0x440ce7[_0x5e4cf2('0x52')](_0x1bbace,{'transaction':_0x21e8b2});})[_0xe588d6('0x6f')](function(){const _0x1271a5=_0xe588d6,_0x57395c={'type':db[_0x1271a5('0x58')][_0x1271a5('0x1e')],'transaction':_0x21e8b2};switch(_0x89aa4a['body'][_0x1271a5('0x5d')]){case _0x1271a5('0x27'):_0x57395c[_0x1271a5('0x5d')]=db[_0x1271a5('0x58')]['TEXT'];break;case'number':_0x57395c[_0x1271a5('0x5d')]=db[_0x1271a5('0x58')][_0x1271a5('0x1c')];break;case'switch':_0x57395c[_0x1271a5('0x5d')]=db['Sequelize'][_0x1271a5('0x30')],_0x57395c['defaultValue']=![];break;default:}return db[_0x1271a5('0x51')][_0x1271a5('0x3d')][_0x1271a5('0x11')]('cm_contacts',util[_0x1271a5('0x6b')](_0x1271a5('0x26'),_0x19bd24['id']),_0x57395c);})[_0xe588d6('0x6f')](function(){return _0x19bd24;});});})[_0x247a9a('0x6f')](respondWithResult(_0x2f2f40,null))['catch'](handleError(_0x2f2f40,null));},exports[_0x30b7b2('0x9')]=function(_0x1b5593,_0x5ddcb1){const _0x474642=_0x30b7b2;let _0x2856e1={};const _0x26ccc3={};return db['CmList'][_0x474642('0x22')]({'where':{'id':_0x1b5593[_0x474642('0x71')]['id']}})['then'](handleEntityNotFound(_0x5ddcb1,null))[_0x474642('0x6f')](function(_0x18d315){const _0x1c6b42=_0x474642;if(_0x18d315)return _0x26ccc3['model']=_[_0x1c6b42('0xd')](db[_0x1c6b42('0x60')][_0x1c6b42('0x1a')]),_0x26ccc3[_0x1c6b42('0x3a')]=_['keys'](_0x1b5593[_0x1c6b42('0x3a')]),_0x26ccc3[_0x1c6b42('0x3')]=_['intersection'](_0x26ccc3['model'],_0x26ccc3[_0x1c6b42('0x3a')]),_0x2856e1[_0x1c6b42('0x68')]=_[_0x1c6b42('0x4b')](_0x26ccc3[_0x1c6b42('0x45')],qs['fields'](_0x1b5593['query'][_0x1c6b42('0x21')])),_0x2856e1[_0x1c6b42('0x68')]=_0x2856e1['attributes'][_0x1c6b42('0x1b')]?_0x2856e1[_0x1c6b42('0x68')]:_0x26ccc3[_0x1c6b42('0x45')],_0x2856e1[_0x1c6b42('0x1f')]=qs['sort'](_0x1b5593['query'][_0x1c6b42('0xb')]),_0x2856e1[_0x1c6b42('0x2f')]=qs[_0x1c6b42('0x3')](_[_0x1c6b42('0x5a')](_0x1b5593[_0x1c6b42('0x3a')],_0x26ccc3[_0x1c6b42('0x3')])),_0x2856e1[_0x1c6b42('0x2f')]=_['merge'](_0x2856e1[_0x1c6b42('0x2f')],{[Op['or']]:[{'ListId':_0x18d315['id']},{'ListId':null}]}),_0x1b5593[_0x1c6b42('0x3a')][_0x1c6b42('0x49')]&&(_0x2856e1[_0x1c6b42('0x2f')]=_[_0x1c6b42('0x6a')](_0x2856e1[_0x1c6b42('0x2f')],{[Op['or']]:_[_0x1c6b42('0x72')](_0x2856e1[_0x1c6b42('0x68')],function(_0x4f4bc3){const _0xeca740=_0x1c6b42,_0x57b427={};return _0x57b427[_0x4f4bc3]={[Op[_0xeca740('0x23')]]:'%'+_0x1b5593[_0xeca740('0x3a')][_0xeca740('0x49')]+'%'},_0x57b427;})})),_0x2856e1=_[_0x1c6b42('0x6a')]({},_0x2856e1,_0x1b5593['options']),db[_0x1c6b42('0x60')][_0x1c6b42('0x62')](_0x2856e1);})[_0x474642('0x6f')](respondWithResult(_0x5ddcb1,null))[_0x474642('0x13')](handleError(_0x5ddcb1,null));},exports['addAgents']=function(_0x844e5a,_0x2b733e){const _0x22a7ff=_0x30b7b2;return db[_0x22a7ff('0x69')][_0x22a7ff('0x22')]({'where':{'id':_0x844e5a[_0x22a7ff('0x71')]['id']}})[_0x22a7ff('0x6f')](function(_0x426c2b){const _0x3d9273=_0x22a7ff;if(_0x426c2b)return _0x426c2b['addAgents'](_0x844e5a[_0x3d9273('0x47')][_0x3d9273('0x43')],{'through':_[_0x3d9273('0x1d')](_0x844e5a[_0x3d9273('0x47')],[_0x3d9273('0x43'),'id'])})[_0x3d9273('0x6f')](function(_0x5cf5b7){const _0x562f35=_0x3d9273;for(let _0x552256=0x0;_0x552256<_0x844e5a[_0x562f35('0x47')][_0x562f35('0x43')][_0x562f35('0x1b')];_0x552256+=0x1){socket['emit'](_0x562f35('0x64'),{'UserId':_0x844e5a[_0x562f35('0x47')][_0x562f35('0x43')][_0x552256],'CmListId':_0x844e5a[_0x562f35('0x71')]['id']});}return _0x5cf5b7;});})[_0x22a7ff('0x6f')](respondWithResult(_0x2b733e,null))[_0x22a7ff('0x13')](handleError(_0x2b733e,null));},exports[_0x30b7b2('0x4f')]=function(_0x369120,_0x2cf642){const _0x23548b=_0x30b7b2;return db[_0x23548b('0x69')][_0x23548b('0x22')]({'where':{'id':_0x369120['params']['id']}})[_0x23548b('0x6f')](handleEntityNotFound(_0x2cf642,null))[_0x23548b('0x6f')](function(_0xa688a9){const _0x171bbc=_0x23548b;if(_0xa688a9)return _0xa688a9[_0x171bbc('0x4f')](_0x369120[_0x171bbc('0x3a')][_0x171bbc('0x43')])[_0x171bbc('0x6f')](function(){const _0xd80fa0=_0x171bbc;if(_['isArray'](_0x369120[_0xd80fa0('0x3a')][_0xd80fa0('0x43')]))for(let _0xe0cfe2=0x0;_0xe0cfe2<_0x369120[_0xd80fa0('0x3a')][_0xd80fa0('0x43')]['length'];_0xe0cfe2+=0x1){socket[_0xd80fa0('0x6c')]('userCmList:remove',{'UserId':Number(_0x369120[_0xd80fa0('0x3a')][_0xd80fa0('0x43')][_0xe0cfe2]),'CmListId':Number(_0x369120['params']['id'])});}else socket[_0xd80fa0('0x6c')](_0xd80fa0('0x5'),{'UserId':Number(_0x369120[_0xd80fa0('0x3a')]['ids']),'CmListId':Number(_0x369120[_0xd80fa0('0x71')]['id'])});});})[_0x23548b('0x6f')](respondWithStatusCode(_0x2cf642,null))[_0x23548b('0x13')](handleError(_0x2cf642,null));},exports['getAgents']=function(_0x1eda1b,_0x5286d9){const _0x58eac7=_0x30b7b2;let _0x44f8a0={};const _0x32987c={};let _0x4faa9e,_0x5eb739;return db[_0x58eac7('0x69')]['findOne']({'where':{'id':_0x1eda1b[_0x58eac7('0x71')]['id']}})[_0x58eac7('0x6f')](handleEntityNotFound(_0x5286d9,null))[_0x58eac7('0x6f')](function(_0x283efd){const _0x3ac7ad=_0x58eac7;if(_0x283efd)return _0x4faa9e=_0x283efd,_0x32987c[_0x3ac7ad('0x45')]=_['keys'](db['User'][_0x3ac7ad('0x1a')]),_0x32987c['query']=_[_0x3ac7ad('0xd')](_0x1eda1b[_0x3ac7ad('0x3a')]),_0x32987c[_0x3ac7ad('0x3')]=_['intersection'](_0x32987c[_0x3ac7ad('0x45')],_0x32987c[_0x3ac7ad('0x3a')]),_0x44f8a0[_0x3ac7ad('0x68')]=_['intersection'](_0x32987c['model'],qs['fields'](_0x1eda1b[_0x3ac7ad('0x3a')][_0x3ac7ad('0x21')])),_0x44f8a0['attributes']=_0x44f8a0[_0x3ac7ad('0x68')][_0x3ac7ad('0x1b')]?_0x44f8a0[_0x3ac7ad('0x68')]:_0x32987c[_0x3ac7ad('0x45')],_0x44f8a0[_0x3ac7ad('0x1f')]=qs[_0x3ac7ad('0xb')](_0x1eda1b[_0x3ac7ad('0x3a')][_0x3ac7ad('0xb')]),_0x44f8a0[_0x3ac7ad('0x2f')]=qs['filters'](_[_0x3ac7ad('0x5a')](_0x1eda1b[_0x3ac7ad('0x3a')],_0x32987c['filters'])),_0x1eda1b['query'][_0x3ac7ad('0x49')]&&(_0x44f8a0['where']=_['merge'](_0x44f8a0['where'],{[Op['or']]:_[_0x3ac7ad('0x72')](_0x44f8a0[_0x3ac7ad('0x68')],function(_0x16bfcc){const _0x3cd02b=_0x3ac7ad,_0x20fe37={};return _0x20fe37[_0x16bfcc]={[Op[_0x3cd02b('0x23')]]:'%'+_0x1eda1b[_0x3cd02b('0x3a')]['filter']+'%'},_0x20fe37;})})),_0x44f8a0=_[_0x3ac7ad('0x6a')]({},_0x44f8a0,_0x1eda1b[_0x3ac7ad('0x41')]),_0x4faa9e[_0x3ac7ad('0x46')](_0x44f8a0);})[_0x58eac7('0x6f')](function(_0x3e0673){const _0x3d0961=_0x58eac7;if(_0x3e0673)return _0x5eb739=_0x3e0673['length'],typeof _0x1eda1b[_0x3d0961('0x3a')][_0x3d0961('0x3e')]==='undefined'&&(_0x44f8a0['limit']=qs[_0x3d0961('0x55')](_0x1eda1b[_0x3d0961('0x3a')][_0x3d0961('0x55')]),_0x44f8a0[_0x3d0961('0x28')]=qs[_0x3d0961('0x28')](_0x1eda1b[_0x3d0961('0x3a')][_0x3d0961('0x28')])),_0x4faa9e[_0x3d0961('0x46')](_0x44f8a0);})['then'](function(_0x236a7b){if(_0x236a7b)return _0x236a7b?{'count':_0x5eb739,'rows':_0x236a7b}:null;})[_0x58eac7('0x6f')](respondWithResult(_0x5286d9,null))[_0x58eac7('0x13')](handleError(_0x5286d9,null));};
\ No newline at end of file