Built motion from commit 4c579f6b.|2.5.32
[motion2.git] / server / api / cmList / cmList.controller.js
index 9e242de..d8ddc07 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3cc0=['./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','Lists','UserProfileResource','error','name','send','index','map','CmList','fieldName','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','type','VIRTUAL','filter','merge','options','includeAll','include','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','describe','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','findAll','rows','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','each','omit','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','CmCustomField','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','addCustomField','sequelize','transaction','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x28bd37,_0x3bdae3){var _0x1348ac=function(_0x478cab){while(--_0x478cab){_0x28bd37['push'](_0x28bd37['shift']());}};_0x1348ac(++_0x3bdae3);}(_0x3cc0,0x1a3));var _0x03cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3cc0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x03cc('0x0'));var rimraf=require(_0x03cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03cc('0x2'));var rp=require(_0x03cc('0x3'));var moment=require(_0x03cc('0x4'));var BPromise=require(_0x03cc('0x5'));var Mustache=require(_0x03cc('0x6'));var util=require(_0x03cc('0x7'));var path=require(_0x03cc('0x8'));var sox=require(_0x03cc('0x9'));var csv=require(_0x03cc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x03cc('0xb'));var _=require(_0x03cc('0xc'));var squel=require(_0x03cc('0xd'));var crypto=require(_0x03cc('0xe'));var jsforce=require(_0x03cc('0xf'));var deskjs=require(_0x03cc('0x10'));var toCsv=require('to-csv');var querystring=require(_0x03cc('0x11'));var Papa=require(_0x03cc('0x12'));var Redis=require(_0x03cc('0x13'));var authService=require(_0x03cc('0x14'));var qs=require(_0x03cc('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x03cc('0x16'))(_0x03cc('0x17'));var utils=require('../../config/utils');var config=require(_0x03cc('0x18'));var licenseUtil=require(_0x03cc('0x19'));var db=require(_0x03cc('0x1a'))['db'];config[_0x03cc('0x1b')]=_[_0x03cc('0x1c')](config[_0x03cc('0x1b')],{'host':_0x03cc('0x1d'),'port':0x18eb});var socket=require(_0x03cc('0x1e'))(new Redis(config[_0x03cc('0x1b')]));require(_0x03cc('0x1f'))[_0x03cc('0x20')](socket);function respondWithStatusCode(_0x401a1c,_0xccaaa4){_0xccaaa4=_0xccaaa4||0xcc;return function(_0xb3bacc){if(_0xb3bacc){return _0x401a1c[_0x03cc('0x21')](_0xccaaa4);}return _0x401a1c[_0x03cc('0x22')](_0xccaaa4)[_0x03cc('0x23')]();};}function respondWithResult(_0xb073b8,_0x17f8cb){_0x17f8cb=_0x17f8cb||0xc8;return function(_0x3b3c18){if(_0x3b3c18){return _0xb073b8[_0x03cc('0x22')](_0x17f8cb)[_0x03cc('0x24')](_0x3b3c18);}};}function respondWithFilteredResult(_0x6fb1c3,_0xb6435b){return function(_0x26d27c){if(_0x26d27c){var _0x8a1173=typeof _0xb6435b[_0x03cc('0x25')]===_0x03cc('0x26')&&typeof _0xb6435b[_0x03cc('0x27')]==='undefined';var _0x248385=_0x26d27c[_0x03cc('0x28')];var _0x5e230d=_0x8a1173?0x0:_0xb6435b['offset'];var _0x567296=_0x8a1173?_0x26d27c[_0x03cc('0x28')]:_0xb6435b[_0x03cc('0x25')]+_0xb6435b['limit'];var _0x44d056;if(_0x567296>=_0x248385){_0x567296=_0x248385;_0x44d056=0xc8;}else{_0x44d056=0xce;}_0x6fb1c3['status'](_0x44d056);return _0x6fb1c3[_0x03cc('0x29')](_0x03cc('0x2a'),_0x5e230d+'-'+_0x567296+'/'+_0x248385)['json'](_0x26d27c);}return null;};}function patchUpdates(_0x5e5568){return function(_0x26ea44){try{jsonpatch['apply'](_0x26ea44,_0x5e5568,!![]);}catch(_0x38233f){return BPromise[_0x03cc('0x2b')](_0x38233f);}return _0x26ea44[_0x03cc('0x2c')]();};}function saveUpdates(_0x129b3f,_0x4fba14){return function(_0x2ffeb7){if(_0x2ffeb7){return _0x2ffeb7['update'](_0x129b3f)[_0x03cc('0x2d')](function(_0x3c0722){return _0x3c0722;});}return null;};}function removeEntity(_0x83c084,_0x907ff4){return function(_0xa0eef3){if(_0xa0eef3){return _0xa0eef3[_0x03cc('0x2e')]()['then'](function(){var _0x21f12e=_0xa0eef3[_0x03cc('0x2f')]({'plain':!![]});var _0xa01cc1=_0x03cc('0x30');return db[_0x03cc('0x31')][_0x03cc('0x2e')]({'where':{'type':_0xa01cc1,'resourceId':_0x21f12e['id']}})[_0x03cc('0x2d')](function(){return _0xa0eef3;});})['then'](function(){_0x83c084[_0x03cc('0x22')](0xcc)[_0x03cc('0x23')]();});}};}function handleEntityNotFound(_0x4a13e8,_0x364859){return function(_0x7487aa){if(!_0x7487aa){_0x4a13e8[_0x03cc('0x21')](0x194);}return _0x7487aa;};}function handleError(_0x2724f0,_0x3ecc78){_0x3ecc78=_0x3ecc78||0x1f4;return function(_0x1d3aab){logger[_0x03cc('0x32')](_0x1d3aab['stack']);if(_0x1d3aab['name']){delete _0x1d3aab[_0x03cc('0x33')];}_0x2724f0[_0x03cc('0x22')](_0x3ecc78)[_0x03cc('0x34')](_0x1d3aab);};}exports[_0x03cc('0x35')]=function(_0x355f38,_0x4c7024){var _0xe2e23a={},_0x5990e3={},_0x505269={'count':0x0,'rows':[]};var _0xd3a844=_[_0x03cc('0x36')](db[_0x03cc('0x37')]['rawAttributes'],function(_0x18af6c){return{'name':_0x18af6c[_0x03cc('0x38')],'type':_0x18af6c['type'][_0x03cc('0x39')]};});_0x5990e3[_0x03cc('0x3a')]=_[_0x03cc('0x36')](_0xd3a844,_0x03cc('0x33'));_0x5990e3['query']=_[_0x03cc('0x3b')](_0x355f38[_0x03cc('0x3c')]);_0x5990e3['filters']=_[_0x03cc('0x3d')](_0x5990e3['model'],_0x5990e3[_0x03cc('0x3c')]);_0xe2e23a[_0x03cc('0x3e')]=_['intersection'](_0x5990e3[_0x03cc('0x3a')],qs[_0x03cc('0x3f')](_0x355f38[_0x03cc('0x3c')]['fields']));_0xe2e23a[_0x03cc('0x3e')]=_0xe2e23a[_0x03cc('0x3e')][_0x03cc('0x40')]?_0xe2e23a[_0x03cc('0x3e')]:_0x5990e3['model'];if(!_0x355f38[_0x03cc('0x3c')]['hasOwnProperty'](_0x03cc('0x41'))){_0xe2e23a['limit']=qs[_0x03cc('0x27')](_0x355f38['query'][_0x03cc('0x27')]);_0xe2e23a[_0x03cc('0x25')]=qs[_0x03cc('0x25')](_0x355f38[_0x03cc('0x3c')]['offset']);}_0xe2e23a[_0x03cc('0x42')]=qs[_0x03cc('0x43')](_0x355f38[_0x03cc('0x3c')][_0x03cc('0x43')]);_0xe2e23a[_0x03cc('0x44')]=qs['filters'](_[_0x03cc('0x45')](_0x355f38[_0x03cc('0x3c')],_0x5990e3[_0x03cc('0x46')]),_0xd3a844);if(_0x355f38[_0x03cc('0x3c')]['filter']){_0xe2e23a[_0x03cc('0x44')]=_['merge'](_0xe2e23a[_0x03cc('0x44')],{'$or':_[_0x03cc('0x36')](_0xd3a844,function(_0x5731f7){if(_0x5731f7[_0x03cc('0x47')]!==_0x03cc('0x48')){var _0x3c9266={};_0x3c9266[_0x5731f7[_0x03cc('0x33')]]={'$like':'%'+_0x355f38[_0x03cc('0x3c')][_0x03cc('0x49')]+'%'};return _0x3c9266;}})});}_0xe2e23a=_[_0x03cc('0x4a')]({},_0xe2e23a,_0x355f38[_0x03cc('0x4b')]);var _0x59ed2c={'where':_0xe2e23a[_0x03cc('0x44')]};return db['CmList'][_0x03cc('0x28')](_0x59ed2c)['then'](function(_0x7076a8){_0x505269[_0x03cc('0x28')]=_0x7076a8;if(_0x355f38[_0x03cc('0x3c')][_0x03cc('0x4c')]){_0xe2e23a[_0x03cc('0x4d')]=[{'all':!![]}];}return db[_0x03cc('0x37')]['findAll'](_0xe2e23a);})['then'](function(_0x5eedd7){_0x505269['rows']=_0x5eedd7;return _0x505269;})[_0x03cc('0x2d')](respondWithFilteredResult(_0x4c7024,_0xe2e23a))[_0x03cc('0x4e')](handleError(_0x4c7024,null));};exports[_0x03cc('0x4f')]=function(_0x24e20b,_0x545f76){var _0x132a7d={'raw':![],'where':{'id':_0x24e20b[_0x03cc('0x50')]['id']}},_0xdddd35={};_0xdddd35[_0x03cc('0x3a')]=_[_0x03cc('0x3b')](db[_0x03cc('0x37')][_0x03cc('0x51')]);_0xdddd35['query']=_[_0x03cc('0x3b')](_0x24e20b[_0x03cc('0x3c')]);_0xdddd35[_0x03cc('0x46')]=_[_0x03cc('0x3d')](_0xdddd35[_0x03cc('0x3a')],_0xdddd35[_0x03cc('0x3c')]);_0x132a7d['attributes']=_['intersection'](_0xdddd35[_0x03cc('0x3a')],qs['fields'](_0x24e20b[_0x03cc('0x3c')]['fields']));_0x132a7d[_0x03cc('0x3e')]=_0x132a7d[_0x03cc('0x3e')][_0x03cc('0x40')]?_0x132a7d[_0x03cc('0x3e')]:_0xdddd35[_0x03cc('0x3a')];if(_0x24e20b[_0x03cc('0x3c')][_0x03cc('0x4c')]){_0x132a7d[_0x03cc('0x4d')]=[{'all':!![]}];}_0x132a7d=_[_0x03cc('0x4a')]({},_0x132a7d,_0x24e20b[_0x03cc('0x4b')]);return db[_0x03cc('0x37')][_0x03cc('0x52')](_0x132a7d)[_0x03cc('0x2d')](handleEntityNotFound(_0x545f76,null))['then'](respondWithResult(_0x545f76,null))[_0x03cc('0x4e')](handleError(_0x545f76,null));};exports['create']=function(_0x14bd74,_0x4c0530){return db[_0x03cc('0x37')][_0x03cc('0x53')](_0x14bd74[_0x03cc('0x54')],{})[_0x03cc('0x2d')](function(_0x429f67){var _0x4cb939=_0x14bd74['user'][_0x03cc('0x2f')]({'plain':!![]});if(!_0x4cb939)throw new Error(_0x03cc('0x55'));if(_0x4cb939['role']===_0x03cc('0x56')){var _0x598ed3=_0x429f67[_0x03cc('0x2f')]({'plain':!![]});var _0x39f121=_0x03cc('0x30');return db['UserProfileSection'][_0x03cc('0x52')]({'where':{'name':_0x39f121,'userProfileId':_0x4cb939[_0x03cc('0x57')]},'raw':!![]})[_0x03cc('0x2d')](function(_0x4c9d4c){if(_0x4c9d4c&&_0x4c9d4c[_0x03cc('0x58')]===0x0){return db[_0x03cc('0x31')][_0x03cc('0x53')]({'name':_0x598ed3[_0x03cc('0x33')],'resourceId':_0x598ed3['id'],'type':_0x4c9d4c[_0x03cc('0x33')],'sectionId':_0x4c9d4c['id']},{})[_0x03cc('0x2d')](function(){return _0x429f67;});}else{return _0x429f67;}})[_0x03cc('0x4e')](function(_0x256c52){logger[_0x03cc('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x256c52);throw _0x256c52;});}return _0x429f67;})['then'](respondWithResult(_0x4c0530,0xc9))[_0x03cc('0x4e')](handleError(_0x4c0530,null));};exports['update']=function(_0x127a97,_0x2aa90e){if(_0x127a97['body']['id']){delete _0x127a97[_0x03cc('0x54')]['id'];}return db['CmList'][_0x03cc('0x52')]({'where':{'id':_0x127a97[_0x03cc('0x50')]['id']}})['then'](handleEntityNotFound(_0x2aa90e,null))[_0x03cc('0x2d')](saveUpdates(_0x127a97[_0x03cc('0x54')],null))[_0x03cc('0x2d')](respondWithResult(_0x2aa90e,null))['catch'](handleError(_0x2aa90e,null));};exports[_0x03cc('0x2e')]=function(_0xb41e45,_0xd840e2){return db[_0x03cc('0x37')]['find']({'where':{'id':_0xb41e45[_0x03cc('0x50')]['id']}})[_0x03cc('0x2d')](handleEntityNotFound(_0xd840e2,null))['then'](removeEntity(_0xd840e2,null))[_0x03cc('0x4e')](handleError(_0xd840e2,null));};exports[_0x03cc('0x59')]=function(_0xe21d78,_0x1b4cc1){return db['CmList'][_0x03cc('0x59')]()['then'](respondWithResult(_0x1b4cc1,null))['catch'](handleError(_0x1b4cc1,null));};exports[_0x03cc('0x5a')]=function(_0x22ce5d,_0x3d9480,_0x144e7f){if(_0x22ce5d[_0x03cc('0x54')]['id']){delete _0x22ce5d['body']['id'];}return db[_0x03cc('0x37')][_0x03cc('0x52')]({'where':{'id':_0x22ce5d[_0x03cc('0x50')]['id']}})[_0x03cc('0x2d')](handleEntityNotFound(_0x3d9480,null))['then'](function(_0x5bbb2c){if(_0x5bbb2c){_0x22ce5d[_0x03cc('0x54')][_0x03cc('0x5b')]=_0x5bbb2c['id'];return db[_0x03cc('0x5c')]['create'](_0x22ce5d[_0x03cc('0x54')]);}})['then'](respondWithResult(_0x3d9480,null))[_0x03cc('0x4e')](handleError(_0x3d9480,null));};exports[_0x03cc('0x5d')]=function(_0x1e4d6a,_0x1bdab6,_0x2cae34){var _0xdc548d={'raw':![],'where':{}};var _0xac4771={};var _0x4af2e9={'count':0x0,'rows':[]};return db[_0x03cc('0x37')][_0x03cc('0x5e')]({'where':{'id':_0x1e4d6a['params']['id']}})[_0x03cc('0x2d')](handleEntityNotFound(_0x1bdab6,null))[_0x03cc('0x2d')](function(_0x59a822){if(_0x59a822){_0xac4771[_0x03cc('0x3a')]=_[_0x03cc('0x3b')](db[_0x03cc('0x5c')][_0x03cc('0x51')]);_0xac4771[_0x03cc('0x3c')]=_[_0x03cc('0x3b')](_0x1e4d6a['query']);_0xac4771[_0x03cc('0x46')]=_[_0x03cc('0x3d')](_0xac4771[_0x03cc('0x3a')],_0xac4771[_0x03cc('0x3c')]);_0xdc548d[_0x03cc('0x3e')]=_['intersection'](_0xac4771[_0x03cc('0x3a')],qs[_0x03cc('0x3f')](_0x1e4d6a['query'][_0x03cc('0x3f')]));_0xdc548d[_0x03cc('0x3e')]=_0xdc548d[_0x03cc('0x3e')][_0x03cc('0x40')]?_0xdc548d['attributes']:_0xac4771[_0x03cc('0x3a')];if(!_0x1e4d6a[_0x03cc('0x3c')][_0x03cc('0x5f')]('nolimit')){_0xdc548d[_0x03cc('0x27')]=qs[_0x03cc('0x27')](_0x1e4d6a[_0x03cc('0x3c')][_0x03cc('0x27')]);_0xdc548d[_0x03cc('0x25')]=qs[_0x03cc('0x25')](_0x1e4d6a[_0x03cc('0x3c')]['offset']);}_0xdc548d[_0x03cc('0x42')]=qs[_0x03cc('0x43')](_0x1e4d6a['query'][_0x03cc('0x43')]);_0xdc548d['where']=qs[_0x03cc('0x46')](_['pick'](_0x1e4d6a[_0x03cc('0x3c')],_0xac4771[_0x03cc('0x46')]));_0xdc548d['where']['ListId']=_0x59a822['id'];if(_0x1e4d6a[_0x03cc('0x3c')]['filter']){_0xdc548d[_0x03cc('0x44')]=_[_0x03cc('0x4a')](_0xdc548d[_0x03cc('0x44')],{'$or':_['map'](_0xdc548d[_0x03cc('0x3e')],function(_0x26573f){var _0x432a08={};_0x432a08[_0x26573f]={'$like':'%'+_0x1e4d6a[_0x03cc('0x3c')][_0x03cc('0x49')]+'%'};return _0x432a08;})});}_0xdc548d=_[_0x03cc('0x4a')]({},_0xdc548d,_0x1e4d6a['options']);return db[_0x03cc('0x5c')]['count']({'where':_0xdc548d['where']})[_0x03cc('0x2d')](function(_0x3e4d15){_0x4af2e9['count']=_0x3e4d15;if(_0x1e4d6a['query'][_0x03cc('0x4c')]){_0xdc548d[_0x03cc('0x4d')]=[{'all':!![]}];}return db[_0x03cc('0x5c')][_0x03cc('0x60')](_0xdc548d);})[_0x03cc('0x2d')](function(_0x1a7bef){_0x4af2e9[_0x03cc('0x61')]=_0x1a7bef;return _0x4af2e9;});}})[_0x03cc('0x2d')](respondWithFilteredResult(_0x1bdab6,_0xdc548d))[_0x03cc('0x4e')](handleError(_0x1bdab6,null));};exports[_0x03cc('0x62')]=function(_0xee85ed,_0x20e0e4,_0x2946a6){return db[_0x03cc('0x37')]['find']({'where':{'id':_0xee85ed[_0x03cc('0x50')]['id']}})[_0x03cc('0x2d')](handleEntityNotFound(_0x20e0e4,null))[_0x03cc('0x2d')](function(_0x31e94f){if(_0x31e94f){return _0x31e94f['removeDispositions'](_0xee85ed[_0x03cc('0x3c')][_0x03cc('0x63')]);}})['then'](respondWithStatusCode(_0x20e0e4,null))[_0x03cc('0x4e')](handleError(_0x20e0e4,null));};exports[_0x03cc('0x64')]=function(_0x3688d4,_0x2efb3e,_0x2f2bc8){return db[_0x03cc('0x37')][_0x03cc('0x52')]({'where':{'id':_0x3688d4[_0x03cc('0x50')]['id']}})['then'](handleEntityNotFound(_0x2efb3e,null))[_0x03cc('0x2d')](function(_0x2112c0){if(_0x2112c0){var _0x10b426=[];var _0x3a8e6b={'success':[],'errors':[]};return db[_0x03cc('0x65')]['describe']()[_0x03cc('0x2d')](function(_0x458ee1){if(_0x3688d4['body'][_0x03cc('0x66')]&&_[_0x03cc('0x67')](_0x3688d4[_0x03cc('0x54')][_0x03cc('0x66')])){if(_0x3688d4[_0x03cc('0x54')][_0x03cc('0x66')]['length']){_0x3688d4[_0x03cc('0x54')][_0x03cc('0x66')]=_0x3688d4['body'][_0x03cc('0x66')][_0x03cc('0x68')](';')+';';}else{_0x3688d4[_0x03cc('0x54')][_0x03cc('0x66')]=null;}}else{_0x3688d4[_0x03cc('0x54')][_0x03cc('0x66')]=null;}if(_0x3688d4[_0x03cc('0x54')]&&_['isArray'](_0x3688d4[_0x03cc('0x54')])){for(var _0x35b1ea=0x0;_0x35b1ea<_0x3688d4[_0x03cc('0x54')][_0x03cc('0x40')];_0x35b1ea+=0x1){_0x3688d4[_0x03cc('0x54')][_0x35b1ea]['ListId']=_0x3688d4[_0x03cc('0x50')]['id'];_0x10b426['push'](_0x3688d4['body'][_0x35b1ea]);}return BPromise[_0x03cc('0x69')](_0x10b426,function(_0x36b469){return db['CmContact'][_0x03cc('0x53')](_[_0x03cc('0x6a')](_0x36b469,[_0x03cc('0x63'),'id'])||{},{'fields':_[_0x03cc('0x3b')](_0x458ee1),'raw':!![]})['then'](function(_0x2c69bd){_0x3a8e6b[_0x03cc('0x6b')]['push'](_0x2c69bd[_0x03cc('0x6c')]);})['catch'](function(_0x3943fa){_0x3a8e6b['errors']['push']({'data':_0x36b469,'error':_0x3943fa[_0x03cc('0x6d')]});});})['then'](function(_0x3b41a5){return _0x3a8e6b;})['catch'](function(_0x4f040e){return _0x4f040e;});}else{_0x2efb3e[_0x03cc('0x22')](0x190)[_0x03cc('0x24')]({'message':_0x03cc('0x6e')});}});}})['then'](respondWithResult(_0x2efb3e,null))[_0x03cc('0x4e')](handleError(_0x2efb3e,null));};exports[_0x03cc('0x6f')]=function(_0x4792bf,_0x228697,_0xb15930){var _0x574c0a;return db[_0x03cc('0x37')]['find']({'where':{'id':_0x4792bf[_0x03cc('0x50')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x03cc('0x70')}]})[_0x03cc('0x2d')](handleEntityNotFound(_0x228697,null))[_0x03cc('0x2d')](function(_0x142f91){if(_0x142f91){_0x574c0a=_0x142f91;return db[_0x03cc('0x65')]['rawAttributes'];}})['then'](function(_0x23c31c){if(_0x23c31c){var _0x454efe={};var _0x334ba1={};_0x334ba1[_0x03cc('0x3a')]=_[_0x03cc('0x71')](_[_0x03cc('0x3b')](_0x23c31c),_['map'](_0x574c0a[_0x03cc('0x70')],function(_0x23e3b1){return util[_0x03cc('0x72')](_0x03cc('0x73'),_0x23e3b1['id']);}));_0x334ba1[_0x03cc('0x3c')]=_[_0x03cc('0x3b')](_0x4792bf[_0x03cc('0x3c')]);_0x334ba1['filters']=_['intersection'](_0x334ba1[_0x03cc('0x3a')],_0x334ba1[_0x03cc('0x3c')]);_0x454efe[_0x03cc('0x3e')]=_[_0x03cc('0x3d')](_0x334ba1[_0x03cc('0x3a')],qs[_0x03cc('0x3f')](_0x4792bf[_0x03cc('0x3c')][_0x03cc('0x3f')]));_0x454efe['attributes']=_0x454efe[_0x03cc('0x3e')][_0x03cc('0x40')]?_0x454efe[_0x03cc('0x3e')]:_0x334ba1['model'];if(!_0x4792bf['query'][_0x03cc('0x5f')](_0x03cc('0x41'))){_0x454efe['limit']=qs[_0x03cc('0x27')](_0x4792bf[_0x03cc('0x3c')][_0x03cc('0x27')]);_0x454efe[_0x03cc('0x25')]=qs[_0x03cc('0x25')](_0x4792bf[_0x03cc('0x3c')]['offset']);}_0x454efe[_0x03cc('0x42')]=qs['sort'](_0x4792bf[_0x03cc('0x3c')][_0x03cc('0x43')]);_0x454efe[_0x03cc('0x44')]=qs[_0x03cc('0x46')](_['pick'](_0x4792bf[_0x03cc('0x3c')],_0x334ba1['filters']));_0x454efe[_0x03cc('0x74')]=!![];if(_0x4792bf[_0x03cc('0x3c')][_0x03cc('0x49')]){_0x454efe[_0x03cc('0x44')]=_[_0x03cc('0x4a')](_0x454efe[_0x03cc('0x44')],{'$or':_[_0x03cc('0x36')](_0x454efe[_0x03cc('0x3e')],function(_0x4c3606){var _0x42684c={};_0x42684c[_0x4c3606]={'$like':'%'+_0x4792bf['query'][_0x03cc('0x49')]+'%'};return _0x42684c;})});}_0x454efe=_['merge']({},_0x454efe,_0x4792bf['options']);return _0x574c0a['getContacts'](_0x454efe);}})[_0x03cc('0x2d')](respondWithResult(_0x228697,null))[_0x03cc('0x4e')](handleError(_0x228697,null));};exports[_0x03cc('0x75')]=function(_0x38bf12,_0xb177f2,_0x237c3a){var _0x33b364;return db[_0x03cc('0x37')][_0x03cc('0x52')]({'where':{'id':_0x38bf12[_0x03cc('0x50')]['id']},'include':[{'model':db[_0x03cc('0x76')],'as':'CustomFields'}]})[_0x03cc('0x2d')](handleEntityNotFound(_0xb177f2,null))[_0x03cc('0x2d')](function(_0x1ff8a0){if(_0x1ff8a0){_0x33b364=_0x1ff8a0;return db[_0x03cc('0x65')][_0x03cc('0x51')];}})[_0x03cc('0x2d')](function(_0x57df95){if(_0x57df95){var _0x171d70={};var _0x3a0594={};_0x3a0594[_0x03cc('0x3a')]=_['concat'](_[_0x03cc('0x3b')](_0x57df95),_[_0x03cc('0x36')](_0x33b364[_0x03cc('0x70')],function(_0x20a1de){return util[_0x03cc('0x72')](_0x03cc('0x73'),_0x20a1de['id']);}));_0x3a0594[_0x03cc('0x3c')]=_['keys'](_0x38bf12[_0x03cc('0x3c')]);_0x3a0594[_0x03cc('0x46')]=_[_0x03cc('0x3d')](_0x3a0594[_0x03cc('0x3a')],_0x3a0594[_0x03cc('0x3c')]);_0x171d70[_0x03cc('0x3e')]=_[_0x03cc('0x3d')](_0x3a0594[_0x03cc('0x3a')],qs[_0x03cc('0x3f')](_0x38bf12[_0x03cc('0x3c')][_0x03cc('0x3f')]));_0x171d70[_0x03cc('0x3e')]=_0x171d70[_0x03cc('0x3e')]['length']?_0x171d70[_0x03cc('0x3e')]:_0x3a0594[_0x03cc('0x3a')];if(!_0x38bf12[_0x03cc('0x3c')][_0x03cc('0x5f')](_0x03cc('0x41'))){_0x171d70[_0x03cc('0x27')]=qs['limit'](_0x38bf12[_0x03cc('0x3c')][_0x03cc('0x27')]);_0x171d70[_0x03cc('0x25')]=qs[_0x03cc('0x25')](_0x38bf12[_0x03cc('0x3c')][_0x03cc('0x25')]);}_0x171d70[_0x03cc('0x42')]=qs[_0x03cc('0x43')](_0x38bf12[_0x03cc('0x3c')][_0x03cc('0x43')]);_0x171d70['where']=qs[_0x03cc('0x46')](_[_0x03cc('0x45')](_0x38bf12[_0x03cc('0x3c')],_0x3a0594[_0x03cc('0x46')]));_0x171d70[_0x03cc('0x74')]=!![];if(_0x38bf12[_0x03cc('0x3c')][_0x03cc('0x49')]){_0x171d70[_0x03cc('0x44')]=_[_0x03cc('0x4a')](_0x171d70[_0x03cc('0x44')],{'$or':_[_0x03cc('0x36')](_0x171d70[_0x03cc('0x3e')],function(_0x13760b){var _0x321568={};_0x321568[_0x13760b]={'$like':'%'+_0x38bf12[_0x03cc('0x3c')][_0x03cc('0x49')]+'%'};return _0x321568;})});}_0x171d70=_[_0x03cc('0x4a')]({},_0x171d70,_0x38bf12[_0x03cc('0x4b')]);return _0x33b364['getContacts'](_0x171d70);}})['then'](function(_0x2bb444){if(!_['isEmpty'](_0x2bb444)){var _0x473373=toCsv(_0x2bb444);var _0xf22c75=Date[_0x03cc('0x77')]();fs[_0x03cc('0x78')](util[_0x03cc('0x72')](_0x03cc('0x79'),_0x33b364['id'],_0xf22c75),_0x473373);_0xb177f2['setHeader'](_0x03cc('0x7a'),_0x03cc('0x7b')+util[_0x03cc('0x72')](_0x03cc('0x7c'),_0x33b364['id'],_0xf22c75));_0xb177f2[_0x03cc('0x7d')](_0x03cc('0x7e'),_0x03cc('0x7f'));return _0xb177f2[_0x03cc('0x80')](util['format'](_0x03cc('0x79'),_0x33b364['id'],_0xf22c75));}else{return _0xb177f2[_0x03cc('0x21')](0xcc);}})[_0x03cc('0x4e')](handleError(_0xb177f2,null));};exports[_0x03cc('0x81')]=function(_0x48f8c5,_0x5513e4,_0x4fd09a){var _0x5732e1;delete _0x48f8c5['body']['id'];return db[_0x03cc('0x37')][_0x03cc('0x5e')]({'where':{'id':_0x48f8c5['params']['id']}})['then'](handleEntityNotFound(_0x5513e4,null))['then'](function(_0x96628f){if(_0x96628f){return db[_0x03cc('0x82')][_0x03cc('0x83')](function(_0x38cd4f){return db[_0x03cc('0x76')][_0x03cc('0x53')](_0x48f8c5[_0x03cc('0x54')],{'transaction':_0x38cd4f})[_0x03cc('0x2d')](function(_0x34b7e4){_0x5732e1=_0x34b7e4;return _0x96628f['addCustomFields'](_0x34b7e4,{'transaction':_0x38cd4f});})[_0x03cc('0x2d')](function(){var _0x577986={'type':db['Sequelize'][_0x03cc('0x84')],'transaction':_0x38cd4f};switch(_0x48f8c5[_0x03cc('0x54')][_0x03cc('0x47')]){case _0x03cc('0x85'):_0x577986[_0x03cc('0x47')]=db[_0x03cc('0x86')]['TEXT'];break;case _0x03cc('0x87'):_0x577986[_0x03cc('0x47')]=db[_0x03cc('0x86')][_0x03cc('0x88')];break;case _0x03cc('0x89'):_0x577986['type']=db[_0x03cc('0x86')][_0x03cc('0x8a')];_0x577986['defaultValue']=![];break;default:}return db['sequelize']['queryInterface'][_0x03cc('0x8b')](_0x03cc('0x8c'),util[_0x03cc('0x72')](_0x03cc('0x8d'),_0x5732e1['id']),_0x577986);})[_0x03cc('0x2d')](function(){return _0x5732e1;});});}})['then'](respondWithResult(_0x5513e4,null))['catch'](handleError(_0x5513e4,null));};exports[_0x03cc('0x8e')]=function(_0x1af94f,_0x596382,_0x573fc2){var _0x12f6df={};var _0x3a8e9e={};var _0x3eb489;var _0x91438f;return db[_0x03cc('0x37')][_0x03cc('0x5e')]({'where':{'id':_0x1af94f[_0x03cc('0x50')]['id']}})['then'](handleEntityNotFound(_0x596382,null))[_0x03cc('0x2d')](function(_0x4997c7){if(_0x4997c7){_0x3eb489=_0x4997c7;_0x3a8e9e[_0x03cc('0x3a')]=_['keys'](db[_0x03cc('0x76')][_0x03cc('0x51')]);_0x3a8e9e['query']=_[_0x03cc('0x3b')](_0x1af94f['query']);_0x3a8e9e[_0x03cc('0x46')]=_[_0x03cc('0x3d')](_0x3a8e9e[_0x03cc('0x3a')],_0x3a8e9e['query']);_0x12f6df[_0x03cc('0x3e')]=_[_0x03cc('0x3d')](_0x3a8e9e[_0x03cc('0x3a')],qs[_0x03cc('0x3f')](_0x1af94f[_0x03cc('0x3c')][_0x03cc('0x3f')]));_0x12f6df[_0x03cc('0x3e')]=_0x12f6df[_0x03cc('0x3e')][_0x03cc('0x40')]?_0x12f6df[_0x03cc('0x3e')]:_0x3a8e9e['model'];_0x12f6df['order']=qs[_0x03cc('0x43')](_0x1af94f[_0x03cc('0x3c')][_0x03cc('0x43')]);_0x12f6df[_0x03cc('0x44')]=qs['filters'](_['pick'](_0x1af94f[_0x03cc('0x3c')],_0x3a8e9e[_0x03cc('0x46')]));_0x12f6df[_0x03cc('0x44')]=_[_0x03cc('0x4a')](_0x12f6df[_0x03cc('0x44')],{'$or':[{'ListId':_0x4997c7['id']},{'ListId':null}]});if(_0x1af94f[_0x03cc('0x3c')][_0x03cc('0x49')]){_0x12f6df[_0x03cc('0x44')]=_[_0x03cc('0x4a')](_0x12f6df[_0x03cc('0x44')],{'$or':_[_0x03cc('0x36')](_0x12f6df[_0x03cc('0x3e')],function(_0x1227c3){var _0x5d2ad7={};_0x5d2ad7[_0x1227c3]={'$like':'%'+_0x1af94f[_0x03cc('0x3c')][_0x03cc('0x49')]+'%'};return _0x5d2ad7;})});}_0x12f6df=_[_0x03cc('0x4a')]({},_0x12f6df,_0x1af94f[_0x03cc('0x4b')]);return db[_0x03cc('0x76')]['findAndCountAll'](_0x12f6df);}})['then'](respondWithResult(_0x596382,null))[_0x03cc('0x4e')](handleError(_0x596382,null));};exports[_0x03cc('0x8f')]=function(_0x41053a,_0x1e57d5,_0x3c84da){return db[_0x03cc('0x37')][_0x03cc('0x52')]({'where':{'id':_0x41053a[_0x03cc('0x50')]['id']}})[_0x03cc('0x2d')](handleEntityNotFound(_0x1e57d5,null))[_0x03cc('0x2d')](function(_0x208680){if(_0x208680){return _0x208680[_0x03cc('0x8f')](_0x41053a[_0x03cc('0x54')][_0x03cc('0x63')],_['omit'](_0x41053a[_0x03cc('0x54')],[_0x03cc('0x63'),'id'])||{})[_0x03cc('0x90')](function(_0x45675e){for(var _0xc32b68=0x0;_0xc32b68<_0x41053a['body']['ids']['length'];_0xc32b68+=0x1){socket[_0x03cc('0x91')]('userCmList:save',{'UserId':_0x41053a[_0x03cc('0x54')][_0x03cc('0x63')][_0xc32b68],'CmListId':_0x41053a[_0x03cc('0x50')]['id']});}return _0x45675e;});}})['then'](respondWithResult(_0x1e57d5,null))[_0x03cc('0x4e')](handleError(_0x1e57d5,null));};exports['removeAgents']=function(_0xa42bf3,_0x2b68b1,_0x48f182){return db[_0x03cc('0x37')]['find']({'where':{'id':_0xa42bf3[_0x03cc('0x50')]['id']}})['then'](handleEntityNotFound(_0x2b68b1,null))[_0x03cc('0x2d')](function(_0x5b2902){if(_0x5b2902){return _0x5b2902[_0x03cc('0x92')](_0xa42bf3[_0x03cc('0x3c')][_0x03cc('0x63')])[_0x03cc('0x2d')](function(){if(_[_0x03cc('0x67')](_0xa42bf3['query'][_0x03cc('0x63')])){for(var _0xad7078=0x0;_0xad7078<_0xa42bf3[_0x03cc('0x3c')][_0x03cc('0x63')][_0x03cc('0x40')];_0xad7078+=0x1){socket[_0x03cc('0x91')](_0x03cc('0x93'),{'UserId':Number(_0xa42bf3[_0x03cc('0x3c')]['ids'][_0xad7078]),'CmListId':Number(_0xa42bf3[_0x03cc('0x50')]['id'])});}}else{socket['emit'](_0x03cc('0x93'),{'UserId':Number(_0xa42bf3['query'][_0x03cc('0x63')]),'CmListId':Number(_0xa42bf3[_0x03cc('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x2b68b1,null))[_0x03cc('0x4e')](handleError(_0x2b68b1,null));};exports[_0x03cc('0x94')]=function(_0x41dae2,_0x85530e,_0x5a80a0){var _0x2b0ce4={};var _0x8fb8={};var _0x799a7c;var _0x4eb9fb;return db[_0x03cc('0x37')][_0x03cc('0x5e')]({'where':{'id':_0x41dae2[_0x03cc('0x50')]['id']}})[_0x03cc('0x2d')](handleEntityNotFound(_0x85530e,null))[_0x03cc('0x2d')](function(_0x37ee2a){if(_0x37ee2a){_0x799a7c=_0x37ee2a;_0x8fb8[_0x03cc('0x3a')]=_[_0x03cc('0x3b')](db[_0x03cc('0x95')][_0x03cc('0x51')]);_0x8fb8['query']=_['keys'](_0x41dae2[_0x03cc('0x3c')]);_0x8fb8['filters']=_[_0x03cc('0x3d')](_0x8fb8[_0x03cc('0x3a')],_0x8fb8['query']);_0x2b0ce4[_0x03cc('0x3e')]=_['intersection'](_0x8fb8[_0x03cc('0x3a')],qs[_0x03cc('0x3f')](_0x41dae2[_0x03cc('0x3c')][_0x03cc('0x3f')]));_0x2b0ce4[_0x03cc('0x3e')]=_0x2b0ce4[_0x03cc('0x3e')][_0x03cc('0x40')]?_0x2b0ce4['attributes']:_0x8fb8[_0x03cc('0x3a')];_0x2b0ce4[_0x03cc('0x42')]=qs[_0x03cc('0x43')](_0x41dae2['query']['sort']);_0x2b0ce4[_0x03cc('0x44')]=qs[_0x03cc('0x46')](_[_0x03cc('0x45')](_0x41dae2['query'],_0x8fb8['filters']));if(_0x41dae2[_0x03cc('0x3c')][_0x03cc('0x49')]){_0x2b0ce4[_0x03cc('0x44')]=_[_0x03cc('0x4a')](_0x2b0ce4[_0x03cc('0x44')],{'$or':_[_0x03cc('0x36')](_0x2b0ce4['attributes'],function(_0x519737){var _0x3978cb={};_0x3978cb[_0x519737]={'$like':'%'+_0x41dae2[_0x03cc('0x3c')][_0x03cc('0x49')]+'%'};return _0x3978cb;})});}_0x2b0ce4=_[_0x03cc('0x4a')]({},_0x2b0ce4,_0x41dae2[_0x03cc('0x4b')]);return _0x799a7c[_0x03cc('0x94')](_0x2b0ce4);}})[_0x03cc('0x2d')](function(_0xcff7db){if(_0xcff7db){_0x4eb9fb=_0xcff7db[_0x03cc('0x40')];if(!_0x41dae2['query'][_0x03cc('0x5f')](_0x03cc('0x41'))){_0x2b0ce4[_0x03cc('0x27')]=qs[_0x03cc('0x27')](_0x41dae2[_0x03cc('0x3c')][_0x03cc('0x27')]);_0x2b0ce4['offset']=qs[_0x03cc('0x25')](_0x41dae2[_0x03cc('0x3c')][_0x03cc('0x25')]);}return _0x799a7c[_0x03cc('0x94')](_0x2b0ce4);}})[_0x03cc('0x2d')](function(_0x373c1a){if(_0x373c1a){return _0x373c1a?{'count':_0x4eb9fb,'rows':_0x373c1a}:null;}})[_0x03cc('0x2d')](respondWithResult(_0x85530e,null))[_0x03cc('0x4e')](handleError(_0x85530e,null));};
\ No newline at end of file
+var _0x075f=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','undefined','limit','count','offset','status','reject','save','destroy','then','get','Lists','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','CmList','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','update','describe','addDisposition','params','ListId','Disposition','nolimit','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','dataValues','errors','message','json','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','format','getContactsCsv','CustomFields','cf_%d','raw','isEmpty','now','writeFileSync','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','type','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','getCustomFields','findOne','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce'];(function(_0x1ca6df,_0x2cbe23){var _0x56866f=function(_0x259d4b){while(--_0x259d4b){_0x1ca6df['push'](_0x1ca6df['shift']());}};_0x56866f(++_0x2cbe23);}(_0x075f,0x111));var _0xf075=function(_0x464c56,_0x18ccab){_0x464c56=_0x464c56-0x0;var _0x19df4d=_0x075f[_0x464c56];return _0x19df4d;};'use strict';var emlformat=require(_0xf075('0x0'));var rimraf=require(_0xf075('0x1'));var zipdir=require(_0xf075('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf075('0x3'));var moment=require(_0xf075('0x4'));var BPromise=require(_0xf075('0x5'));var Mustache=require(_0xf075('0x6'));var util=require(_0xf075('0x7'));var path=require(_0xf075('0x8'));var sox=require(_0xf075('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf075('0xa'));var crypto=require(_0xf075('0xb'));var jsforce=require(_0xf075('0xc'));var deskjs=require(_0xf075('0xd'));var toCsv=require(_0xf075('0xe'));var querystring=require(_0xf075('0xf'));var Papa=require(_0xf075('0x10'));var Redis=require(_0xf075('0x11'));var authService=require(_0xf075('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf075('0x13'))(_0xf075('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf075('0x15'));var db=require(_0xf075('0x16'))['db'];config[_0xf075('0x17')]=_['defaults'](config[_0xf075('0x17')],{'host':_0xf075('0x18'),'port':0x18eb});var socket=require(_0xf075('0x19'))(new Redis(config['redis']));require(_0xf075('0x1a'))[_0xf075('0x1b')](socket);function respondWithStatusCode(_0x2c364c,_0xf0ad3f){_0xf0ad3f=_0xf0ad3f||0xcc;return function(_0x2a25ab){if(_0x2a25ab){return _0x2c364c[_0xf075('0x1c')](_0xf0ad3f);}return _0x2c364c['status'](_0xf0ad3f)[_0xf075('0x1d')]();};}function respondWithResult(_0x1f9e18,_0x284756){_0x284756=_0x284756||0xc8;return function(_0x75ed2e){if(_0x75ed2e){return _0x1f9e18['status'](_0x284756)['json'](_0x75ed2e);}};}function respondWithFilteredResult(_0x582812,_0x22cfb0){return function(_0x3367c1){if(_0x3367c1){var _0x2c943e=typeof _0x22cfb0['offset']===_0xf075('0x1e')&&typeof _0x22cfb0[_0xf075('0x1f')]===_0xf075('0x1e');var _0x1f7b65=_0x3367c1[_0xf075('0x20')];var _0x5afce8=_0x2c943e?0x0:_0x22cfb0['offset'];var _0x40dea2=_0x2c943e?_0x3367c1[_0xf075('0x20')]:_0x22cfb0[_0xf075('0x21')]+_0x22cfb0[_0xf075('0x1f')];var _0x133afb;if(_0x40dea2>=_0x1f7b65){_0x40dea2=_0x1f7b65;_0x133afb=0xc8;}else{_0x133afb=0xce;}_0x582812[_0xf075('0x22')](_0x133afb);return _0x582812['set']('Content-Range',_0x5afce8+'-'+_0x40dea2+'/'+_0x1f7b65)['json'](_0x3367c1);}return null;};}function patchUpdates(_0x5dc48e){return function(_0xda0884){try{jsonpatch['apply'](_0xda0884,_0x5dc48e,!![]);}catch(_0x396248){return BPromise[_0xf075('0x23')](_0x396248);}return _0xda0884[_0xf075('0x24')]();};}function saveUpdates(_0x597da1,_0x32ed5c){return function(_0x2215ea){if(_0x2215ea){return _0x2215ea['update'](_0x597da1)['then'](function(_0x13a9d){return _0x13a9d;});}return null;};}function removeEntity(_0x47757e,_0x40763d){return function(_0x31e5c1){if(_0x31e5c1){return _0x31e5c1[_0xf075('0x25')]()[_0xf075('0x26')](function(){var _0x46dc05=_0x31e5c1[_0xf075('0x27')]({'plain':!![]});var _0x424bc9=_0xf075('0x28');return db[_0xf075('0x29')][_0xf075('0x25')]({'where':{'type':_0x424bc9,'resourceId':_0x46dc05['id']}})[_0xf075('0x26')](function(){return _0x31e5c1;});})[_0xf075('0x26')](function(){_0x47757e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22651d,_0x4e2042){return function(_0x185788){if(!_0x185788){_0x22651d[_0xf075('0x1c')](0x194);}return _0x185788;};}function handleError(_0x4eb3f4,_0x5c363c){_0x5c363c=_0x5c363c||0x1f4;return function(_0x17a37b){logger[_0xf075('0x2a')](_0x17a37b[_0xf075('0x2b')]);if(_0x17a37b[_0xf075('0x2c')]){delete _0x17a37b['name'];}_0x4eb3f4[_0xf075('0x22')](_0x5c363c)[_0xf075('0x2d')](_0x17a37b);};}exports[_0xf075('0x2e')]=function(_0xdc32fc,_0x31ad08){var _0x5e3bd1={},_0x546f49={},_0x51b16b={'count':0x0,'rows':[]};var _0x2b5d78=_['map'](db['CmList'][_0xf075('0x2f')],function(_0x3ef95d){return{'name':_0x3ef95d[_0xf075('0x30')],'type':_0x3ef95d['type']['key']};});_0x546f49[_0xf075('0x31')]=_['map'](_0x2b5d78,_0xf075('0x2c'));_0x546f49[_0xf075('0x32')]=_[_0xf075('0x33')](_0xdc32fc['query']);_0x546f49[_0xf075('0x34')]=_[_0xf075('0x35')](_0x546f49['model'],_0x546f49['query']);_0x5e3bd1[_0xf075('0x36')]=_[_0xf075('0x35')](_0x546f49[_0xf075('0x31')],qs[_0xf075('0x37')](_0xdc32fc[_0xf075('0x32')]['fields']));_0x5e3bd1[_0xf075('0x36')]=_0x5e3bd1[_0xf075('0x36')][_0xf075('0x38')]?_0x5e3bd1['attributes']:_0x546f49[_0xf075('0x31')];if(!_0xdc32fc['query'][_0xf075('0x39')]('nolimit')){_0x5e3bd1[_0xf075('0x1f')]=qs[_0xf075('0x1f')](_0xdc32fc[_0xf075('0x32')][_0xf075('0x1f')]);_0x5e3bd1[_0xf075('0x21')]=qs[_0xf075('0x21')](_0xdc32fc[_0xf075('0x32')][_0xf075('0x21')]);}_0x5e3bd1[_0xf075('0x3a')]=qs[_0xf075('0x3b')](_0xdc32fc[_0xf075('0x32')][_0xf075('0x3b')]);_0x5e3bd1[_0xf075('0x3c')]=qs[_0xf075('0x34')](_[_0xf075('0x3d')](_0xdc32fc['query'],_0x546f49[_0xf075('0x34')]),_0x2b5d78);if(_0xdc32fc[_0xf075('0x32')][_0xf075('0x3e')]){_0x5e3bd1[_0xf075('0x3c')]=_[_0xf075('0x3f')](_0x5e3bd1[_0xf075('0x3c')],{'$or':_[_0xf075('0x40')](_0x2b5d78,function(_0x57e96f){if(_0x57e96f['type']!==_0xf075('0x41')){var _0x563fad={};_0x563fad[_0x57e96f[_0xf075('0x2c')]]={'$like':'%'+_0xdc32fc[_0xf075('0x32')]['filter']+'%'};return _0x563fad;}})});}_0x5e3bd1=_[_0xf075('0x3f')]({},_0x5e3bd1,_0xdc32fc[_0xf075('0x42')]);var _0x219dd0={'where':_0x5e3bd1[_0xf075('0x3c')]};return db[_0xf075('0x43')][_0xf075('0x20')](_0x219dd0)[_0xf075('0x26')](function(_0x42c44a){_0x51b16b[_0xf075('0x20')]=_0x42c44a;if(_0xdc32fc[_0xf075('0x32')][_0xf075('0x44')]){_0x5e3bd1[_0xf075('0x45')]=[{'all':!![]}];}return db[_0xf075('0x43')][_0xf075('0x46')](_0x5e3bd1);})[_0xf075('0x26')](function(_0x52d5af){_0x51b16b[_0xf075('0x47')]=_0x52d5af;return _0x51b16b;})[_0xf075('0x26')](respondWithFilteredResult(_0x31ad08,_0x5e3bd1))[_0xf075('0x48')](handleError(_0x31ad08,null));};exports[_0xf075('0x49')]=function(_0x3c7850,_0x17288d){var _0x21b317={'raw':![],'where':{'id':_0x3c7850['params']['id']}},_0x32493f={};_0x32493f[_0xf075('0x31')]=_['keys'](db[_0xf075('0x43')]['rawAttributes']);_0x32493f[_0xf075('0x32')]=_['keys'](_0x3c7850[_0xf075('0x32')]);_0x32493f[_0xf075('0x34')]=_[_0xf075('0x35')](_0x32493f[_0xf075('0x31')],_0x32493f['query']);_0x21b317[_0xf075('0x36')]=_[_0xf075('0x35')](_0x32493f[_0xf075('0x31')],qs[_0xf075('0x37')](_0x3c7850['query'][_0xf075('0x37')]));_0x21b317[_0xf075('0x36')]=_0x21b317[_0xf075('0x36')][_0xf075('0x38')]?_0x21b317[_0xf075('0x36')]:_0x32493f[_0xf075('0x31')];if(_0x3c7850[_0xf075('0x32')][_0xf075('0x44')]){_0x21b317['include']=[{'all':!![]}];}_0x21b317=_[_0xf075('0x3f')]({},_0x21b317,_0x3c7850['options']);return db[_0xf075('0x43')][_0xf075('0x4a')](_0x21b317)[_0xf075('0x26')](handleEntityNotFound(_0x17288d,null))[_0xf075('0x26')](respondWithResult(_0x17288d,null))[_0xf075('0x48')](handleError(_0x17288d,null));};exports[_0xf075('0x4b')]=function(_0x4e9286,_0x51c115){return db[_0xf075('0x43')][_0xf075('0x4b')](_0x4e9286[_0xf075('0x4c')],{})['then'](function(_0xb2a164){var _0x49aa7c=_0x4e9286[_0xf075('0x4d')]['get']({'plain':!![]});if(!_0x49aa7c)throw new Error(_0xf075('0x4e'));if(_0x49aa7c['role']===_0xf075('0x4d')){var _0x245e97=_0xb2a164['get']({'plain':!![]});var _0xe30fed=_0xf075('0x28');return db[_0xf075('0x4f')][_0xf075('0x4a')]({'where':{'name':_0xe30fed,'userProfileId':_0x49aa7c[_0xf075('0x50')]},'raw':!![]})[_0xf075('0x26')](function(_0x28cf58){if(_0x28cf58&&_0x28cf58['autoAssociation']===0x0){return db[_0xf075('0x29')][_0xf075('0x4b')]({'name':_0x245e97[_0xf075('0x2c')],'resourceId':_0x245e97['id'],'type':_0x28cf58[_0xf075('0x2c')],'sectionId':_0x28cf58['id']},{})['then'](function(){return _0xb2a164;});}else{return _0xb2a164;}})[_0xf075('0x48')](function(_0x48e285){logger[_0xf075('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48e285);throw _0x48e285;});}return _0xb2a164;})[_0xf075('0x26')](respondWithResult(_0x51c115,0xc9))[_0xf075('0x48')](handleError(_0x51c115,null));};exports[_0xf075('0x51')]=function(_0x37121a,_0x2f0180){if(_0x37121a[_0xf075('0x4c')]['id']){delete _0x37121a[_0xf075('0x4c')]['id'];}return db['CmList'][_0xf075('0x4a')]({'where':{'id':_0x37121a['params']['id']}})[_0xf075('0x26')](handleEntityNotFound(_0x2f0180,null))[_0xf075('0x26')](saveUpdates(_0x37121a[_0xf075('0x4c')],null))['then'](respondWithResult(_0x2f0180,null))['catch'](handleError(_0x2f0180,null));};exports[_0xf075('0x25')]=function(_0x464655,_0xcfd9e4){return db[_0xf075('0x43')][_0xf075('0x4a')]({'where':{'id':_0x464655['params']['id']}})[_0xf075('0x26')](handleEntityNotFound(_0xcfd9e4,null))[_0xf075('0x26')](removeEntity(_0xcfd9e4,null))['catch'](handleError(_0xcfd9e4,null));};exports['describe']=function(_0x546323,_0x4f16d4){return db[_0xf075('0x43')][_0xf075('0x52')]()[_0xf075('0x26')](respondWithResult(_0x4f16d4,null))[_0xf075('0x48')](handleError(_0x4f16d4,null));};exports[_0xf075('0x53')]=function(_0x49beec,_0x5c4e16,_0x45529c){if(_0x49beec[_0xf075('0x4c')]['id']){delete _0x49beec[_0xf075('0x4c')]['id'];}return db[_0xf075('0x43')][_0xf075('0x4a')]({'where':{'id':_0x49beec[_0xf075('0x54')]['id']}})['then'](handleEntityNotFound(_0x5c4e16,null))[_0xf075('0x26')](function(_0x3b6925){if(_0x3b6925){_0x49beec[_0xf075('0x4c')][_0xf075('0x55')]=_0x3b6925['id'];return db[_0xf075('0x56')][_0xf075('0x4b')](_0x49beec['body']);}})[_0xf075('0x26')](respondWithResult(_0x5c4e16,null))['catch'](handleError(_0x5c4e16,null));};exports['getDispositions']=function(_0x47e90c,_0x136997,_0x4d44f0){var _0x20bac8={'raw':![],'where':{}};var _0x33cbc3={};var _0x34fb46={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x47e90c[_0xf075('0x54')]['id']}})[_0xf075('0x26')](handleEntityNotFound(_0x136997,null))[_0xf075('0x26')](function(_0x23b93b){if(_0x23b93b){_0x33cbc3['model']=_[_0xf075('0x33')](db[_0xf075('0x56')]['rawAttributes']);_0x33cbc3[_0xf075('0x32')]=_[_0xf075('0x33')](_0x47e90c[_0xf075('0x32')]);_0x33cbc3['filters']=_[_0xf075('0x35')](_0x33cbc3[_0xf075('0x31')],_0x33cbc3[_0xf075('0x32')]);_0x20bac8[_0xf075('0x36')]=_[_0xf075('0x35')](_0x33cbc3[_0xf075('0x31')],qs[_0xf075('0x37')](_0x47e90c[_0xf075('0x32')][_0xf075('0x37')]));_0x20bac8['attributes']=_0x20bac8[_0xf075('0x36')][_0xf075('0x38')]?_0x20bac8['attributes']:_0x33cbc3[_0xf075('0x31')];if(!_0x47e90c[_0xf075('0x32')]['hasOwnProperty'](_0xf075('0x57'))){_0x20bac8[_0xf075('0x1f')]=qs['limit'](_0x47e90c[_0xf075('0x32')][_0xf075('0x1f')]);_0x20bac8[_0xf075('0x21')]=qs['offset'](_0x47e90c[_0xf075('0x32')]['offset']);}_0x20bac8[_0xf075('0x3a')]=qs[_0xf075('0x3b')](_0x47e90c[_0xf075('0x32')][_0xf075('0x3b')]);_0x20bac8[_0xf075('0x3c')]=qs[_0xf075('0x34')](_[_0xf075('0x3d')](_0x47e90c[_0xf075('0x32')],_0x33cbc3['filters']));_0x20bac8[_0xf075('0x3c')][_0xf075('0x55')]=_0x23b93b['id'];if(_0x47e90c[_0xf075('0x32')][_0xf075('0x3e')]){_0x20bac8[_0xf075('0x3c')]=_[_0xf075('0x3f')](_0x20bac8[_0xf075('0x3c')],{'$or':_[_0xf075('0x40')](_0x20bac8[_0xf075('0x36')],function(_0x422511){var _0x2e7e3d={};_0x2e7e3d[_0x422511]={'$like':'%'+_0x47e90c['query']['filter']+'%'};return _0x2e7e3d;})});}_0x20bac8=_[_0xf075('0x3f')]({},_0x20bac8,_0x47e90c['options']);return db['Disposition'][_0xf075('0x20')]({'where':_0x20bac8[_0xf075('0x3c')]})[_0xf075('0x26')](function(_0x15e6da){_0x34fb46['count']=_0x15e6da;if(_0x47e90c[_0xf075('0x32')][_0xf075('0x44')]){_0x20bac8[_0xf075('0x45')]=[{'all':!![]}];}return db[_0xf075('0x56')][_0xf075('0x46')](_0x20bac8);})[_0xf075('0x26')](function(_0x1e5748){_0x34fb46[_0xf075('0x47')]=_0x1e5748;return _0x34fb46;});}})['then'](respondWithFilteredResult(_0x136997,_0x20bac8))[_0xf075('0x48')](handleError(_0x136997,null));};exports['removeDispositions']=function(_0x1221f1,_0x4f6ed5,_0x4ea971){return db['CmList'][_0xf075('0x4a')]({'where':{'id':_0x1221f1[_0xf075('0x54')]['id']}})['then'](handleEntityNotFound(_0x4f6ed5,null))[_0xf075('0x26')](function(_0x350c7b){if(_0x350c7b){return _0x350c7b[_0xf075('0x58')](_0x1221f1[_0xf075('0x32')][_0xf075('0x59')]);}})[_0xf075('0x26')](respondWithStatusCode(_0x4f6ed5,null))[_0xf075('0x48')](handleError(_0x4f6ed5,null));};exports[_0xf075('0x5a')]=function(_0x4a1c76,_0x4f5f2c,_0x33766a){return db['CmList'][_0xf075('0x4a')]({'where':{'id':_0x4a1c76[_0xf075('0x54')]['id']}})[_0xf075('0x26')](handleEntityNotFound(_0x4f5f2c,null))['then'](function(_0x440a9a){if(_0x440a9a){var _0x75ced8=[];var _0xec73de={'success':[],'errors':[]};return db[_0xf075('0x5b')][_0xf075('0x52')]()[_0xf075('0x26')](function(_0x127682){if(_0x4a1c76['body'][_0xf075('0x5c')]&&_['isArray'](_0x4a1c76[_0xf075('0x4c')][_0xf075('0x5c')])){if(_0x4a1c76[_0xf075('0x4c')][_0xf075('0x5c')]['length']){_0x4a1c76['body']['tags']=_0x4a1c76[_0xf075('0x4c')][_0xf075('0x5c')][_0xf075('0x5d')](';')+';';}else{_0x4a1c76['body'][_0xf075('0x5c')]=null;}}else{_0x4a1c76['body']['tags']=null;}if(_0x4a1c76[_0xf075('0x4c')]&&_[_0xf075('0x5e')](_0x4a1c76[_0xf075('0x4c')])){for(var _0x23a6f1=0x0;_0x23a6f1<_0x4a1c76[_0xf075('0x4c')][_0xf075('0x38')];_0x23a6f1+=0x1){_0x4a1c76[_0xf075('0x4c')][_0x23a6f1]['ListId']=_0x4a1c76['params']['id'];_0x75ced8[_0xf075('0x5f')](_0x4a1c76['body'][_0x23a6f1]);}return BPromise[_0xf075('0x60')](_0x75ced8,function(_0x2cefe9){return db[_0xf075('0x5b')][_0xf075('0x4b')](_[_0xf075('0x61')](_0x2cefe9,[_0xf075('0x59'),'id'])||{},{'fields':_[_0xf075('0x33')](_0x127682),'raw':!![]})[_0xf075('0x26')](function(_0x16cfb3){_0xec73de['success']['push'](_0x16cfb3[_0xf075('0x62')]);})['catch'](function(_0x3ba4a0){_0xec73de[_0xf075('0x63')][_0xf075('0x5f')]({'data':_0x2cefe9,'error':_0x3ba4a0[_0xf075('0x64')]});});})[_0xf075('0x26')](function(_0x417739){return _0xec73de;})[_0xf075('0x48')](function(_0x14a5df){return _0x14a5df;});}else{_0x4f5f2c['status'](0x190)[_0xf075('0x65')]({'message':_0xf075('0x66')});}});}})[_0xf075('0x26')](respondWithResult(_0x4f5f2c,null))[_0xf075('0x48')](handleError(_0x4f5f2c,null));};exports[_0xf075('0x67')]=function(_0x1d42ad,_0x4b86ce,_0x272bdd){var _0x572169;return db[_0xf075('0x43')]['find']({'where':{'id':_0x1d42ad['params']['id']},'include':[{'model':db[_0xf075('0x68')],'as':'CustomFields'}]})[_0xf075('0x26')](handleEntityNotFound(_0x4b86ce,null))[_0xf075('0x26')](function(_0x1b618c){if(_0x1b618c){_0x572169=_0x1b618c;return db[_0xf075('0x5b')][_0xf075('0x2f')];}})[_0xf075('0x26')](function(_0x23efea){if(_0x23efea){var _0x17691f={};var _0x196365={};_0x196365[_0xf075('0x31')]=_[_0xf075('0x69')](_['keys'](_0x23efea),_['map'](_0x572169['CustomFields'],function(_0x5a18ae){return util[_0xf075('0x6a')]('cf_%d',_0x5a18ae['id']);}));_0x196365[_0xf075('0x32')]=_[_0xf075('0x33')](_0x1d42ad[_0xf075('0x32')]);_0x196365['filters']=_[_0xf075('0x35')](_0x196365['model'],_0x196365[_0xf075('0x32')]);_0x17691f[_0xf075('0x36')]=_[_0xf075('0x35')](_0x196365['model'],qs[_0xf075('0x37')](_0x1d42ad[_0xf075('0x32')]['fields']));_0x17691f[_0xf075('0x36')]=_0x17691f['attributes'][_0xf075('0x38')]?_0x17691f['attributes']:_0x196365[_0xf075('0x31')];if(!_0x1d42ad[_0xf075('0x32')]['hasOwnProperty'](_0xf075('0x57'))){_0x17691f['limit']=qs['limit'](_0x1d42ad[_0xf075('0x32')][_0xf075('0x1f')]);_0x17691f['offset']=qs['offset'](_0x1d42ad['query']['offset']);}_0x17691f[_0xf075('0x3a')]=qs[_0xf075('0x3b')](_0x1d42ad[_0xf075('0x32')][_0xf075('0x3b')]);_0x17691f[_0xf075('0x3c')]=qs['filters'](_[_0xf075('0x3d')](_0x1d42ad[_0xf075('0x32')],_0x196365[_0xf075('0x34')]));_0x17691f['raw']=!![];if(_0x1d42ad[_0xf075('0x32')][_0xf075('0x3e')]){_0x17691f[_0xf075('0x3c')]=_[_0xf075('0x3f')](_0x17691f[_0xf075('0x3c')],{'$or':_[_0xf075('0x40')](_0x17691f[_0xf075('0x36')],function(_0x5b0834){var _0x434738={};_0x434738[_0x5b0834]={'$like':'%'+_0x1d42ad['query']['filter']+'%'};return _0x434738;})});}_0x17691f=_[_0xf075('0x3f')]({},_0x17691f,_0x1d42ad[_0xf075('0x42')]);return _0x572169[_0xf075('0x67')](_0x17691f);}})['then'](respondWithResult(_0x4b86ce,null))['catch'](handleError(_0x4b86ce,null));};exports[_0xf075('0x6b')]=function(_0x40b851,_0x327036,_0xff677){var _0x66b485;return db['CmList']['find']({'where':{'id':_0x40b851[_0xf075('0x54')]['id']},'include':[{'model':db[_0xf075('0x68')],'as':_0xf075('0x6c')}]})['then'](handleEntityNotFound(_0x327036,null))['then'](function(_0xd537d9){if(_0xd537d9){_0x66b485=_0xd537d9;return db[_0xf075('0x5b')][_0xf075('0x2f')];}})[_0xf075('0x26')](function(_0x2aaeb4){if(_0x2aaeb4){var _0x41617f={};var _0x48cf19={};_0x48cf19[_0xf075('0x31')]=_[_0xf075('0x69')](_['keys'](_0x2aaeb4),_[_0xf075('0x40')](_0x66b485[_0xf075('0x6c')],function(_0x5a3984){return util[_0xf075('0x6a')](_0xf075('0x6d'),_0x5a3984['id']);}));_0x48cf19['query']=_[_0xf075('0x33')](_0x40b851[_0xf075('0x32')]);_0x48cf19[_0xf075('0x34')]=_['intersection'](_0x48cf19[_0xf075('0x31')],_0x48cf19['query']);_0x41617f['attributes']=_[_0xf075('0x35')](_0x48cf19[_0xf075('0x31')],qs[_0xf075('0x37')](_0x40b851[_0xf075('0x32')][_0xf075('0x37')]));_0x41617f[_0xf075('0x36')]=_0x41617f[_0xf075('0x36')]['length']?_0x41617f[_0xf075('0x36')]:_0x48cf19[_0xf075('0x31')];if(!_0x40b851[_0xf075('0x32')]['hasOwnProperty']('nolimit')){_0x41617f['limit']=qs[_0xf075('0x1f')](_0x40b851['query']['limit']);_0x41617f['offset']=qs['offset'](_0x40b851[_0xf075('0x32')][_0xf075('0x21')]);}_0x41617f[_0xf075('0x3a')]=qs[_0xf075('0x3b')](_0x40b851[_0xf075('0x32')][_0xf075('0x3b')]);_0x41617f[_0xf075('0x3c')]=qs[_0xf075('0x34')](_['pick'](_0x40b851[_0xf075('0x32')],_0x48cf19[_0xf075('0x34')]));_0x41617f[_0xf075('0x6e')]=!![];if(_0x40b851[_0xf075('0x32')][_0xf075('0x3e')]){_0x41617f[_0xf075('0x3c')]=_[_0xf075('0x3f')](_0x41617f[_0xf075('0x3c')],{'$or':_[_0xf075('0x40')](_0x41617f[_0xf075('0x36')],function(_0x3377de){var _0x9f30ea={};_0x9f30ea[_0x3377de]={'$like':'%'+_0x40b851[_0xf075('0x32')][_0xf075('0x3e')]+'%'};return _0x9f30ea;})});}_0x41617f=_[_0xf075('0x3f')]({},_0x41617f,_0x40b851[_0xf075('0x42')]);return _0x66b485[_0xf075('0x67')](_0x41617f);}})[_0xf075('0x26')](function(_0x356465){if(!_[_0xf075('0x6f')](_0x356465)){var _0x519b6a=toCsv(_0x356465);var _0x2e32f2=Date[_0xf075('0x70')]();fs[_0xf075('0x71')](util['format']('/tmp/list_%d_%s.csv',_0x66b485['id'],_0x2e32f2),_0x519b6a);_0x327036[_0xf075('0x72')]('Content-disposition',_0xf075('0x73')+util[_0xf075('0x6a')](_0xf075('0x74'),_0x66b485['id'],_0x2e32f2));_0x327036['setHeader'](_0xf075('0x75'),'text/csv');return _0x327036['download'](util['format'](_0xf075('0x76'),_0x66b485['id'],_0x2e32f2));}else{return _0x327036[_0xf075('0x1c')](0xcc);}})[_0xf075('0x48')](handleError(_0x327036,null));};exports[_0xf075('0x77')]=function(_0x15dbfd,_0x9de7bd,_0x38af35){var _0x2491bd;delete _0x15dbfd[_0xf075('0x4c')]['id'];return db['CmList']['findOne']({'where':{'id':_0x15dbfd[_0xf075('0x54')]['id']}})[_0xf075('0x26')](handleEntityNotFound(_0x9de7bd,null))[_0xf075('0x26')](function(_0x3d6cc6){if(_0x3d6cc6){return db[_0xf075('0x78')][_0xf075('0x79')](function(_0x47cdc6){return db['CmCustomField']['create'](_0x15dbfd[_0xf075('0x4c')],{'transaction':_0x47cdc6})[_0xf075('0x26')](function(_0x339154){_0x2491bd=_0x339154;return _0x3d6cc6[_0xf075('0x7a')](_0x339154,{'transaction':_0x47cdc6});})[_0xf075('0x26')](function(){var _0x3178cd={'type':db[_0xf075('0x7b')][_0xf075('0x7c')],'transaction':_0x47cdc6};switch(_0x15dbfd[_0xf075('0x4c')][_0xf075('0x7d')]){case _0xf075('0x7e'):_0x3178cd[_0xf075('0x7d')]=db[_0xf075('0x7b')]['TEXT'];break;case _0xf075('0x7f'):_0x3178cd[_0xf075('0x7d')]=db[_0xf075('0x7b')][_0xf075('0x80')];break;case _0xf075('0x81'):_0x3178cd['type']=db[_0xf075('0x7b')][_0xf075('0x82')];_0x3178cd[_0xf075('0x83')]=![];break;default:}return db[_0xf075('0x78')][_0xf075('0x84')][_0xf075('0x85')](_0xf075('0x86'),util['format']('cf_%s',_0x2491bd['id']),_0x3178cd);})[_0xf075('0x26')](function(){return _0x2491bd;});});}})['then'](respondWithResult(_0x9de7bd,null))['catch'](handleError(_0x9de7bd,null));};exports[_0xf075('0x87')]=function(_0x1306c5,_0x1c0119,_0x4655f0){var _0x4097be={};var _0x5a5fbb={};var _0x504d6e;var _0x38d5bc;return db[_0xf075('0x43')][_0xf075('0x88')]({'where':{'id':_0x1306c5[_0xf075('0x54')]['id']}})[_0xf075('0x26')](handleEntityNotFound(_0x1c0119,null))[_0xf075('0x26')](function(_0x4ab100){if(_0x4ab100){_0x504d6e=_0x4ab100;_0x5a5fbb[_0xf075('0x31')]=_['keys'](db[_0xf075('0x68')]['rawAttributes']);_0x5a5fbb[_0xf075('0x32')]=_[_0xf075('0x33')](_0x1306c5[_0xf075('0x32')]);_0x5a5fbb[_0xf075('0x34')]=_[_0xf075('0x35')](_0x5a5fbb['model'],_0x5a5fbb[_0xf075('0x32')]);_0x4097be[_0xf075('0x36')]=_[_0xf075('0x35')](_0x5a5fbb[_0xf075('0x31')],qs[_0xf075('0x37')](_0x1306c5['query'][_0xf075('0x37')]));_0x4097be['attributes']=_0x4097be[_0xf075('0x36')][_0xf075('0x38')]?_0x4097be[_0xf075('0x36')]:_0x5a5fbb[_0xf075('0x31')];_0x4097be[_0xf075('0x3a')]=qs['sort'](_0x1306c5[_0xf075('0x32')]['sort']);_0x4097be[_0xf075('0x3c')]=qs['filters'](_[_0xf075('0x3d')](_0x1306c5[_0xf075('0x32')],_0x5a5fbb[_0xf075('0x34')]));_0x4097be[_0xf075('0x3c')]=_['merge'](_0x4097be[_0xf075('0x3c')],{'$or':[{'ListId':_0x4ab100['id']},{'ListId':null}]});if(_0x1306c5['query'][_0xf075('0x3e')]){_0x4097be[_0xf075('0x3c')]=_[_0xf075('0x3f')](_0x4097be[_0xf075('0x3c')],{'$or':_[_0xf075('0x40')](_0x4097be[_0xf075('0x36')],function(_0x1d7ebb){var _0x1ff31a={};_0x1ff31a[_0x1d7ebb]={'$like':'%'+_0x1306c5[_0xf075('0x32')][_0xf075('0x3e')]+'%'};return _0x1ff31a;})});}_0x4097be=_[_0xf075('0x3f')]({},_0x4097be,_0x1306c5[_0xf075('0x42')]);return db[_0xf075('0x68')][_0xf075('0x89')](_0x4097be);}})[_0xf075('0x26')](respondWithResult(_0x1c0119,null))[_0xf075('0x48')](handleError(_0x1c0119,null));};exports['addAgents']=function(_0x2acd1b,_0x5a46a7,_0x249c26){return db['CmList'][_0xf075('0x4a')]({'where':{'id':_0x2acd1b[_0xf075('0x54')]['id']}})[_0xf075('0x26')](handleEntityNotFound(_0x5a46a7,null))[_0xf075('0x26')](function(_0x54cac8){if(_0x54cac8){return _0x54cac8[_0xf075('0x8a')](_0x2acd1b['body'][_0xf075('0x59')],_[_0xf075('0x61')](_0x2acd1b['body'],[_0xf075('0x59'),'id'])||{})['spread'](function(_0x3f8910){for(var _0x3a2b34=0x0;_0x3a2b34<_0x2acd1b[_0xf075('0x4c')][_0xf075('0x59')]['length'];_0x3a2b34+=0x1){socket[_0xf075('0x8b')](_0xf075('0x8c'),{'UserId':Number(_0x2acd1b[_0xf075('0x4c')][_0xf075('0x59')][_0x3a2b34]),'CmListId':Number(_0x2acd1b['params']['id'])});}return _0x3f8910;});}})[_0xf075('0x26')](respondWithResult(_0x5a46a7,null))[_0xf075('0x48')](handleError(_0x5a46a7,null));};exports[_0xf075('0x8d')]=function(_0x20854a,_0x3f9261,_0x3758da){return db[_0xf075('0x43')][_0xf075('0x4a')]({'where':{'id':_0x20854a[_0xf075('0x54')]['id']}})['then'](handleEntityNotFound(_0x3f9261,null))[_0xf075('0x26')](function(_0x4e2d24){if(_0x4e2d24){return _0x4e2d24[_0xf075('0x8d')](_0x20854a[_0xf075('0x32')][_0xf075('0x59')])[_0xf075('0x26')](function(){if(_[_0xf075('0x5e')](_0x20854a[_0xf075('0x32')][_0xf075('0x59')])){for(var _0x4e8c81=0x0;_0x4e8c81<_0x20854a[_0xf075('0x32')][_0xf075('0x59')][_0xf075('0x38')];_0x4e8c81+=0x1){socket['emit'](_0xf075('0x8e'),{'UserId':Number(_0x20854a['query'][_0xf075('0x59')][_0x4e8c81]),'CmListId':Number(_0x20854a['params']['id'])});}}else{socket[_0xf075('0x8b')]('userCmList:remove',{'UserId':Number(_0x20854a[_0xf075('0x32')][_0xf075('0x59')]),'CmListId':Number(_0x20854a[_0xf075('0x54')]['id'])});}});}})[_0xf075('0x26')](respondWithStatusCode(_0x3f9261,null))['catch'](handleError(_0x3f9261,null));};exports['getAgents']=function(_0x59bd21,_0x567126,_0x3311d1){var _0x27e036={};var _0x32e7dc={};var _0x24d6d3;var _0x3eee27;return db[_0xf075('0x43')][_0xf075('0x88')]({'where':{'id':_0x59bd21[_0xf075('0x54')]['id']}})['then'](handleEntityNotFound(_0x567126,null))[_0xf075('0x26')](function(_0xe2a0ff){if(_0xe2a0ff){_0x24d6d3=_0xe2a0ff;_0x32e7dc[_0xf075('0x31')]=_[_0xf075('0x33')](db['User'][_0xf075('0x2f')]);_0x32e7dc[_0xf075('0x32')]=_[_0xf075('0x33')](_0x59bd21['query']);_0x32e7dc[_0xf075('0x34')]=_['intersection'](_0x32e7dc[_0xf075('0x31')],_0x32e7dc[_0xf075('0x32')]);_0x27e036['attributes']=_['intersection'](_0x32e7dc['model'],qs[_0xf075('0x37')](_0x59bd21[_0xf075('0x32')][_0xf075('0x37')]));_0x27e036['attributes']=_0x27e036[_0xf075('0x36')][_0xf075('0x38')]?_0x27e036[_0xf075('0x36')]:_0x32e7dc['model'];_0x27e036[_0xf075('0x3a')]=qs[_0xf075('0x3b')](_0x59bd21[_0xf075('0x32')][_0xf075('0x3b')]);_0x27e036['where']=qs[_0xf075('0x34')](_[_0xf075('0x3d')](_0x59bd21[_0xf075('0x32')],_0x32e7dc['filters']));if(_0x59bd21[_0xf075('0x32')][_0xf075('0x3e')]){_0x27e036[_0xf075('0x3c')]=_[_0xf075('0x3f')](_0x27e036[_0xf075('0x3c')],{'$or':_[_0xf075('0x40')](_0x27e036[_0xf075('0x36')],function(_0x1139db){var _0x341d73={};_0x341d73[_0x1139db]={'$like':'%'+_0x59bd21[_0xf075('0x32')]['filter']+'%'};return _0x341d73;})});}_0x27e036=_[_0xf075('0x3f')]({},_0x27e036,_0x59bd21[_0xf075('0x42')]);return _0x24d6d3['getAgents'](_0x27e036);}})['then'](function(_0x1a7b59){if(_0x1a7b59){_0x3eee27=_0x1a7b59['length'];if(!_0x59bd21[_0xf075('0x32')]['hasOwnProperty'](_0xf075('0x57'))){_0x27e036[_0xf075('0x1f')]=qs['limit'](_0x59bd21['query']['limit']);_0x27e036['offset']=qs['offset'](_0x59bd21[_0xf075('0x32')][_0xf075('0x21')]);}return _0x24d6d3['getAgents'](_0x27e036);}})['then'](function(_0x47dfc0){if(_0x47dfc0){return _0x47dfc0?{'count':_0x3eee27,'rows':_0x47dfc0}:null;}})[_0xf075('0x26')](respondWithResult(_0x567126,null))[_0xf075('0x48')](handleError(_0x567126,null));};
\ No newline at end of file