Built motion from commit 14588770.|2.5.38
[motion2.git] / server / api / cmList / cmList.controller.js
index 2101069..a3e3d10 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x771a=['end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','error','stack','name','index','CmList','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Lists','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','describe','addDisposition','ListId','getDispositions','findOne','filter','Disposition','removeDispositions','addContacts','tags','isArray','join','push','each','CmContact','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','getContactsCsv','raw','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','INTEGER','switch','BOOLEAN','defaultValue','getCustomFields','addAgents','ids','spread','userCmList:remove','emit','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status'];(function(_0x303cb5,_0x16c661){var _0x3e768d=function(_0x4cadfb){while(--_0x4cadfb){_0x303cb5['push'](_0x303cb5['shift']());}};_0x3e768d(++_0x16c661);}(_0x771a,0x72));var _0xa771=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x771a[_0x334841];return _0x5beb4b;};'use strict';var pdf=require(_0xa771('0x0'));var emlformat=require(_0xa771('0x1'));var rimraf=require(_0xa771('0x2'));var zipdir=require(_0xa771('0x3'));var jsonpatch=require(_0xa771('0x4'));var rp=require('request-promise');var moment=require(_0xa771('0x5'));var BPromise=require(_0xa771('0x6'));var Mustache=require('mustache');var util=require(_0xa771('0x7'));var path=require(_0xa771('0x8'));var sox=require(_0xa771('0x9'));var csv=require(_0xa771('0xa'));var ejs=require(_0xa771('0xb'));var fs=require('fs');var _=require(_0xa771('0xc'));var squel=require('squel');var crypto=require(_0xa771('0xd'));var jsforce=require(_0xa771('0xe'));var deskjs=require(_0xa771('0xf'));var toCsv=require(_0xa771('0xa'));var querystring=require(_0xa771('0x10'));var Papa=require(_0xa771('0x11'));var Redis=require(_0xa771('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa771('0x13'));var as=require(_0xa771('0x14'));var hardwareService=require(_0xa771('0x15'));var logger=require('../../config/logger')(_0xa771('0x16'));var utils=require('../../config/utils');var config=require(_0xa771('0x17'));var licenseUtil=require(_0xa771('0x18'));var db=require(_0xa771('0x19'))['db'];config[_0xa771('0x1a')]=_[_0xa771('0x1b')](config[_0xa771('0x1a')],{'host':_0xa771('0x1c'),'port':0x18eb});var socket=require(_0xa771('0x1d'))(new Redis(config[_0xa771('0x1a')]));require(_0xa771('0x1e'))[_0xa771('0x1f')](socket);function respondWithStatusCode(_0x3cd614,_0x2f50b2){_0x2f50b2=_0x2f50b2||0xcc;return function(_0x7847f4){if(_0x7847f4){return _0x3cd614[_0xa771('0x20')](_0x2f50b2);}return _0x3cd614[_0xa771('0x21')](_0x2f50b2)[_0xa771('0x22')]();};}function respondWithResult(_0x481b97,_0x20d015){_0x20d015=_0x20d015||0xc8;return function(_0xbecdb2){if(_0xbecdb2){return _0x481b97[_0xa771('0x21')](_0x20d015)[_0xa771('0x23')](_0xbecdb2);}};}function respondWithFilteredResult(_0x1b99f8,_0x2e0a40){return function(_0x332821){if(_0x332821){var _0xe21798=_0x332821[_0xa771('0x24')],_0x567f48=_0x2e0a40[_0xa771('0x25')],_0x2bbcd4=_0x2e0a40[_0xa771('0x25')]+_0x2e0a40[_0xa771('0x26')],_0x3e7793;if(_0x2bbcd4>=_0xe21798){_0x2bbcd4=_0xe21798;_0x3e7793=0xc8;}else{_0x3e7793=0xce;}_0x1b99f8[_0xa771('0x21')](_0x3e7793);return _0x1b99f8[_0xa771('0x27')]('Content-Range',_0x567f48+'-'+_0x2bbcd4+'/'+_0xe21798)[_0xa771('0x23')](_0x332821);}return null;};}function patchUpdates(_0x3d1dc2){return function(_0xc0ba57){try{jsonpatch[_0xa771('0x28')](_0xc0ba57,_0x3d1dc2,!![]);}catch(_0x21b52a){return BPromise[_0xa771('0x29')](_0x21b52a);}return _0xc0ba57[_0xa771('0x2a')]();};}function saveUpdates(_0x378f07,_0x2a5f26){return function(_0x742b1d){if(_0x742b1d){return _0x742b1d[_0xa771('0x2b')](_0x378f07)[_0xa771('0x2c')](function(_0x3ad3c3){return _0x3ad3c3;});}return null;};}function removeEntity(_0x55e9d6,_0x147633){return function(_0x376158){if(_0x376158){return _0x376158[_0xa771('0x2d')]()[_0xa771('0x2c')](function(){var _0x5e87e4=_0x376158[_0xa771('0x2e')]({'plain':!![]});var _0x5c5dae='Lists';return db['UserProfileResource'][_0xa771('0x2d')]({'where':{'type':_0x5c5dae,'resourceId':_0x5e87e4['id']}})['then'](function(){return _0x376158;});})[_0xa771('0x2c')](function(){_0x55e9d6[_0xa771('0x21')](0xcc)[_0xa771('0x22')]();});}};}function handleEntityNotFound(_0x299ef3,_0x332e01){return function(_0x4d7948){if(!_0x4d7948){_0x299ef3[_0xa771('0x20')](0x194);}return _0x4d7948;};}function handleError(_0x29e357,_0x1274c8){_0x1274c8=_0x1274c8||0x1f4;return function(_0x34ebab){logger[_0xa771('0x2f')](_0x34ebab[_0xa771('0x30')]);if(_0x34ebab[_0xa771('0x31')]){delete _0x34ebab[_0xa771('0x31')];}_0x29e357['status'](_0x1274c8)['send'](_0x34ebab);};}exports[_0xa771('0x32')]=function(_0x53d002,_0x23e40d){var _0x5b5851={},_0x2abd49={},_0x165421={'count':0x0,'rows':[]};var _0x4c44c6=_['map'](db[_0xa771('0x33')]['rawAttributes'],function(_0x19fee6){return{'name':_0x19fee6[_0xa771('0x34')],'type':_0x19fee6['type'][_0xa771('0x35')]};});_0x2abd49[_0xa771('0x36')]=_['map'](_0x4c44c6,_0xa771('0x31'));_0x2abd49[_0xa771('0x37')]=_[_0xa771('0x38')](_0x53d002['query']);_0x2abd49[_0xa771('0x39')]=_[_0xa771('0x3a')](_0x2abd49[_0xa771('0x36')],_0x2abd49['query']);_0x5b5851[_0xa771('0x3b')]=_['intersection'](_0x2abd49[_0xa771('0x36')],qs[_0xa771('0x3c')](_0x53d002[_0xa771('0x37')][_0xa771('0x3c')]));_0x5b5851[_0xa771('0x3b')]=_0x5b5851[_0xa771('0x3b')][_0xa771('0x3d')]?_0x5b5851[_0xa771('0x3b')]:_0x2abd49[_0xa771('0x36')];if(!_0x53d002['query'][_0xa771('0x3e')](_0xa771('0x3f'))){_0x5b5851[_0xa771('0x26')]=qs[_0xa771('0x26')](_0x53d002[_0xa771('0x37')]['limit']);_0x5b5851[_0xa771('0x25')]=qs[_0xa771('0x25')](_0x53d002['query'][_0xa771('0x25')]);}_0x5b5851[_0xa771('0x40')]=qs['sort'](_0x53d002['query'][_0xa771('0x41')]);_0x5b5851[_0xa771('0x42')]=qs[_0xa771('0x39')](_[_0xa771('0x43')](_0x53d002[_0xa771('0x37')],_0x2abd49[_0xa771('0x39')]),_0x4c44c6);if(_0x53d002[_0xa771('0x37')]['filter']){_0x5b5851[_0xa771('0x42')]=_[_0xa771('0x44')](_0x5b5851[_0xa771('0x42')],{'$or':_[_0xa771('0x45')](_0x4c44c6,function(_0xd5bfa7){if(_0xd5bfa7[_0xa771('0x46')]!==_0xa771('0x47')){var _0x463033={};_0x463033[_0xd5bfa7[_0xa771('0x31')]]={'$like':'%'+_0x53d002[_0xa771('0x37')]['filter']+'%'};return _0x463033;}})});}_0x5b5851=_[_0xa771('0x44')]({},_0x5b5851,_0x53d002[_0xa771('0x48')]);var _0x38b315={'where':_0x5b5851[_0xa771('0x42')]};return db[_0xa771('0x33')][_0xa771('0x24')](_0x38b315)['then'](function(_0x448f3d){_0x165421[_0xa771('0x24')]=_0x448f3d;if(_0x53d002[_0xa771('0x37')][_0xa771('0x49')]){_0x5b5851[_0xa771('0x4a')]=[{'all':!![]}];}return db[_0xa771('0x33')][_0xa771('0x4b')](_0x5b5851);})[_0xa771('0x2c')](function(_0x430dc0){_0x165421[_0xa771('0x4c')]=_0x430dc0;return _0x165421;})[_0xa771('0x2c')](respondWithFilteredResult(_0x23e40d,_0x5b5851))[_0xa771('0x4d')](handleError(_0x23e40d,null));};exports[_0xa771('0x4e')]=function(_0x31b619,_0x3fabc4){var _0x147722={'raw':![],'where':{'id':_0x31b619['params']['id']}},_0x5151d7={};_0x5151d7[_0xa771('0x36')]=_['keys'](db[_0xa771('0x33')][_0xa771('0x4f')]);_0x5151d7[_0xa771('0x37')]=_['keys'](_0x31b619['query']);_0x5151d7[_0xa771('0x39')]=_[_0xa771('0x3a')](_0x5151d7['model'],_0x5151d7[_0xa771('0x37')]);_0x147722[_0xa771('0x3b')]=_['intersection'](_0x5151d7['model'],qs[_0xa771('0x3c')](_0x31b619[_0xa771('0x37')][_0xa771('0x3c')]));_0x147722['attributes']=_0x147722['attributes']['length']?_0x147722[_0xa771('0x3b')]:_0x5151d7[_0xa771('0x36')];if(_0x31b619[_0xa771('0x37')][_0xa771('0x49')]){_0x147722['include']=[{'all':!![]}];}_0x147722=_[_0xa771('0x44')]({},_0x147722,_0x31b619[_0xa771('0x48')]);return db[_0xa771('0x33')][_0xa771('0x50')](_0x147722)['then'](handleEntityNotFound(_0x3fabc4,null))[_0xa771('0x2c')](respondWithResult(_0x3fabc4,null))['catch'](handleError(_0x3fabc4,null));};exports[_0xa771('0x51')]=function(_0x5d3d19,_0x4624c1){return db['CmList'][_0xa771('0x51')](_0x5d3d19[_0xa771('0x52')],{})['then'](function(_0x5257f8){var _0x116807=_0x5d3d19['user'][_0xa771('0x2e')]({'plain':!![]});if(!_0x116807)throw new Error(_0xa771('0x53'));if(_0x116807[_0xa771('0x54')]===_0xa771('0x55')){var _0x4978a6=_0x5257f8[_0xa771('0x2e')]({'plain':!![]});var _0x2821ba=_0xa771('0x56');return db[_0xa771('0x57')]['find']({'where':{'name':_0x2821ba,'userProfileId':_0x116807[_0xa771('0x58')]},'raw':!![]})[_0xa771('0x2c')](function(_0x13c909){if(_0x13c909&&_0x13c909[_0xa771('0x59')]===0x0){return db[_0xa771('0x5a')][_0xa771('0x51')]({'name':_0x4978a6[_0xa771('0x31')],'resourceId':_0x4978a6['id'],'type':_0x13c909[_0xa771('0x31')],'sectionId':_0x13c909['id']},{})[_0xa771('0x2c')](function(){return _0x5257f8;});}else{return _0x5257f8;}})[_0xa771('0x4d')](function(_0x105a56){logger[_0xa771('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x105a56);throw _0x105a56;});}return _0x5257f8;})[_0xa771('0x2c')](respondWithResult(_0x4624c1,0xc9))[_0xa771('0x4d')](handleError(_0x4624c1,null));};exports[_0xa771('0x2b')]=function(_0x4d82ba,_0x1ca205){if(_0x4d82ba['body']['id']){delete _0x4d82ba['body']['id'];}return db['CmList'][_0xa771('0x50')]({'where':{'id':_0x4d82ba['params']['id']}})[_0xa771('0x2c')](handleEntityNotFound(_0x1ca205,null))['then'](saveUpdates(_0x4d82ba['body'],null))['then'](respondWithResult(_0x1ca205,null))['catch'](handleError(_0x1ca205,null));};exports[_0xa771('0x2d')]=function(_0x3474c7,_0x1a0409){return db[_0xa771('0x33')][_0xa771('0x50')]({'where':{'id':_0x3474c7[_0xa771('0x5b')]['id']}})[_0xa771('0x2c')](handleEntityNotFound(_0x1a0409,null))['then'](removeEntity(_0x1a0409,null))[_0xa771('0x4d')](handleError(_0x1a0409,null));};exports[_0xa771('0x5c')]=function(_0x24e8c1,_0xee3db6){return db['CmList'][_0xa771('0x5c')]()[_0xa771('0x2c')](respondWithResult(_0xee3db6,null))[_0xa771('0x4d')](handleError(_0xee3db6,null));};exports[_0xa771('0x5d')]=function(_0x58b4a0,_0x3e648d,_0x451299){if(_0x58b4a0['body']['id']){delete _0x58b4a0['body']['id'];}return db[_0xa771('0x33')][_0xa771('0x50')]({'where':{'id':_0x58b4a0[_0xa771('0x5b')]['id']}})[_0xa771('0x2c')](handleEntityNotFound(_0x3e648d,null))[_0xa771('0x2c')](function(_0x2821bd){if(_0x2821bd){_0x58b4a0[_0xa771('0x52')][_0xa771('0x5e')]=_0x2821bd['id'];return db['Disposition']['create'](_0x58b4a0[_0xa771('0x52')]);}})[_0xa771('0x2c')](respondWithResult(_0x3e648d,null))['catch'](handleError(_0x3e648d,null));};exports[_0xa771('0x5f')]=function(_0x32e614,_0x1bc035,_0x4be087){var _0x3bb742={'raw':![],'where':{}};var _0x4d8cab={};var _0x37b91c={'count':0x0,'rows':[]};return db[_0xa771('0x33')][_0xa771('0x60')]({'where':{'id':_0x32e614['params']['id']}})[_0xa771('0x2c')](handleEntityNotFound(_0x1bc035,null))[_0xa771('0x2c')](function(_0x2527db){if(_0x2527db){_0x4d8cab[_0xa771('0x36')]=_['keys'](db['Disposition']['rawAttributes']);_0x4d8cab[_0xa771('0x37')]=_[_0xa771('0x38')](_0x32e614[_0xa771('0x37')]);_0x4d8cab[_0xa771('0x39')]=_[_0xa771('0x3a')](_0x4d8cab['model'],_0x4d8cab[_0xa771('0x37')]);_0x3bb742[_0xa771('0x3b')]=_[_0xa771('0x3a')](_0x4d8cab[_0xa771('0x36')],qs[_0xa771('0x3c')](_0x32e614[_0xa771('0x37')][_0xa771('0x3c')]));_0x3bb742[_0xa771('0x3b')]=_0x3bb742[_0xa771('0x3b')]['length']?_0x3bb742[_0xa771('0x3b')]:_0x4d8cab['model'];if(!_0x32e614[_0xa771('0x37')]['hasOwnProperty'](_0xa771('0x3f'))){_0x3bb742[_0xa771('0x26')]=qs['limit'](_0x32e614['query'][_0xa771('0x26')]);_0x3bb742[_0xa771('0x25')]=qs[_0xa771('0x25')](_0x32e614['query'][_0xa771('0x25')]);}_0x3bb742['order']=qs[_0xa771('0x41')](_0x32e614['query']['sort']);_0x3bb742[_0xa771('0x42')]=qs[_0xa771('0x39')](_[_0xa771('0x43')](_0x32e614['query'],_0x4d8cab[_0xa771('0x39')]));_0x3bb742['where']['ListId']=_0x2527db['id'];if(_0x32e614['query'][_0xa771('0x61')]){_0x3bb742[_0xa771('0x42')]=_['merge'](_0x3bb742[_0xa771('0x42')],{'$or':_['map'](_0x3bb742[_0xa771('0x3b')],function(_0x12c7f0){var _0xe39400={};_0xe39400[_0x12c7f0]={'$like':'%'+_0x32e614[_0xa771('0x37')][_0xa771('0x61')]+'%'};return _0xe39400;})});}_0x3bb742=_[_0xa771('0x44')]({},_0x3bb742,_0x32e614['options']);return db[_0xa771('0x62')]['count']({'where':_0x3bb742['where']})[_0xa771('0x2c')](function(_0x3fd390){_0x37b91c['count']=_0x3fd390;if(_0x32e614[_0xa771('0x37')][_0xa771('0x49')]){_0x3bb742[_0xa771('0x4a')]=[{'all':!![]}];}return db[_0xa771('0x62')]['findAll'](_0x3bb742);})['then'](function(_0x1d1a79){_0x37b91c[_0xa771('0x4c')]=_0x1d1a79;return _0x37b91c;});}})[_0xa771('0x2c')](respondWithFilteredResult(_0x1bc035,_0x3bb742))['catch'](handleError(_0x1bc035,null));};exports[_0xa771('0x63')]=function(_0x192640,_0x30da05,_0x242c40){return db[_0xa771('0x33')][_0xa771('0x50')]({'where':{'id':_0x192640[_0xa771('0x5b')]['id']}})[_0xa771('0x2c')](handleEntityNotFound(_0x30da05,null))['then'](function(_0x4a7a73){if(_0x4a7a73){return _0x4a7a73[_0xa771('0x63')](_0x192640[_0xa771('0x37')]['ids']);}})[_0xa771('0x2c')](respondWithStatusCode(_0x30da05,null))[_0xa771('0x4d')](handleError(_0x30da05,null));};exports[_0xa771('0x64')]=function(_0x32980b,_0x568a3b,_0x56e454){return db[_0xa771('0x33')][_0xa771('0x50')]({'where':{'id':_0x32980b[_0xa771('0x5b')]['id']}})[_0xa771('0x2c')](handleEntityNotFound(_0x568a3b,null))[_0xa771('0x2c')](function(_0x564c4a){if(_0x564c4a){var _0xb7b37a=[];var _0x14c8fe={'success':[],'errors':[]};return db['CmContact'][_0xa771('0x5c')]()[_0xa771('0x2c')](function(_0x1c318a){if(_0x32980b[_0xa771('0x52')][_0xa771('0x65')]&&_[_0xa771('0x66')](_0x32980b['body']['tags'])){if(_0x32980b['body'][_0xa771('0x65')]['length']){_0x32980b[_0xa771('0x52')]['tags']=_0x32980b[_0xa771('0x52')]['tags'][_0xa771('0x67')](';')+';';}else{_0x32980b['body'][_0xa771('0x65')]=null;}}else{_0x32980b[_0xa771('0x52')]['tags']=null;}if(_0x32980b['body']&&_[_0xa771('0x66')](_0x32980b[_0xa771('0x52')])){for(var _0xaef1d4=0x0;_0xaef1d4<_0x32980b[_0xa771('0x52')][_0xa771('0x3d')];_0xaef1d4+=0x1){_0x32980b[_0xa771('0x52')][_0xaef1d4]['ListId']=_0x32980b[_0xa771('0x5b')]['id'];_0xb7b37a[_0xa771('0x68')](_0x32980b[_0xa771('0x52')][_0xaef1d4]);}return BPromise[_0xa771('0x69')](_0xb7b37a,function(_0x5911a7){return db[_0xa771('0x6a')]['create'](_[_0xa771('0x6b')](_0x5911a7,['ids','id'])||{},{'fields':_['keys'](_0x1c318a),'raw':!![]})[_0xa771('0x2c')](function(_0x47bb30){_0x14c8fe['success'][_0xa771('0x68')](_0x47bb30[_0xa771('0x6c')]);})[_0xa771('0x4d')](function(_0x127143){_0x14c8fe[_0xa771('0x6d')][_0xa771('0x68')]({'data':_0x5911a7,'error':_0x127143[_0xa771('0x6e')]});});})['then'](function(_0x5aa36f){return _0x14c8fe;})[_0xa771('0x4d')](function(_0x2222ae){return _0x2222ae;});}else{_0x568a3b[_0xa771('0x21')](0x190)[_0xa771('0x23')]({'message':_0xa771('0x6f')});}});}})[_0xa771('0x2c')](respondWithResult(_0x568a3b,null))[_0xa771('0x4d')](handleError(_0x568a3b,null));};exports[_0xa771('0x70')]=function(_0x1fc892,_0x42ff50,_0x28b660){var _0x480764;return db[_0xa771('0x33')][_0xa771('0x50')]({'where':{'id':_0x1fc892[_0xa771('0x5b')]['id']},'include':[{'model':db[_0xa771('0x71')],'as':_0xa771('0x72')}]})[_0xa771('0x2c')](handleEntityNotFound(_0x42ff50,null))[_0xa771('0x2c')](function(_0xc61ef1){if(_0xc61ef1){_0x480764=_0xc61ef1;return db[_0xa771('0x6a')][_0xa771('0x4f')];}})['then'](function(_0x25c8e8){if(_0x25c8e8){var _0x420df2={};var _0x1d2bda={};_0x1d2bda[_0xa771('0x36')]=_[_0xa771('0x73')](_[_0xa771('0x38')](_0x25c8e8),_[_0xa771('0x45')](_0x480764[_0xa771('0x72')],function(_0x1c900e){return util[_0xa771('0x74')](_0xa771('0x75'),_0x1c900e['id']);}));_0x1d2bda[_0xa771('0x37')]=_['keys'](_0x1fc892[_0xa771('0x37')]);_0x1d2bda[_0xa771('0x39')]=_[_0xa771('0x3a')](_0x1d2bda[_0xa771('0x36')],_0x1d2bda[_0xa771('0x37')]);_0x420df2[_0xa771('0x3b')]=_[_0xa771('0x3a')](_0x1d2bda[_0xa771('0x36')],qs['fields'](_0x1fc892['query'][_0xa771('0x3c')]));_0x420df2[_0xa771('0x3b')]=_0x420df2[_0xa771('0x3b')][_0xa771('0x3d')]?_0x420df2[_0xa771('0x3b')]:_0x1d2bda['model'];if(!_0x1fc892[_0xa771('0x37')]['hasOwnProperty'](_0xa771('0x3f'))){_0x420df2[_0xa771('0x26')]=qs['limit'](_0x1fc892[_0xa771('0x37')]['limit']);_0x420df2[_0xa771('0x25')]=qs['offset'](_0x1fc892[_0xa771('0x37')]['offset']);}_0x420df2['order']=qs[_0xa771('0x41')](_0x1fc892[_0xa771('0x37')]['sort']);_0x420df2['where']=qs[_0xa771('0x39')](_[_0xa771('0x43')](_0x1fc892[_0xa771('0x37')],_0x1d2bda[_0xa771('0x39')]));_0x420df2['raw']=!![];if(_0x1fc892[_0xa771('0x37')][_0xa771('0x61')]){_0x420df2[_0xa771('0x42')]=_[_0xa771('0x44')](_0x420df2[_0xa771('0x42')],{'$or':_[_0xa771('0x45')](_0x420df2[_0xa771('0x3b')],function(_0x38e27b){var _0x285b56={};_0x285b56[_0x38e27b]={'$like':'%'+_0x1fc892[_0xa771('0x37')][_0xa771('0x61')]+'%'};return _0x285b56;})});}_0x420df2=_[_0xa771('0x44')]({},_0x420df2,_0x1fc892[_0xa771('0x48')]);return _0x480764[_0xa771('0x70')](_0x420df2);}})[_0xa771('0x2c')](respondWithResult(_0x42ff50,null))[_0xa771('0x4d')](handleError(_0x42ff50,null));};exports[_0xa771('0x76')]=function(_0x247fcc,_0x4f2301,_0x249162){var _0x3162ca;return db[_0xa771('0x33')][_0xa771('0x50')]({'where':{'id':_0x247fcc[_0xa771('0x5b')]['id']},'include':[{'model':db[_0xa771('0x71')],'as':'CustomFields'}]})[_0xa771('0x2c')](handleEntityNotFound(_0x4f2301,null))[_0xa771('0x2c')](function(_0x1b3f96){if(_0x1b3f96){_0x3162ca=_0x1b3f96;return db['CmContact'][_0xa771('0x4f')];}})['then'](function(_0x22663e){if(_0x22663e){var _0x233bf7={};var _0x49dc={};_0x49dc[_0xa771('0x36')]=_[_0xa771('0x73')](_['keys'](_0x22663e),_[_0xa771('0x45')](_0x3162ca[_0xa771('0x72')],function(_0x2c39cd){return util['format'](_0xa771('0x75'),_0x2c39cd['id']);}));_0x49dc[_0xa771('0x37')]=_[_0xa771('0x38')](_0x247fcc[_0xa771('0x37')]);_0x49dc[_0xa771('0x39')]=_[_0xa771('0x3a')](_0x49dc[_0xa771('0x36')],_0x49dc['query']);_0x233bf7['attributes']=_[_0xa771('0x3a')](_0x49dc[_0xa771('0x36')],qs[_0xa771('0x3c')](_0x247fcc[_0xa771('0x37')][_0xa771('0x3c')]));_0x233bf7[_0xa771('0x3b')]=_0x233bf7[_0xa771('0x3b')][_0xa771('0x3d')]?_0x233bf7[_0xa771('0x3b')]:_0x49dc[_0xa771('0x36')];if(!_0x247fcc[_0xa771('0x37')]['hasOwnProperty'](_0xa771('0x3f'))){_0x233bf7[_0xa771('0x26')]=qs[_0xa771('0x26')](_0x247fcc[_0xa771('0x37')][_0xa771('0x26')]);_0x233bf7[_0xa771('0x25')]=qs[_0xa771('0x25')](_0x247fcc['query']['offset']);}_0x233bf7['order']=qs['sort'](_0x247fcc['query'][_0xa771('0x41')]);_0x233bf7['where']=qs[_0xa771('0x39')](_['pick'](_0x247fcc['query'],_0x49dc['filters']));_0x233bf7[_0xa771('0x77')]=!![];if(_0x247fcc[_0xa771('0x37')][_0xa771('0x61')]){_0x233bf7[_0xa771('0x42')]=_[_0xa771('0x44')](_0x233bf7['where'],{'$or':_[_0xa771('0x45')](_0x233bf7[_0xa771('0x3b')],function(_0x3e8ee2){var _0x2bc219={};_0x2bc219[_0x3e8ee2]={'$like':'%'+_0x247fcc[_0xa771('0x37')]['filter']+'%'};return _0x2bc219;})});}_0x233bf7=_[_0xa771('0x44')]({},_0x233bf7,_0x247fcc['options']);return _0x3162ca[_0xa771('0x70')](_0x233bf7);}})['then'](function(_0x561063){if(!_[_0xa771('0x78')](_0x561063)){var _0x2a9ecb=toCsv(_0x561063);var _0x4bc9dd=Date['now']();fs[_0xa771('0x79')](util[_0xa771('0x74')](_0xa771('0x7a'),_0x3162ca['id'],_0x4bc9dd),_0x2a9ecb);_0x4f2301[_0xa771('0x7b')](_0xa771('0x7c'),'attachment;\x20filename='+util['format'](_0xa771('0x7d'),_0x3162ca['id'],_0x4bc9dd));_0x4f2301['setHeader'](_0xa771('0x7e'),_0xa771('0x7f'));return _0x4f2301[_0xa771('0x80')](util[_0xa771('0x74')](_0xa771('0x7a'),_0x3162ca['id'],_0x4bc9dd));}else{return _0x4f2301[_0xa771('0x20')](0xcc);}})[_0xa771('0x4d')](handleError(_0x4f2301,null));};exports[_0xa771('0x81')]=function(_0x2db627,_0x55dd8c,_0x2753e1){var _0x5770aa;delete _0x2db627[_0xa771('0x52')]['id'];return db['CmList'][_0xa771('0x60')]({'where':{'id':_0x2db627[_0xa771('0x5b')]['id']}})[_0xa771('0x2c')](handleEntityNotFound(_0x55dd8c,null))['then'](function(_0x20ef2c){if(_0x20ef2c){return db[_0xa771('0x82')][_0xa771('0x83')](function(_0x446881){return db[_0xa771('0x71')][_0xa771('0x51')](_0x2db627['body'],{'transaction':_0x446881})[_0xa771('0x2c')](function(_0x5c89b0){_0x5770aa=_0x5c89b0;return _0x20ef2c[_0xa771('0x84')](_0x5c89b0,{'transaction':_0x446881});})[_0xa771('0x2c')](function(){var _0x267870={'type':db[_0xa771('0x85')]['TEXT'],'transaction':_0x446881};switch(_0x2db627['body']['type']){case _0xa771('0x86'):_0x267870['type']=db['Sequelize'][_0xa771('0x87')];break;case'number':_0x267870[_0xa771('0x46')]=db['Sequelize'][_0xa771('0x88')];break;case _0xa771('0x89'):_0x267870[_0xa771('0x46')]=db['Sequelize'][_0xa771('0x8a')];_0x267870[_0xa771('0x8b')]=![];break;default:}return db[_0xa771('0x82')]['queryInterface']['addColumn']('cm_contacts',util['format']('cf_%s',_0x5770aa['id']),_0x267870);})['then'](function(){return _0x5770aa;});});}})[_0xa771('0x2c')](respondWithResult(_0x55dd8c,null))[_0xa771('0x4d')](handleError(_0x55dd8c,null));};exports[_0xa771('0x8c')]=function(_0x564366,_0x278255,_0x276fb5){var _0x471734={};var _0x351505={};var _0x5d8e2e;var _0x35524a;return db[_0xa771('0x33')][_0xa771('0x60')]({'where':{'id':_0x564366['params']['id']}})[_0xa771('0x2c')](handleEntityNotFound(_0x278255,null))[_0xa771('0x2c')](function(_0x2f2684){if(_0x2f2684){_0x5d8e2e=_0x2f2684;_0x351505[_0xa771('0x36')]=_['keys'](db[_0xa771('0x71')][_0xa771('0x4f')]);_0x351505[_0xa771('0x37')]=_['keys'](_0x564366['query']);_0x351505[_0xa771('0x39')]=_[_0xa771('0x3a')](_0x351505[_0xa771('0x36')],_0x351505[_0xa771('0x37')]);_0x471734[_0xa771('0x3b')]=_[_0xa771('0x3a')](_0x351505['model'],qs[_0xa771('0x3c')](_0x564366['query'][_0xa771('0x3c')]));_0x471734['attributes']=_0x471734[_0xa771('0x3b')][_0xa771('0x3d')]?_0x471734[_0xa771('0x3b')]:_0x351505[_0xa771('0x36')];_0x471734['order']=qs[_0xa771('0x41')](_0x564366[_0xa771('0x37')][_0xa771('0x41')]);_0x471734[_0xa771('0x42')]=qs[_0xa771('0x39')](_[_0xa771('0x43')](_0x564366['query'],_0x351505['filters']));_0x471734[_0xa771('0x42')]=_[_0xa771('0x44')](_0x471734[_0xa771('0x42')],{'$or':[{'ListId':_0x2f2684['id']},{'ListId':null}]});if(_0x564366[_0xa771('0x37')][_0xa771('0x61')]){_0x471734[_0xa771('0x42')]=_[_0xa771('0x44')](_0x471734[_0xa771('0x42')],{'$or':_[_0xa771('0x45')](_0x471734['attributes'],function(_0x2e5b3e){var _0x5f9b9a={};_0x5f9b9a[_0x2e5b3e]={'$like':'%'+_0x564366['query'][_0xa771('0x61')]+'%'};return _0x5f9b9a;})});}_0x471734=_[_0xa771('0x44')]({},_0x471734,_0x564366[_0xa771('0x48')]);return db[_0xa771('0x71')]['findAndCountAll'](_0x471734);}})[_0xa771('0x2c')](respondWithResult(_0x278255,null))[_0xa771('0x4d')](handleError(_0x278255,null));};exports[_0xa771('0x8d')]=function(_0x5956ce,_0x5e1aa5,_0x24c090){return db[_0xa771('0x33')][_0xa771('0x50')]({'where':{'id':_0x5956ce[_0xa771('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5e1aa5,null))[_0xa771('0x2c')](function(_0x58193c){if(_0x58193c){return _0x58193c[_0xa771('0x8d')](_0x5956ce[_0xa771('0x52')][_0xa771('0x8e')],_[_0xa771('0x6b')](_0x5956ce[_0xa771('0x52')],[_0xa771('0x8e'),'id'])||{})[_0xa771('0x8f')](function(_0xbad839){for(var _0x3e74a7=0x0;_0x3e74a7<_0x5956ce[_0xa771('0x52')][_0xa771('0x8e')][_0xa771('0x3d')];_0x3e74a7+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5956ce[_0xa771('0x52')][_0xa771('0x8e')][_0x3e74a7],'CmListId':_0x5956ce[_0xa771('0x5b')]['id']});}return _0xbad839;});}})[_0xa771('0x2c')](respondWithResult(_0x5e1aa5,null))[_0xa771('0x4d')](handleError(_0x5e1aa5,null));};exports['removeAgents']=function(_0x54cdc9,_0x50d6d0,_0x4a5ad1){return db['CmList'][_0xa771('0x50')]({'where':{'id':_0x54cdc9[_0xa771('0x5b')]['id']}})[_0xa771('0x2c')](handleEntityNotFound(_0x50d6d0,null))['then'](function(_0x4d771d){if(_0x4d771d){return _0x4d771d['removeAgents'](_0x54cdc9[_0xa771('0x37')][_0xa771('0x8e')])['then'](function(){if(_['isArray'](_0x54cdc9[_0xa771('0x37')][_0xa771('0x8e')])){for(var _0x21ba05=0x0;_0x21ba05<_0x54cdc9[_0xa771('0x37')][_0xa771('0x8e')][_0xa771('0x3d')];_0x21ba05+=0x1){socket['emit'](_0xa771('0x90'),{'UserId':Number(_0x54cdc9[_0xa771('0x37')][_0xa771('0x8e')][_0x21ba05]),'CmListId':Number(_0x54cdc9[_0xa771('0x5b')]['id'])});}}else{socket[_0xa771('0x91')](_0xa771('0x90'),{'UserId':Number(_0x54cdc9['query']['ids']),'CmListId':Number(_0x54cdc9[_0xa771('0x5b')]['id'])});}});}})[_0xa771('0x2c')](respondWithStatusCode(_0x50d6d0,null))[_0xa771('0x4d')](handleError(_0x50d6d0,null));};exports[_0xa771('0x92')]=function(_0x1ab5d0,_0x4241db,_0xb0414a){var _0x59076b={};var _0x29d6f4={};var _0x5b3037;var _0x488f88;return db[_0xa771('0x33')]['findOne']({'where':{'id':_0x1ab5d0['params']['id']}})[_0xa771('0x2c')](handleEntityNotFound(_0x4241db,null))[_0xa771('0x2c')](function(_0x5a7379){if(_0x5a7379){_0x5b3037=_0x5a7379;_0x29d6f4[_0xa771('0x36')]=_[_0xa771('0x38')](db[_0xa771('0x93')][_0xa771('0x4f')]);_0x29d6f4[_0xa771('0x37')]=_['keys'](_0x1ab5d0[_0xa771('0x37')]);_0x29d6f4[_0xa771('0x39')]=_[_0xa771('0x3a')](_0x29d6f4['model'],_0x29d6f4[_0xa771('0x37')]);_0x59076b[_0xa771('0x3b')]=_[_0xa771('0x3a')](_0x29d6f4[_0xa771('0x36')],qs[_0xa771('0x3c')](_0x1ab5d0['query'][_0xa771('0x3c')]));_0x59076b['attributes']=_0x59076b[_0xa771('0x3b')][_0xa771('0x3d')]?_0x59076b[_0xa771('0x3b')]:_0x29d6f4[_0xa771('0x36')];_0x59076b[_0xa771('0x40')]=qs[_0xa771('0x41')](_0x1ab5d0[_0xa771('0x37')][_0xa771('0x41')]);_0x59076b[_0xa771('0x42')]=qs[_0xa771('0x39')](_[_0xa771('0x43')](_0x1ab5d0['query'],_0x29d6f4[_0xa771('0x39')]));if(_0x1ab5d0[_0xa771('0x37')][_0xa771('0x61')]){_0x59076b['where']=_[_0xa771('0x44')](_0x59076b[_0xa771('0x42')],{'$or':_[_0xa771('0x45')](_0x59076b[_0xa771('0x3b')],function(_0xf0cbe5){var _0x5eb009={};_0x5eb009[_0xf0cbe5]={'$like':'%'+_0x1ab5d0[_0xa771('0x37')][_0xa771('0x61')]+'%'};return _0x5eb009;})});}_0x59076b=_[_0xa771('0x44')]({},_0x59076b,_0x1ab5d0['options']);return _0x5b3037[_0xa771('0x92')](_0x59076b);}})[_0xa771('0x2c')](function(_0x3a9135){if(_0x3a9135){_0x488f88=_0x3a9135[_0xa771('0x3d')];if(!_0x1ab5d0[_0xa771('0x37')][_0xa771('0x3e')](_0xa771('0x3f'))){_0x59076b[_0xa771('0x26')]=qs[_0xa771('0x26')](_0x1ab5d0[_0xa771('0x37')][_0xa771('0x26')]);_0x59076b[_0xa771('0x25')]=qs[_0xa771('0x25')](_0x1ab5d0[_0xa771('0x37')]['offset']);}return _0x5b3037[_0xa771('0x92')](_0x59076b);}})[_0xa771('0x2c')](function(_0xb97ec8){if(_0xb97ec8){return _0xb97ec8?{'count':_0x488f88,'rows':_0xb97ec8}:null;}})[_0xa771('0x2c')](respondWithResult(_0x4241db,null))[_0xa771('0x4d')](handleError(_0x4241db,null));};
\ No newline at end of file
+var _0x4143=['../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Lists','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','CmList','includeAll','include','findAll','rows','show','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','findOne','Disposition','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','dataValues','errors','message','CmCustomField','CustomFields','concat','raw','getContacts','getContactsCsv','format','isEmpty','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sendStatus','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x4143,0x106));var _0x3414=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4143[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x3414('0x0'));var rimraf=require(_0x3414('0x1'));var zipdir=require(_0x3414('0x2'));var jsonpatch=require(_0x3414('0x3'));var rp=require(_0x3414('0x4'));var moment=require(_0x3414('0x5'));var BPromise=require(_0x3414('0x6'));var Mustache=require(_0x3414('0x7'));var util=require(_0x3414('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x3414('0x9'));var ejs=require(_0x3414('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3414('0xb'));var squel=require(_0x3414('0xc'));var crypto=require('crypto');var jsforce=require(_0x3414('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3414('0x9'));var querystring=require(_0x3414('0xe'));var Papa=require(_0x3414('0xf'));var Redis=require(_0x3414('0x10'));var authService=require(_0x3414('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3414('0x12'));var hardwareService=require(_0x3414('0x13'));var logger=require(_0x3414('0x14'))(_0x3414('0x15'));var utils=require(_0x3414('0x16'));var config=require(_0x3414('0x17'));var licenseUtil=require(_0x3414('0x18'));var db=require(_0x3414('0x19'))['db'];config[_0x3414('0x1a')]=_[_0x3414('0x1b')](config['redis'],{'host':_0x3414('0x1c'),'port':0x18eb});var socket=require(_0x3414('0x1d'))(new Redis(config[_0x3414('0x1a')]));require(_0x3414('0x1e'))[_0x3414('0x1f')](socket);function respondWithStatusCode(_0xe86160,_0x4e7bb3){_0x4e7bb3=_0x4e7bb3||0xcc;return function(_0x19396d){if(_0x19396d){return _0xe86160['sendStatus'](_0x4e7bb3);}return _0xe86160[_0x3414('0x20')](_0x4e7bb3)['end']();};}function respondWithResult(_0x595b27,_0x335cdd){_0x335cdd=_0x335cdd||0xc8;return function(_0x50ea3d){if(_0x50ea3d){return _0x595b27[_0x3414('0x20')](_0x335cdd)[_0x3414('0x21')](_0x50ea3d);}};}function respondWithFilteredResult(_0x656dd9,_0x380903){return function(_0x279733){if(_0x279733){var _0x542762=typeof _0x380903[_0x3414('0x22')]===_0x3414('0x23')&&typeof _0x380903[_0x3414('0x24')]===_0x3414('0x23');var _0x226513=_0x279733['count'];var _0x3e5f54=_0x542762?0x0:_0x380903['offset'];var _0xee09e6=_0x542762?_0x279733[_0x3414('0x25')]:_0x380903[_0x3414('0x22')]+_0x380903[_0x3414('0x24')];var _0x5f2ab3;if(_0xee09e6>=_0x226513){_0xee09e6=_0x226513;_0x5f2ab3=0xc8;}else{_0x5f2ab3=0xce;}_0x656dd9[_0x3414('0x20')](_0x5f2ab3);return _0x656dd9[_0x3414('0x26')](_0x3414('0x27'),_0x3e5f54+'-'+_0xee09e6+'/'+_0x226513)['json'](_0x279733);}return null;};}function patchUpdates(_0x384798){return function(_0x387ea5){try{jsonpatch[_0x3414('0x28')](_0x387ea5,_0x384798,!![]);}catch(_0x284fac){return BPromise[_0x3414('0x29')](_0x284fac);}return _0x387ea5[_0x3414('0x2a')]();};}function saveUpdates(_0x53aacb,_0x321d6e){return function(_0x6f2ff0){if(_0x6f2ff0){return _0x6f2ff0[_0x3414('0x2b')](_0x53aacb)[_0x3414('0x2c')](function(_0x17104e){return _0x17104e;});}return null;};}function removeEntity(_0x3024bd,_0x19dd6f){return function(_0x1ac1a1){if(_0x1ac1a1){return _0x1ac1a1['destroy']()[_0x3414('0x2c')](function(){var _0x3f7df4=_0x1ac1a1[_0x3414('0x2d')]({'plain':!![]});var _0x388c6f=_0x3414('0x2e');return db['UserProfileResource'][_0x3414('0x2f')]({'where':{'type':_0x388c6f,'resourceId':_0x3f7df4['id']}})[_0x3414('0x2c')](function(){return _0x1ac1a1;});})[_0x3414('0x2c')](function(){_0x3024bd[_0x3414('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x850c33,_0x291ae1){return function(_0x2d0fac){if(!_0x2d0fac){_0x850c33['sendStatus'](0x194);}return _0x2d0fac;};}function handleError(_0x35828d,_0xbc46f1){_0xbc46f1=_0xbc46f1||0x1f4;return function(_0x13fc1b){logger[_0x3414('0x30')](_0x13fc1b[_0x3414('0x31')]);if(_0x13fc1b[_0x3414('0x32')]){delete _0x13fc1b[_0x3414('0x32')];}_0x35828d[_0x3414('0x20')](_0xbc46f1)[_0x3414('0x33')](_0x13fc1b);};}exports['index']=function(_0xa13ddf,_0x5dec04){var _0x168d76={},_0x21548c={},_0x2ac19a={'count':0x0,'rows':[]};var _0x34169a=_[_0x3414('0x34')](db['CmList'][_0x3414('0x35')],function(_0x431d03){return{'name':_0x431d03[_0x3414('0x36')],'type':_0x431d03[_0x3414('0x37')][_0x3414('0x38')]};});_0x21548c[_0x3414('0x39')]=_[_0x3414('0x34')](_0x34169a,_0x3414('0x32'));_0x21548c[_0x3414('0x3a')]=_[_0x3414('0x3b')](_0xa13ddf[_0x3414('0x3a')]);_0x21548c[_0x3414('0x3c')]=_[_0x3414('0x3d')](_0x21548c[_0x3414('0x39')],_0x21548c[_0x3414('0x3a')]);_0x168d76[_0x3414('0x3e')]=_[_0x3414('0x3d')](_0x21548c[_0x3414('0x39')],qs[_0x3414('0x3f')](_0xa13ddf[_0x3414('0x3a')][_0x3414('0x3f')]));_0x168d76['attributes']=_0x168d76['attributes'][_0x3414('0x40')]?_0x168d76['attributes']:_0x21548c[_0x3414('0x39')];if(!_0xa13ddf[_0x3414('0x3a')][_0x3414('0x41')](_0x3414('0x42'))){_0x168d76[_0x3414('0x24')]=qs[_0x3414('0x24')](_0xa13ddf[_0x3414('0x3a')][_0x3414('0x24')]);_0x168d76[_0x3414('0x22')]=qs[_0x3414('0x22')](_0xa13ddf[_0x3414('0x3a')]['offset']);}_0x168d76[_0x3414('0x43')]=qs[_0x3414('0x44')](_0xa13ddf[_0x3414('0x3a')][_0x3414('0x44')]);_0x168d76['where']=qs[_0x3414('0x3c')](_[_0x3414('0x45')](_0xa13ddf[_0x3414('0x3a')],_0x21548c[_0x3414('0x3c')]),_0x34169a);if(_0xa13ddf[_0x3414('0x3a')][_0x3414('0x46')]){_0x168d76[_0x3414('0x47')]=_[_0x3414('0x48')](_0x168d76[_0x3414('0x47')],{'$or':_[_0x3414('0x34')](_0x34169a,function(_0x40f8b1){if(_0x40f8b1[_0x3414('0x37')]!=='VIRTUAL'){var _0x5544a5={};_0x5544a5[_0x40f8b1[_0x3414('0x32')]]={'$like':'%'+_0xa13ddf[_0x3414('0x3a')][_0x3414('0x46')]+'%'};return _0x5544a5;}})});}_0x168d76=_[_0x3414('0x48')]({},_0x168d76,_0xa13ddf[_0x3414('0x49')]);var _0x4931e2={'where':_0x168d76[_0x3414('0x47')]};return db[_0x3414('0x4a')][_0x3414('0x25')](_0x4931e2)['then'](function(_0x47dd37){_0x2ac19a[_0x3414('0x25')]=_0x47dd37;if(_0xa13ddf[_0x3414('0x3a')][_0x3414('0x4b')]){_0x168d76[_0x3414('0x4c')]=[{'all':!![]}];}return db[_0x3414('0x4a')][_0x3414('0x4d')](_0x168d76);})['then'](function(_0x532683){_0x2ac19a[_0x3414('0x4e')]=_0x532683;return _0x2ac19a;})[_0x3414('0x2c')](respondWithFilteredResult(_0x5dec04,_0x168d76))['catch'](handleError(_0x5dec04,null));};exports[_0x3414('0x4f')]=function(_0x3864b9,_0x1c26a3){var _0x283ce2={'raw':![],'where':{'id':_0x3864b9['params']['id']}},_0x50fba9={};_0x50fba9[_0x3414('0x39')]=_['keys'](db[_0x3414('0x4a')]['rawAttributes']);_0x50fba9[_0x3414('0x3a')]=_['keys'](_0x3864b9['query']);_0x50fba9[_0x3414('0x3c')]=_['intersection'](_0x50fba9[_0x3414('0x39')],_0x50fba9[_0x3414('0x3a')]);_0x283ce2['attributes']=_['intersection'](_0x50fba9[_0x3414('0x39')],qs[_0x3414('0x3f')](_0x3864b9[_0x3414('0x3a')]['fields']));_0x283ce2[_0x3414('0x3e')]=_0x283ce2[_0x3414('0x3e')][_0x3414('0x40')]?_0x283ce2['attributes']:_0x50fba9['model'];if(_0x3864b9[_0x3414('0x3a')][_0x3414('0x4b')]){_0x283ce2[_0x3414('0x4c')]=[{'all':!![]}];}_0x283ce2=_[_0x3414('0x48')]({},_0x283ce2,_0x3864b9[_0x3414('0x49')]);return db[_0x3414('0x4a')]['find'](_0x283ce2)[_0x3414('0x2c')](handleEntityNotFound(_0x1c26a3,null))[_0x3414('0x2c')](respondWithResult(_0x1c26a3,null))[_0x3414('0x50')](handleError(_0x1c26a3,null));};exports['create']=function(_0x3a4e8b,_0x234fd7){return db['CmList'][_0x3414('0x51')](_0x3a4e8b[_0x3414('0x52')],{})[_0x3414('0x2c')](function(_0x263edd){var _0x346f81=_0x3a4e8b['user'][_0x3414('0x2d')]({'plain':!![]});if(!_0x346f81)throw new Error(_0x3414('0x53'));if(_0x346f81['role']===_0x3414('0x54')){var _0x53e572=_0x263edd[_0x3414('0x2d')]({'plain':!![]});var _0x3216cc='Lists';return db[_0x3414('0x55')][_0x3414('0x56')]({'where':{'name':_0x3216cc,'userProfileId':_0x346f81['userProfileId']},'raw':!![]})[_0x3414('0x2c')](function(_0xcf0033){if(_0xcf0033&&_0xcf0033[_0x3414('0x57')]===0x0){return db[_0x3414('0x58')][_0x3414('0x51')]({'name':_0x53e572['name'],'resourceId':_0x53e572['id'],'type':_0xcf0033[_0x3414('0x32')],'sectionId':_0xcf0033['id']},{})[_0x3414('0x2c')](function(){return _0x263edd;});}else{return _0x263edd;}})[_0x3414('0x50')](function(_0x27c082){logger[_0x3414('0x30')](_0x3414('0x59'),_0x27c082);throw _0x27c082;});}return _0x263edd;})[_0x3414('0x2c')](respondWithResult(_0x234fd7,0xc9))[_0x3414('0x50')](handleError(_0x234fd7,null));};exports[_0x3414('0x2b')]=function(_0x1f0b05,_0x5ef2f7){if(_0x1f0b05[_0x3414('0x52')]['id']){delete _0x1f0b05['body']['id'];}return db[_0x3414('0x4a')][_0x3414('0x56')]({'where':{'id':_0x1f0b05[_0x3414('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5ef2f7,null))['then'](saveUpdates(_0x1f0b05[_0x3414('0x52')],null))['then'](respondWithResult(_0x5ef2f7,null))[_0x3414('0x50')](handleError(_0x5ef2f7,null));};exports[_0x3414('0x2f')]=function(_0x7bbcc5,_0x138a57){return db[_0x3414('0x4a')]['find']({'where':{'id':_0x7bbcc5[_0x3414('0x5a')]['id']}})[_0x3414('0x2c')](handleEntityNotFound(_0x138a57,null))[_0x3414('0x2c')](removeEntity(_0x138a57,null))[_0x3414('0x50')](handleError(_0x138a57,null));};exports[_0x3414('0x5b')]=function(_0x32e11a,_0x3bb56c){return db[_0x3414('0x4a')][_0x3414('0x5b')]()[_0x3414('0x2c')](respondWithResult(_0x3bb56c,null))[_0x3414('0x50')](handleError(_0x3bb56c,null));};exports[_0x3414('0x5c')]=function(_0x1cac64,_0x5aea99,_0x278bf3){if(_0x1cac64[_0x3414('0x52')]['id']){delete _0x1cac64[_0x3414('0x52')]['id'];}return db[_0x3414('0x4a')]['find']({'where':{'id':_0x1cac64[_0x3414('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5aea99,null))[_0x3414('0x2c')](function(_0x176264){if(_0x176264){_0x1cac64['body'][_0x3414('0x5d')]=_0x176264['id'];return db['Disposition'][_0x3414('0x51')](_0x1cac64[_0x3414('0x52')]);}})['then'](respondWithResult(_0x5aea99,null))[_0x3414('0x50')](handleError(_0x5aea99,null));};exports['getDispositions']=function(_0x312395,_0x1c2fbd,_0x2a7de3){var _0x29c6cd={'raw':![],'where':{}};var _0x4bd11e={};var _0x2603c2={'count':0x0,'rows':[]};return db[_0x3414('0x4a')][_0x3414('0x5e')]({'where':{'id':_0x312395[_0x3414('0x5a')]['id']}})[_0x3414('0x2c')](handleEntityNotFound(_0x1c2fbd,null))['then'](function(_0x20cd06){if(_0x20cd06){_0x4bd11e[_0x3414('0x39')]=_[_0x3414('0x3b')](db[_0x3414('0x5f')][_0x3414('0x35')]);_0x4bd11e[_0x3414('0x3a')]=_[_0x3414('0x3b')](_0x312395['query']);_0x4bd11e[_0x3414('0x3c')]=_[_0x3414('0x3d')](_0x4bd11e[_0x3414('0x39')],_0x4bd11e[_0x3414('0x3a')]);_0x29c6cd[_0x3414('0x3e')]=_[_0x3414('0x3d')](_0x4bd11e[_0x3414('0x39')],qs[_0x3414('0x3f')](_0x312395[_0x3414('0x3a')][_0x3414('0x3f')]));_0x29c6cd[_0x3414('0x3e')]=_0x29c6cd[_0x3414('0x3e')][_0x3414('0x40')]?_0x29c6cd[_0x3414('0x3e')]:_0x4bd11e[_0x3414('0x39')];if(!_0x312395[_0x3414('0x3a')][_0x3414('0x41')](_0x3414('0x42'))){_0x29c6cd[_0x3414('0x24')]=qs[_0x3414('0x24')](_0x312395[_0x3414('0x3a')][_0x3414('0x24')]);_0x29c6cd[_0x3414('0x22')]=qs[_0x3414('0x22')](_0x312395[_0x3414('0x3a')][_0x3414('0x22')]);}_0x29c6cd[_0x3414('0x43')]=qs[_0x3414('0x44')](_0x312395[_0x3414('0x3a')][_0x3414('0x44')]);_0x29c6cd[_0x3414('0x47')]=qs[_0x3414('0x3c')](_['pick'](_0x312395['query'],_0x4bd11e['filters']));_0x29c6cd[_0x3414('0x47')][_0x3414('0x5d')]=_0x20cd06['id'];if(_0x312395['query'][_0x3414('0x46')]){_0x29c6cd[_0x3414('0x47')]=_[_0x3414('0x48')](_0x29c6cd[_0x3414('0x47')],{'$or':_[_0x3414('0x34')](_0x29c6cd[_0x3414('0x3e')],function(_0x2e257e){var _0x79348f={};_0x79348f[_0x2e257e]={'$like':'%'+_0x312395[_0x3414('0x3a')][_0x3414('0x46')]+'%'};return _0x79348f;})});}_0x29c6cd=_[_0x3414('0x48')]({},_0x29c6cd,_0x312395[_0x3414('0x49')]);return db[_0x3414('0x5f')][_0x3414('0x25')]({'where':_0x29c6cd['where']})[_0x3414('0x2c')](function(_0xdd0b4d){_0x2603c2[_0x3414('0x25')]=_0xdd0b4d;if(_0x312395[_0x3414('0x3a')]['includeAll']){_0x29c6cd[_0x3414('0x4c')]=[{'all':!![]}];}return db[_0x3414('0x5f')][_0x3414('0x4d')](_0x29c6cd);})[_0x3414('0x2c')](function(_0x1fc357){_0x2603c2[_0x3414('0x4e')]=_0x1fc357;return _0x2603c2;});}})['then'](respondWithFilteredResult(_0x1c2fbd,_0x29c6cd))['catch'](handleError(_0x1c2fbd,null));};exports[_0x3414('0x60')]=function(_0x477f49,_0x4d7853,_0x46555d){return db[_0x3414('0x4a')][_0x3414('0x56')]({'where':{'id':_0x477f49[_0x3414('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4d7853,null))[_0x3414('0x2c')](function(_0x105c9a){if(_0x105c9a){return _0x105c9a[_0x3414('0x60')](_0x477f49[_0x3414('0x3a')][_0x3414('0x61')]);}})[_0x3414('0x2c')](respondWithStatusCode(_0x4d7853,null))['catch'](handleError(_0x4d7853,null));};exports[_0x3414('0x62')]=function(_0x2793c2,_0x47459d,_0x3b5e37){return db[_0x3414('0x4a')][_0x3414('0x56')]({'where':{'id':_0x2793c2[_0x3414('0x5a')]['id']}})[_0x3414('0x2c')](handleEntityNotFound(_0x47459d,null))['then'](function(_0x1944e2){if(_0x1944e2){var _0x71257c=[];var _0x58b0d8={'success':[],'errors':[]};return db[_0x3414('0x63')][_0x3414('0x5b')]()['then'](function(_0x4615c7){if(_0x2793c2[_0x3414('0x52')][_0x3414('0x64')]&&_[_0x3414('0x65')](_0x2793c2[_0x3414('0x52')][_0x3414('0x64')])){if(_0x2793c2['body'][_0x3414('0x64')][_0x3414('0x40')]){_0x2793c2[_0x3414('0x52')][_0x3414('0x64')]=_0x2793c2[_0x3414('0x52')][_0x3414('0x64')][_0x3414('0x66')](';')+';';}else{_0x2793c2[_0x3414('0x52')][_0x3414('0x64')]=null;}}else{_0x2793c2[_0x3414('0x52')]['tags']=null;}if(_0x2793c2[_0x3414('0x52')]&&_[_0x3414('0x65')](_0x2793c2[_0x3414('0x52')])){for(var _0x3d035d=0x0;_0x3d035d<_0x2793c2[_0x3414('0x52')][_0x3414('0x40')];_0x3d035d+=0x1){_0x2793c2[_0x3414('0x52')][_0x3d035d][_0x3414('0x5d')]=_0x2793c2[_0x3414('0x5a')]['id'];_0x71257c[_0x3414('0x67')](_0x2793c2[_0x3414('0x52')][_0x3d035d]);}return BPromise[_0x3414('0x68')](_0x71257c,function(_0x33a8d0){return db[_0x3414('0x63')][_0x3414('0x51')](_[_0x3414('0x69')](_0x33a8d0,[_0x3414('0x61'),'id'])||{},{'fields':_[_0x3414('0x3b')](_0x4615c7),'raw':!![]})[_0x3414('0x2c')](function(_0x30c7b0){_0x58b0d8['success']['push'](_0x30c7b0[_0x3414('0x6a')]);})[_0x3414('0x50')](function(_0x357eba){_0x58b0d8[_0x3414('0x6b')][_0x3414('0x67')]({'data':_0x33a8d0,'error':_0x357eba[_0x3414('0x6c')]});});})[_0x3414('0x2c')](function(_0x10cafe){return _0x58b0d8;})['catch'](function(_0x4f98c2){return _0x4f98c2;});}else{_0x47459d[_0x3414('0x20')](0x190)[_0x3414('0x21')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x3414('0x2c')](respondWithResult(_0x47459d,null))[_0x3414('0x50')](handleError(_0x47459d,null));};exports['getContacts']=function(_0x2e4288,_0x590a79,_0x329fc2){var _0xe1199f;return db[_0x3414('0x4a')][_0x3414('0x56')]({'where':{'id':_0x2e4288[_0x3414('0x5a')]['id']},'include':[{'model':db[_0x3414('0x6d')],'as':_0x3414('0x6e')}]})[_0x3414('0x2c')](handleEntityNotFound(_0x590a79,null))[_0x3414('0x2c')](function(_0x3e183b){if(_0x3e183b){_0xe1199f=_0x3e183b;return db[_0x3414('0x63')][_0x3414('0x35')];}})[_0x3414('0x2c')](function(_0x4e2b87){if(_0x4e2b87){var _0x48f8f7={};var _0x21362f={};_0x21362f['model']=_[_0x3414('0x6f')](_[_0x3414('0x3b')](_0x4e2b87),_[_0x3414('0x34')](_0xe1199f['CustomFields'],function(_0x3ad494){return util['format']('cf_%d',_0x3ad494['id']);}));_0x21362f[_0x3414('0x3a')]=_[_0x3414('0x3b')](_0x2e4288[_0x3414('0x3a')]);_0x21362f[_0x3414('0x3c')]=_['intersection'](_0x21362f[_0x3414('0x39')],_0x21362f[_0x3414('0x3a')]);_0x48f8f7[_0x3414('0x3e')]=_[_0x3414('0x3d')](_0x21362f['model'],qs['fields'](_0x2e4288[_0x3414('0x3a')][_0x3414('0x3f')]));_0x48f8f7['attributes']=_0x48f8f7[_0x3414('0x3e')][_0x3414('0x40')]?_0x48f8f7[_0x3414('0x3e')]:_0x21362f[_0x3414('0x39')];if(!_0x2e4288[_0x3414('0x3a')][_0x3414('0x41')](_0x3414('0x42'))){_0x48f8f7[_0x3414('0x24')]=qs[_0x3414('0x24')](_0x2e4288[_0x3414('0x3a')][_0x3414('0x24')]);_0x48f8f7[_0x3414('0x22')]=qs['offset'](_0x2e4288[_0x3414('0x3a')][_0x3414('0x22')]);}_0x48f8f7['order']=qs[_0x3414('0x44')](_0x2e4288[_0x3414('0x3a')][_0x3414('0x44')]);_0x48f8f7['where']=qs[_0x3414('0x3c')](_[_0x3414('0x45')](_0x2e4288[_0x3414('0x3a')],_0x21362f[_0x3414('0x3c')]));_0x48f8f7[_0x3414('0x70')]=!![];if(_0x2e4288['query'][_0x3414('0x46')]){_0x48f8f7[_0x3414('0x47')]=_[_0x3414('0x48')](_0x48f8f7['where'],{'$or':_[_0x3414('0x34')](_0x48f8f7[_0x3414('0x3e')],function(_0x44f201){var _0x26e809={};_0x26e809[_0x44f201]={'$like':'%'+_0x2e4288[_0x3414('0x3a')][_0x3414('0x46')]+'%'};return _0x26e809;})});}_0x48f8f7=_[_0x3414('0x48')]({},_0x48f8f7,_0x2e4288[_0x3414('0x49')]);return _0xe1199f[_0x3414('0x71')](_0x48f8f7);}})[_0x3414('0x2c')](respondWithResult(_0x590a79,null))[_0x3414('0x50')](handleError(_0x590a79,null));};exports[_0x3414('0x72')]=function(_0x2edbc8,_0x4804f1,_0x200961){var _0x410790;return db[_0x3414('0x4a')][_0x3414('0x56')]({'where':{'id':_0x2edbc8[_0x3414('0x5a')]['id']},'include':[{'model':db[_0x3414('0x6d')],'as':_0x3414('0x6e')}]})[_0x3414('0x2c')](handleEntityNotFound(_0x4804f1,null))['then'](function(_0x16896f){if(_0x16896f){_0x410790=_0x16896f;return db[_0x3414('0x63')]['rawAttributes'];}})['then'](function(_0x55f724){if(_0x55f724){var _0x3f7fe9={};var _0x2733f6={};_0x2733f6[_0x3414('0x39')]=_['concat'](_[_0x3414('0x3b')](_0x55f724),_[_0x3414('0x34')](_0x410790[_0x3414('0x6e')],function(_0x201be7){return util[_0x3414('0x73')]('cf_%d',_0x201be7['id']);}));_0x2733f6[_0x3414('0x3a')]=_['keys'](_0x2edbc8['query']);_0x2733f6[_0x3414('0x3c')]=_['intersection'](_0x2733f6[_0x3414('0x39')],_0x2733f6[_0x3414('0x3a')]);_0x3f7fe9[_0x3414('0x3e')]=_[_0x3414('0x3d')](_0x2733f6['model'],qs[_0x3414('0x3f')](_0x2edbc8[_0x3414('0x3a')][_0x3414('0x3f')]));_0x3f7fe9[_0x3414('0x3e')]=_0x3f7fe9[_0x3414('0x3e')]['length']?_0x3f7fe9[_0x3414('0x3e')]:_0x2733f6[_0x3414('0x39')];if(!_0x2edbc8[_0x3414('0x3a')][_0x3414('0x41')](_0x3414('0x42'))){_0x3f7fe9['limit']=qs[_0x3414('0x24')](_0x2edbc8['query'][_0x3414('0x24')]);_0x3f7fe9['offset']=qs[_0x3414('0x22')](_0x2edbc8[_0x3414('0x3a')]['offset']);}_0x3f7fe9[_0x3414('0x43')]=qs['sort'](_0x2edbc8[_0x3414('0x3a')][_0x3414('0x44')]);_0x3f7fe9[_0x3414('0x47')]=qs['filters'](_[_0x3414('0x45')](_0x2edbc8[_0x3414('0x3a')],_0x2733f6[_0x3414('0x3c')]));_0x3f7fe9[_0x3414('0x70')]=!![];if(_0x2edbc8[_0x3414('0x3a')][_0x3414('0x46')]){_0x3f7fe9[_0x3414('0x47')]=_[_0x3414('0x48')](_0x3f7fe9[_0x3414('0x47')],{'$or':_[_0x3414('0x34')](_0x3f7fe9['attributes'],function(_0x12f71b){var _0x316b13={};_0x316b13[_0x12f71b]={'$like':'%'+_0x2edbc8[_0x3414('0x3a')]['filter']+'%'};return _0x316b13;})});}_0x3f7fe9=_[_0x3414('0x48')]({},_0x3f7fe9,_0x2edbc8['options']);return _0x410790[_0x3414('0x71')](_0x3f7fe9);}})['then'](function(_0x560d1e){if(!_[_0x3414('0x74')](_0x560d1e)){var _0x9299c9=toCsv(_0x560d1e);var _0x303b38=Date['now']();fs['writeFileSync'](util[_0x3414('0x73')]('/tmp/list_%d_%s.csv',_0x410790['id'],_0x303b38),_0x9299c9);_0x4804f1[_0x3414('0x75')](_0x3414('0x76'),_0x3414('0x77')+util['format'](_0x3414('0x78'),_0x410790['id'],_0x303b38));_0x4804f1['setHeader'](_0x3414('0x79'),_0x3414('0x7a'));return _0x4804f1[_0x3414('0x7b')](util[_0x3414('0x73')]('/tmp/list_%d_%s.csv',_0x410790['id'],_0x303b38));}else{return _0x4804f1[_0x3414('0x7c')](0xcc);}})['catch'](handleError(_0x4804f1,null));};exports['addCustomField']=function(_0x3cedb4,_0x541893,_0x59d32e){var _0x3f0686;delete _0x3cedb4[_0x3414('0x52')]['id'];return db['CmList'][_0x3414('0x5e')]({'where':{'id':_0x3cedb4[_0x3414('0x5a')]['id']}})[_0x3414('0x2c')](handleEntityNotFound(_0x541893,null))['then'](function(_0x14a469){if(_0x14a469){return db['sequelize'][_0x3414('0x7d')](function(_0x5bcb4c){return db[_0x3414('0x6d')][_0x3414('0x51')](_0x3cedb4['body'],{'transaction':_0x5bcb4c})['then'](function(_0x2004dc){_0x3f0686=_0x2004dc;return _0x14a469[_0x3414('0x7e')](_0x2004dc,{'transaction':_0x5bcb4c});})['then'](function(){var _0x176740={'type':db[_0x3414('0x7f')][_0x3414('0x80')],'transaction':_0x5bcb4c};switch(_0x3cedb4[_0x3414('0x52')][_0x3414('0x37')]){case'text':_0x176740[_0x3414('0x37')]=db[_0x3414('0x7f')][_0x3414('0x80')];break;case _0x3414('0x81'):_0x176740[_0x3414('0x37')]=db['Sequelize'][_0x3414('0x82')];break;case _0x3414('0x83'):_0x176740[_0x3414('0x37')]=db[_0x3414('0x7f')]['BOOLEAN'];_0x176740[_0x3414('0x84')]=![];break;default:}return db['sequelize'][_0x3414('0x85')][_0x3414('0x86')](_0x3414('0x87'),util[_0x3414('0x73')]('cf_%s',_0x3f0686['id']),_0x176740);})[_0x3414('0x2c')](function(){return _0x3f0686;});});}})[_0x3414('0x2c')](respondWithResult(_0x541893,null))['catch'](handleError(_0x541893,null));};exports['getCustomFields']=function(_0x3ce07b,_0x1a4cf1,_0x3ed2c0){var _0x1473ee={};var _0x165bbe={};var _0xfb3758;var _0x81d79b;return db[_0x3414('0x4a')][_0x3414('0x5e')]({'where':{'id':_0x3ce07b[_0x3414('0x5a')]['id']}})[_0x3414('0x2c')](handleEntityNotFound(_0x1a4cf1,null))['then'](function(_0xa2d092){if(_0xa2d092){_0xfb3758=_0xa2d092;_0x165bbe[_0x3414('0x39')]=_['keys'](db['CmCustomField']['rawAttributes']);_0x165bbe[_0x3414('0x3a')]=_[_0x3414('0x3b')](_0x3ce07b[_0x3414('0x3a')]);_0x165bbe[_0x3414('0x3c')]=_['intersection'](_0x165bbe[_0x3414('0x39')],_0x165bbe[_0x3414('0x3a')]);_0x1473ee[_0x3414('0x3e')]=_[_0x3414('0x3d')](_0x165bbe[_0x3414('0x39')],qs[_0x3414('0x3f')](_0x3ce07b[_0x3414('0x3a')][_0x3414('0x3f')]));_0x1473ee['attributes']=_0x1473ee[_0x3414('0x3e')]['length']?_0x1473ee[_0x3414('0x3e')]:_0x165bbe['model'];_0x1473ee[_0x3414('0x43')]=qs['sort'](_0x3ce07b[_0x3414('0x3a')][_0x3414('0x44')]);_0x1473ee[_0x3414('0x47')]=qs['filters'](_[_0x3414('0x45')](_0x3ce07b[_0x3414('0x3a')],_0x165bbe['filters']));_0x1473ee['where']=_[_0x3414('0x48')](_0x1473ee[_0x3414('0x47')],{'$or':[{'ListId':_0xa2d092['id']},{'ListId':null}]});if(_0x3ce07b[_0x3414('0x3a')][_0x3414('0x46')]){_0x1473ee['where']=_[_0x3414('0x48')](_0x1473ee[_0x3414('0x47')],{'$or':_[_0x3414('0x34')](_0x1473ee[_0x3414('0x3e')],function(_0xa69167){var _0x4f59bf={};_0x4f59bf[_0xa69167]={'$like':'%'+_0x3ce07b[_0x3414('0x3a')][_0x3414('0x46')]+'%'};return _0x4f59bf;})});}_0x1473ee=_[_0x3414('0x48')]({},_0x1473ee,_0x3ce07b[_0x3414('0x49')]);return db[_0x3414('0x6d')]['findAndCountAll'](_0x1473ee);}})[_0x3414('0x2c')](respondWithResult(_0x1a4cf1,null))[_0x3414('0x50')](handleError(_0x1a4cf1,null));};exports[_0x3414('0x88')]=function(_0x36d7ab,_0x7ca8d0,_0x28adeb){return db[_0x3414('0x4a')][_0x3414('0x56')]({'where':{'id':_0x36d7ab[_0x3414('0x5a')]['id']}})[_0x3414('0x2c')](handleEntityNotFound(_0x7ca8d0,null))[_0x3414('0x2c')](function(_0x4ee73b){if(_0x4ee73b){return _0x4ee73b[_0x3414('0x88')](_0x36d7ab[_0x3414('0x52')]['ids'],_[_0x3414('0x69')](_0x36d7ab['body'],[_0x3414('0x61'),'id'])||{})[_0x3414('0x89')](function(_0x2b7f50){for(var _0x57a0a6=0x0;_0x57a0a6<_0x36d7ab[_0x3414('0x52')][_0x3414('0x61')]['length'];_0x57a0a6+=0x1){socket[_0x3414('0x8a')](_0x3414('0x8b'),{'UserId':Number(_0x36d7ab[_0x3414('0x52')]['ids'][_0x57a0a6]),'CmListId':Number(_0x36d7ab[_0x3414('0x5a')]['id'])});}return _0x2b7f50;});}})[_0x3414('0x2c')](respondWithResult(_0x7ca8d0,null))[_0x3414('0x50')](handleError(_0x7ca8d0,null));};exports[_0x3414('0x8c')]=function(_0x29c080,_0x458552,_0x3e7538){return db[_0x3414('0x4a')][_0x3414('0x56')]({'where':{'id':_0x29c080[_0x3414('0x5a')]['id']}})[_0x3414('0x2c')](handleEntityNotFound(_0x458552,null))['then'](function(_0x214908){if(_0x214908){return _0x214908['removeAgents'](_0x29c080[_0x3414('0x3a')]['ids'])['then'](function(){if(_[_0x3414('0x65')](_0x29c080['query'][_0x3414('0x61')])){for(var _0x177f50=0x0;_0x177f50<_0x29c080[_0x3414('0x3a')][_0x3414('0x61')][_0x3414('0x40')];_0x177f50+=0x1){socket[_0x3414('0x8a')](_0x3414('0x8d'),{'UserId':Number(_0x29c080[_0x3414('0x3a')]['ids'][_0x177f50]),'CmListId':Number(_0x29c080[_0x3414('0x5a')]['id'])});}}else{socket[_0x3414('0x8a')](_0x3414('0x8d'),{'UserId':Number(_0x29c080[_0x3414('0x3a')][_0x3414('0x61')]),'CmListId':Number(_0x29c080[_0x3414('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x458552,null))[_0x3414('0x50')](handleError(_0x458552,null));};exports[_0x3414('0x8e')]=function(_0x1dd946,_0x5c06f3,_0x4c1803){var _0x5cc9ab={};var _0x3dba1c={};var _0x37a906;var _0x35902b;return db['CmList'][_0x3414('0x5e')]({'where':{'id':_0x1dd946[_0x3414('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5c06f3,null))[_0x3414('0x2c')](function(_0x76ff13){if(_0x76ff13){_0x37a906=_0x76ff13;_0x3dba1c[_0x3414('0x39')]=_[_0x3414('0x3b')](db['User'][_0x3414('0x35')]);_0x3dba1c['query']=_[_0x3414('0x3b')](_0x1dd946[_0x3414('0x3a')]);_0x3dba1c[_0x3414('0x3c')]=_[_0x3414('0x3d')](_0x3dba1c[_0x3414('0x39')],_0x3dba1c['query']);_0x5cc9ab['attributes']=_[_0x3414('0x3d')](_0x3dba1c[_0x3414('0x39')],qs[_0x3414('0x3f')](_0x1dd946[_0x3414('0x3a')]['fields']));_0x5cc9ab['attributes']=_0x5cc9ab[_0x3414('0x3e')][_0x3414('0x40')]?_0x5cc9ab[_0x3414('0x3e')]:_0x3dba1c[_0x3414('0x39')];_0x5cc9ab[_0x3414('0x43')]=qs[_0x3414('0x44')](_0x1dd946[_0x3414('0x3a')][_0x3414('0x44')]);_0x5cc9ab['where']=qs[_0x3414('0x3c')](_[_0x3414('0x45')](_0x1dd946[_0x3414('0x3a')],_0x3dba1c[_0x3414('0x3c')]));if(_0x1dd946['query'][_0x3414('0x46')]){_0x5cc9ab['where']=_[_0x3414('0x48')](_0x5cc9ab['where'],{'$or':_['map'](_0x5cc9ab['attributes'],function(_0x41e5d8){var _0x49b223={};_0x49b223[_0x41e5d8]={'$like':'%'+_0x1dd946[_0x3414('0x3a')][_0x3414('0x46')]+'%'};return _0x49b223;})});}_0x5cc9ab=_[_0x3414('0x48')]({},_0x5cc9ab,_0x1dd946[_0x3414('0x49')]);return _0x37a906[_0x3414('0x8e')](_0x5cc9ab);}})['then'](function(_0x7b1e12){if(_0x7b1e12){_0x35902b=_0x7b1e12[_0x3414('0x40')];if(!_0x1dd946[_0x3414('0x3a')][_0x3414('0x41')](_0x3414('0x42'))){_0x5cc9ab[_0x3414('0x24')]=qs[_0x3414('0x24')](_0x1dd946[_0x3414('0x3a')][_0x3414('0x24')]);_0x5cc9ab[_0x3414('0x22')]=qs[_0x3414('0x22')](_0x1dd946[_0x3414('0x3a')][_0x3414('0x22')]);}return _0x37a906[_0x3414('0x8e')](_0x5cc9ab);}})['then'](function(_0x23a393){if(_0x23a393){return _0x23a393?{'count':_0x35902b,'rows':_0x23a393}:null;}})['then'](respondWithResult(_0x5c06f3,null))['catch'](handleError(_0x5c06f3,null));};
\ No newline at end of file