Built motion from commit (unavailable).|2.5.6
[motion2.git] / server / api / cmList / cmList.controller.js
index 42844af..7d32938 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x43d0=['squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','save','update','destroy','then','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','show','rawAttributes','filtears','find','catch','create','user','role','UserProfileSection','userProfileId','body','params','describe','addDisposition','Disposition','getDispositions','findOne','pick','ListId','filter','options','removeDispositions','ids','addContacts','tags','isArray','join','push','each','omit','success','dataValues','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','getContactsCsv','CmContact','format','isEmpty','now','writeFileSync','setHeader','attachment;\x20filename=','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','userCmList:save','removeAgents','emit','userCmList:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x43d0,0x11e));var _0x043d=function(_0x18f152,_0x41585a){_0x18f152=_0x18f152-0x0;var _0xa10b34=_0x43d0[_0x18f152];return _0xa10b34;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x043d('0x0'));var rimraf=require(_0x043d('0x1'));var zipdir=require(_0x043d('0x2'));var jsonpatch=require(_0x043d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x043d('0x4'));var Mustache=require(_0x043d('0x5'));var util=require(_0x043d('0x6'));var path=require(_0x043d('0x7'));var sox=require(_0x043d('0x8'));var csv=require(_0x043d('0x9'));var ejs=require(_0x043d('0xa'));var fs=require('fs');var _=require(_0x043d('0xb'));var squel=require(_0x043d('0xc'));var crypto=require(_0x043d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x043d('0xe'));var toCsv=require(_0x043d('0x9'));var querystring=require(_0x043d('0xf'));var Papa=require('papaparse');var Redis=require(_0x043d('0x10'));var authService=require(_0x043d('0x11'));var qs=require(_0x043d('0x12'));var as=require(_0x043d('0x13'));var hardwareService=require(_0x043d('0x14'));var logger=require(_0x043d('0x15'))(_0x043d('0x16'));var utils=require(_0x043d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x043d('0x18'));var db=require(_0x043d('0x19'))['db'];config['redis']=_[_0x043d('0x1a')](config[_0x043d('0x1b')],{'host':_0x043d('0x1c'),'port':0x18eb});var socket=require(_0x043d('0x1d'))(new Redis(config[_0x043d('0x1b')]));require(_0x043d('0x1e'))[_0x043d('0x1f')](socket);function respondWithStatusCode(_0x4b77c7,_0x38c9c8){_0x38c9c8=_0x38c9c8||0xcc;return function(_0x18ada6){if(_0x18ada6){return _0x4b77c7[_0x043d('0x20')](_0x38c9c8);}return _0x4b77c7[_0x043d('0x21')](_0x38c9c8)[_0x043d('0x22')]();};}function respondWithResult(_0x51106d,_0x2aee69){_0x2aee69=_0x2aee69||0xc8;return function(_0xb4f9b6){if(_0xb4f9b6){return _0x51106d['status'](_0x2aee69)[_0x043d('0x23')](_0xb4f9b6);}};}function respondWithFilteredResult(_0x1fad2a,_0x4e255a){return function(_0x2e4e94){if(_0x2e4e94){var _0x4ae537=_0x2e4e94[_0x043d('0x24')],_0x54f6e6=_0x4e255a['offset'],_0x1dbd36=_0x4e255a['offset']+_0x4e255a[_0x043d('0x25')],_0x3e62be;if(_0x1dbd36>=_0x4ae537){_0x1dbd36=_0x4ae537;_0x3e62be=0xc8;}else{_0x3e62be=0xce;}_0x1fad2a['status'](_0x3e62be);return _0x1fad2a['set'](_0x043d('0x26'),_0x54f6e6+'-'+_0x1dbd36+'/'+_0x4ae537)[_0x043d('0x23')](_0x2e4e94);}return null;};}function patchUpdates(_0x5e6bde){return function(_0x4abfec){try{jsonpatch[_0x043d('0x27')](_0x4abfec,_0x5e6bde,!![]);}catch(_0x58bfb7){return BPromise[_0x043d('0x28')](_0x58bfb7);}return _0x4abfec[_0x043d('0x29')]();};}function saveUpdates(_0x4c7bad,_0x1975b2){return function(_0xa9ed17){if(_0xa9ed17){return _0xa9ed17[_0x043d('0x2a')](_0x4c7bad)['then'](function(_0x2abb8e){return _0x2abb8e;});}return null;};}function removeEntity(_0x37566a,_0x30faa2){return function(_0x51b920){if(_0x51b920){return _0x51b920[_0x043d('0x2b')]()[_0x043d('0x2c')](function(){var _0x55776d=_0x51b920[_0x043d('0x2d')]({'plain':!![]});var _0x6c7340=_0x043d('0x2e');return db[_0x043d('0x2f')]['destroy']({'where':{'type':_0x6c7340,'resourceId':_0x55776d['id']}})[_0x043d('0x2c')](function(){return _0x51b920;});})['then'](function(){_0x37566a[_0x043d('0x21')](0xcc)[_0x043d('0x22')]();});}};}function handleEntityNotFound(_0x125e57,_0x1011eb){return function(_0x56a180){if(!_0x56a180){_0x125e57[_0x043d('0x20')](0x194);}return _0x56a180;};}function handleError(_0x15a792,_0x393a36){_0x393a36=_0x393a36||0x1f4;return function(_0x41802e){logger[_0x043d('0x30')](_0x41802e[_0x043d('0x31')]);if(_0x41802e[_0x043d('0x32')]){delete _0x41802e[_0x043d('0x32')];}_0x15a792[_0x043d('0x21')](_0x393a36)[_0x043d('0x33')](_0x41802e);};}exports[_0x043d('0x34')]=function(_0x215177,_0x1dd89f){var _0x2064d5={},_0x37a3b9={},_0x1fefd0={'count':0x0,'rows':[]};var _0x322eb7=_[_0x043d('0x35')](db[_0x043d('0x36')]['rawAttributes'],function(_0x20ce5e){return{'name':_0x20ce5e['fieldName'],'type':_0x20ce5e['type'][_0x043d('0x37')]};});_0x37a3b9[_0x043d('0x38')]=_[_0x043d('0x35')](_0x322eb7,_0x043d('0x32'));_0x37a3b9[_0x043d('0x39')]=_[_0x043d('0x3a')](_0x215177[_0x043d('0x39')]);_0x37a3b9[_0x043d('0x3b')]=_[_0x043d('0x3c')](_0x37a3b9[_0x043d('0x38')],_0x37a3b9[_0x043d('0x39')]);_0x2064d5[_0x043d('0x3d')]=_[_0x043d('0x3c')](_0x37a3b9[_0x043d('0x38')],qs['fields'](_0x215177['query'][_0x043d('0x3e')]));_0x2064d5[_0x043d('0x3d')]=_0x2064d5['attributes'][_0x043d('0x3f')]?_0x2064d5[_0x043d('0x3d')]:_0x37a3b9[_0x043d('0x38')];if(!_0x215177[_0x043d('0x39')][_0x043d('0x40')](_0x043d('0x41'))){_0x2064d5[_0x043d('0x25')]=qs[_0x043d('0x25')](_0x215177['query'][_0x043d('0x25')]);_0x2064d5[_0x043d('0x42')]=qs[_0x043d('0x42')](_0x215177['query'][_0x043d('0x42')]);}_0x2064d5[_0x043d('0x43')]=qs['sort'](_0x215177[_0x043d('0x39')][_0x043d('0x44')]);_0x2064d5[_0x043d('0x45')]=qs['filters'](_['pick'](_0x215177[_0x043d('0x39')],_0x37a3b9[_0x043d('0x3b')]),_0x322eb7);if(_0x215177[_0x043d('0x39')]['filter']){_0x2064d5['where']=_['merge'](_0x2064d5['where'],{'$or':_['map'](_0x322eb7,function(_0x34b5f0){if(_0x34b5f0[_0x043d('0x46')]!==_0x043d('0x47')){var _0x585df9={};_0x585df9[_0x34b5f0['name']]={'$like':'%'+_0x215177[_0x043d('0x39')]['filter']+'%'};return _0x585df9;}})});}_0x2064d5=_[_0x043d('0x48')]({},_0x2064d5,_0x215177['options']);var _0x582a29={'where':_0x2064d5['where']};return db['CmList'][_0x043d('0x24')](_0x582a29)[_0x043d('0x2c')](function(_0x2003a5){_0x1fefd0[_0x043d('0x24')]=_0x2003a5;if(_0x215177[_0x043d('0x39')][_0x043d('0x49')]){_0x2064d5[_0x043d('0x4a')]=[{'all':!![]}];}return db['CmList'][_0x043d('0x4b')](_0x2064d5);})['then'](function(_0x56fdd9){_0x1fefd0[_0x043d('0x4c')]=_0x56fdd9;return _0x1fefd0;})[_0x043d('0x2c')](respondWithFilteredResult(_0x1dd89f,_0x2064d5))['catch'](handleError(_0x1dd89f,null));};exports[_0x043d('0x4d')]=function(_0xc07b9e,_0x3fece6){var _0x2c8e81={'raw':![],'where':{'id':_0xc07b9e['params']['id']}},_0x4ff84a={};_0x4ff84a['model']=_[_0x043d('0x3a')](db['CmList'][_0x043d('0x4e')]);_0x4ff84a[_0x043d('0x39')]=_[_0x043d('0x3a')](_0xc07b9e[_0x043d('0x39')]);_0x4ff84a[_0x043d('0x4f')]=_[_0x043d('0x3c')](_0x4ff84a[_0x043d('0x38')],_0x4ff84a[_0x043d('0x39')]);_0x2c8e81[_0x043d('0x3d')]=_[_0x043d('0x3c')](_0x4ff84a['model'],qs[_0x043d('0x3e')](_0xc07b9e[_0x043d('0x39')]['fields']));_0x2c8e81[_0x043d('0x3d')]=_0x2c8e81[_0x043d('0x3d')][_0x043d('0x3f')]?_0x2c8e81[_0x043d('0x3d')]:_0x4ff84a[_0x043d('0x38')];if(_0xc07b9e['query'][_0x043d('0x49')]){_0x2c8e81[_0x043d('0x4a')]=[{'all':!![]}];}_0x2c8e81=_[_0x043d('0x48')]({},_0x2c8e81,_0xc07b9e['options']);return db[_0x043d('0x36')][_0x043d('0x50')](_0x2c8e81)[_0x043d('0x2c')](handleEntityNotFound(_0x3fece6,null))[_0x043d('0x2c')](respondWithResult(_0x3fece6,null))[_0x043d('0x51')](handleError(_0x3fece6,null));};exports['create']=function(_0x222318,_0x526353){return db[_0x043d('0x36')][_0x043d('0x52')](_0x222318['body'],{})[_0x043d('0x2c')](function(_0x447246){var _0x1940f4=_0x222318[_0x043d('0x53')][_0x043d('0x2d')]({'plain':!![]});if(!_0x1940f4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1940f4[_0x043d('0x54')]===_0x043d('0x53')){var _0xcbd3b=_0x447246[_0x043d('0x2d')]({'plain':!![]});var _0x35a74c=_0x043d('0x2e');return db[_0x043d('0x55')][_0x043d('0x50')]({'where':{'name':_0x35a74c,'userProfileId':_0x1940f4[_0x043d('0x56')]},'raw':!![]})[_0x043d('0x2c')](function(_0x428d33){if(_0x428d33&&_0x428d33['autoAssociation']===0x0){return db['UserProfileResource'][_0x043d('0x52')]({'name':_0xcbd3b['name'],'resourceId':_0xcbd3b['id'],'type':_0x428d33[_0x043d('0x32')],'sectionId':_0x428d33['id']},{})[_0x043d('0x2c')](function(){return _0x447246;});}else{return _0x447246;}})[_0x043d('0x51')](function(_0x79c11f){logger[_0x043d('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x79c11f);throw _0x79c11f;});}return _0x447246;})['then'](respondWithResult(_0x526353,0xc9))[_0x043d('0x51')](handleError(_0x526353,null));};exports['update']=function(_0x3068fe,_0xe724a2){if(_0x3068fe[_0x043d('0x57')]['id']){delete _0x3068fe[_0x043d('0x57')]['id'];}return db[_0x043d('0x36')]['find']({'where':{'id':_0x3068fe[_0x043d('0x58')]['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0xe724a2,null))['then'](saveUpdates(_0x3068fe[_0x043d('0x57')],null))['then'](respondWithResult(_0xe724a2,null))[_0x043d('0x51')](handleError(_0xe724a2,null));};exports[_0x043d('0x2b')]=function(_0x4b6eaf,_0x394c6f){return db[_0x043d('0x36')][_0x043d('0x50')]({'where':{'id':_0x4b6eaf[_0x043d('0x58')]['id']}})['then'](handleEntityNotFound(_0x394c6f,null))[_0x043d('0x2c')](removeEntity(_0x394c6f,null))[_0x043d('0x51')](handleError(_0x394c6f,null));};exports[_0x043d('0x59')]=function(_0x2df650,_0x51a7db){return db[_0x043d('0x36')][_0x043d('0x59')]()[_0x043d('0x2c')](respondWithResult(_0x51a7db,null))[_0x043d('0x51')](handleError(_0x51a7db,null));};exports[_0x043d('0x5a')]=function(_0x54b433,_0x2fd9b3,_0x1a2c8b){if(_0x54b433[_0x043d('0x57')]['id']){delete _0x54b433[_0x043d('0x57')]['id'];}return db[_0x043d('0x36')][_0x043d('0x50')]({'where':{'id':_0x54b433['params']['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0x2fd9b3,null))[_0x043d('0x2c')](function(_0x17843c){if(_0x17843c){_0x54b433[_0x043d('0x57')]['ListId']=_0x17843c['id'];return db[_0x043d('0x5b')]['create'](_0x54b433['body']);}})[_0x043d('0x2c')](respondWithResult(_0x2fd9b3,null))[_0x043d('0x51')](handleError(_0x2fd9b3,null));};exports[_0x043d('0x5c')]=function(_0xe98138,_0x2cd086,_0x1fd83c){var _0x2d5247={'raw':![],'where':{}};var _0x5cf65e={};var _0xcaab04={'count':0x0,'rows':[]};return db['CmList'][_0x043d('0x5d')]({'where':{'id':_0xe98138[_0x043d('0x58')]['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0x2cd086,null))[_0x043d('0x2c')](function(_0x365571){if(_0x365571){_0x5cf65e[_0x043d('0x38')]=_[_0x043d('0x3a')](db[_0x043d('0x5b')][_0x043d('0x4e')]);_0x5cf65e['query']=_['keys'](_0xe98138[_0x043d('0x39')]);_0x5cf65e['filters']=_[_0x043d('0x3c')](_0x5cf65e[_0x043d('0x38')],_0x5cf65e['query']);_0x2d5247[_0x043d('0x3d')]=_[_0x043d('0x3c')](_0x5cf65e['model'],qs[_0x043d('0x3e')](_0xe98138['query'][_0x043d('0x3e')]));_0x2d5247[_0x043d('0x3d')]=_0x2d5247[_0x043d('0x3d')][_0x043d('0x3f')]?_0x2d5247['attributes']:_0x5cf65e['model'];if(!_0xe98138[_0x043d('0x39')][_0x043d('0x40')]('nolimit')){_0x2d5247[_0x043d('0x25')]=qs[_0x043d('0x25')](_0xe98138[_0x043d('0x39')][_0x043d('0x25')]);_0x2d5247[_0x043d('0x42')]=qs['offset'](_0xe98138[_0x043d('0x39')][_0x043d('0x42')]);}_0x2d5247['order']=qs[_0x043d('0x44')](_0xe98138[_0x043d('0x39')]['sort']);_0x2d5247[_0x043d('0x45')]=qs[_0x043d('0x3b')](_[_0x043d('0x5e')](_0xe98138[_0x043d('0x39')],_0x5cf65e[_0x043d('0x3b')]));_0x2d5247[_0x043d('0x45')][_0x043d('0x5f')]=_0x365571['id'];if(_0xe98138[_0x043d('0x39')][_0x043d('0x60')]){_0x2d5247[_0x043d('0x45')]=_[_0x043d('0x48')](_0x2d5247[_0x043d('0x45')],{'$or':_[_0x043d('0x35')](_0x2d5247[_0x043d('0x3d')],function(_0x4c3625){var _0x11e07a={};_0x11e07a[_0x4c3625]={'$like':'%'+_0xe98138[_0x043d('0x39')][_0x043d('0x60')]+'%'};return _0x11e07a;})});}_0x2d5247=_[_0x043d('0x48')]({},_0x2d5247,_0xe98138[_0x043d('0x61')]);return db[_0x043d('0x5b')]['count']({'where':_0x2d5247['where']})[_0x043d('0x2c')](function(_0x261ae7){_0xcaab04[_0x043d('0x24')]=_0x261ae7;if(_0xe98138[_0x043d('0x39')]['includeAll']){_0x2d5247['include']=[{'all':!![]}];}return db[_0x043d('0x5b')][_0x043d('0x4b')](_0x2d5247);})[_0x043d('0x2c')](function(_0x4f77ce){_0xcaab04[_0x043d('0x4c')]=_0x4f77ce;return _0xcaab04;});}})['then'](respondWithFilteredResult(_0x2cd086,_0x2d5247))[_0x043d('0x51')](handleError(_0x2cd086,null));};exports[_0x043d('0x62')]=function(_0x305a7f,_0x470d88,_0x5c8576){return db[_0x043d('0x36')][_0x043d('0x50')]({'where':{'id':_0x305a7f[_0x043d('0x58')]['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0x470d88,null))[_0x043d('0x2c')](function(_0x4edf9f){if(_0x4edf9f){return _0x4edf9f[_0x043d('0x62')](_0x305a7f[_0x043d('0x39')][_0x043d('0x63')]);}})[_0x043d('0x2c')](respondWithStatusCode(_0x470d88,null))['catch'](handleError(_0x470d88,null));};exports[_0x043d('0x64')]=function(_0x49e199,_0x66badd,_0x2a77ea){return db[_0x043d('0x36')][_0x043d('0x50')]({'where':{'id':_0x49e199['params']['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0x66badd,null))[_0x043d('0x2c')](function(_0x137e53){if(_0x137e53){var _0x321627=[];var _0x4e4ef7={'success':[],'errors':[]};return db['CmContact']['describe']()[_0x043d('0x2c')](function(_0x22bc6b){if(_0x49e199[_0x043d('0x57')][_0x043d('0x65')]&&_[_0x043d('0x66')](_0x49e199['body'][_0x043d('0x65')])){if(_0x49e199[_0x043d('0x57')][_0x043d('0x65')][_0x043d('0x3f')]){_0x49e199[_0x043d('0x57')][_0x043d('0x65')]=_0x49e199[_0x043d('0x57')][_0x043d('0x65')][_0x043d('0x67')](';')+';';}else{_0x49e199['body']['tags']=null;}}else{_0x49e199[_0x043d('0x57')][_0x043d('0x65')]=null;}if(_0x49e199[_0x043d('0x57')]&&_[_0x043d('0x66')](_0x49e199[_0x043d('0x57')])){for(var _0xa239c1=0x0;_0xa239c1<_0x49e199[_0x043d('0x57')][_0x043d('0x3f')];_0xa239c1+=0x1){_0x49e199[_0x043d('0x57')][_0xa239c1][_0x043d('0x5f')]=_0x49e199[_0x043d('0x58')]['id'];_0x321627[_0x043d('0x68')](_0x49e199[_0x043d('0x57')][_0xa239c1]);}return BPromise[_0x043d('0x69')](_0x321627,function(_0x257b8e){return db['CmContact']['create'](_[_0x043d('0x6a')](_0x257b8e,[_0x043d('0x63'),'id'])||{},{'fields':_[_0x043d('0x3a')](_0x22bc6b),'raw':!![]})[_0x043d('0x2c')](function(_0x5b9319){_0x4e4ef7[_0x043d('0x6b')]['push'](_0x5b9319[_0x043d('0x6c')]);})[_0x043d('0x51')](function(_0x26baca){_0x4e4ef7['errors']['push']({'data':_0x257b8e,'error':_0x26baca['message']});});})[_0x043d('0x2c')](function(_0x45b0bf){return _0x4e4ef7;})['catch'](function(_0x483785){return _0x483785;});}else{_0x66badd[_0x043d('0x21')](0x190)[_0x043d('0x23')]({'message':_0x043d('0x6d')});}});}})[_0x043d('0x2c')](respondWithResult(_0x66badd,null))['catch'](handleError(_0x66badd,null));};exports[_0x043d('0x6e')]=function(_0x31da79,_0x3e76b3,_0x19ce39){var _0x80def4;return db[_0x043d('0x36')]['find']({'where':{'id':_0x31da79['params']['id']},'include':[{'model':db[_0x043d('0x6f')],'as':_0x043d('0x70')}]})[_0x043d('0x2c')](handleEntityNotFound(_0x3e76b3,null))[_0x043d('0x2c')](function(_0x512453){if(_0x512453){_0x80def4=_0x512453;return db['CmContact'][_0x043d('0x4e')];}})[_0x043d('0x2c')](function(_0x17a9e3){if(_0x17a9e3){var _0x1f7656={};var _0x1a502d={};_0x1a502d['model']=_[_0x043d('0x71')](_[_0x043d('0x3a')](_0x17a9e3),_['map'](_0x80def4[_0x043d('0x70')],function(_0x444b8f){return util['format'](_0x043d('0x72'),_0x444b8f['id']);}));_0x1a502d[_0x043d('0x39')]=_['keys'](_0x31da79['query']);_0x1a502d[_0x043d('0x3b')]=_[_0x043d('0x3c')](_0x1a502d[_0x043d('0x38')],_0x1a502d[_0x043d('0x39')]);_0x1f7656[_0x043d('0x3d')]=_['intersection'](_0x1a502d['model'],qs[_0x043d('0x3e')](_0x31da79['query'][_0x043d('0x3e')]));_0x1f7656[_0x043d('0x3d')]=_0x1f7656['attributes']['length']?_0x1f7656[_0x043d('0x3d')]:_0x1a502d['model'];if(!_0x31da79[_0x043d('0x39')][_0x043d('0x40')]('nolimit')){_0x1f7656[_0x043d('0x25')]=qs[_0x043d('0x25')](_0x31da79[_0x043d('0x39')][_0x043d('0x25')]);_0x1f7656[_0x043d('0x42')]=qs[_0x043d('0x42')](_0x31da79[_0x043d('0x39')][_0x043d('0x42')]);}_0x1f7656[_0x043d('0x43')]=qs['sort'](_0x31da79[_0x043d('0x39')][_0x043d('0x44')]);_0x1f7656[_0x043d('0x45')]=qs['filters'](_['pick'](_0x31da79[_0x043d('0x39')],_0x1a502d[_0x043d('0x3b')]));_0x1f7656['raw']=!![];if(_0x31da79['query'][_0x043d('0x60')]){_0x1f7656[_0x043d('0x45')]=_[_0x043d('0x48')](_0x1f7656['where'],{'$or':_[_0x043d('0x35')](_0x1f7656[_0x043d('0x3d')],function(_0x44638b){var _0x533dec={};_0x533dec[_0x44638b]={'$like':'%'+_0x31da79[_0x043d('0x39')][_0x043d('0x60')]+'%'};return _0x533dec;})});}_0x1f7656=_[_0x043d('0x48')]({},_0x1f7656,_0x31da79['options']);return _0x80def4[_0x043d('0x6e')](_0x1f7656);}})[_0x043d('0x2c')](respondWithResult(_0x3e76b3,null))[_0x043d('0x51')](handleError(_0x3e76b3,null));};exports[_0x043d('0x73')]=function(_0x2a5bd1,_0x3651de,_0x1be9c5){var _0x58f31d;return db[_0x043d('0x36')]['find']({'where':{'id':_0x2a5bd1[_0x043d('0x58')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x043d('0x2c')](handleEntityNotFound(_0x3651de,null))['then'](function(_0x3b1499){if(_0x3b1499){_0x58f31d=_0x3b1499;return db[_0x043d('0x74')][_0x043d('0x4e')];}})[_0x043d('0x2c')](function(_0x3d0eb5){if(_0x3d0eb5){var _0x262b25={};var _0xf0a3d8={};_0xf0a3d8['model']=_[_0x043d('0x71')](_[_0x043d('0x3a')](_0x3d0eb5),_[_0x043d('0x35')](_0x58f31d[_0x043d('0x70')],function(_0x28b1c0){return util[_0x043d('0x75')]('cf_%d',_0x28b1c0['id']);}));_0xf0a3d8[_0x043d('0x39')]=_[_0x043d('0x3a')](_0x2a5bd1[_0x043d('0x39')]);_0xf0a3d8[_0x043d('0x3b')]=_['intersection'](_0xf0a3d8[_0x043d('0x38')],_0xf0a3d8['query']);_0x262b25[_0x043d('0x3d')]=_[_0x043d('0x3c')](_0xf0a3d8[_0x043d('0x38')],qs['fields'](_0x2a5bd1[_0x043d('0x39')][_0x043d('0x3e')]));_0x262b25[_0x043d('0x3d')]=_0x262b25[_0x043d('0x3d')][_0x043d('0x3f')]?_0x262b25[_0x043d('0x3d')]:_0xf0a3d8[_0x043d('0x38')];if(!_0x2a5bd1['query']['hasOwnProperty'](_0x043d('0x41'))){_0x262b25[_0x043d('0x25')]=qs[_0x043d('0x25')](_0x2a5bd1['query']['limit']);_0x262b25['offset']=qs[_0x043d('0x42')](_0x2a5bd1[_0x043d('0x39')][_0x043d('0x42')]);}_0x262b25['order']=qs['sort'](_0x2a5bd1[_0x043d('0x39')][_0x043d('0x44')]);_0x262b25[_0x043d('0x45')]=qs['filters'](_[_0x043d('0x5e')](_0x2a5bd1[_0x043d('0x39')],_0xf0a3d8[_0x043d('0x3b')]));_0x262b25['raw']=!![];if(_0x2a5bd1[_0x043d('0x39')]['filter']){_0x262b25[_0x043d('0x45')]=_[_0x043d('0x48')](_0x262b25[_0x043d('0x45')],{'$or':_[_0x043d('0x35')](_0x262b25[_0x043d('0x3d')],function(_0x1dfe7f){var _0x29d3e7={};_0x29d3e7[_0x1dfe7f]={'$like':'%'+_0x2a5bd1[_0x043d('0x39')][_0x043d('0x60')]+'%'};return _0x29d3e7;})});}_0x262b25=_['merge']({},_0x262b25,_0x2a5bd1['options']);return _0x58f31d['getContacts'](_0x262b25);}})[_0x043d('0x2c')](function(_0x4da04e){if(!_[_0x043d('0x76')](_0x4da04e)){var _0x1ee404=toCsv(_0x4da04e);var _0x3b1d3f=Date[_0x043d('0x77')]();fs[_0x043d('0x78')](util[_0x043d('0x75')]('/tmp/list_%d_%s.csv',_0x58f31d['id'],_0x3b1d3f),_0x1ee404);_0x3651de[_0x043d('0x79')]('Content-disposition',_0x043d('0x7a')+util[_0x043d('0x75')]('list_%d_%s.csv',_0x58f31d['id'],_0x3b1d3f));_0x3651de[_0x043d('0x79')](_0x043d('0x7b'),_0x043d('0x7c'));return _0x3651de[_0x043d('0x7d')](util[_0x043d('0x75')](_0x043d('0x7e'),_0x58f31d['id'],_0x3b1d3f));}else{return _0x3651de[_0x043d('0x20')](0xcc);}})['catch'](handleError(_0x3651de,null));};exports[_0x043d('0x7f')]=function(_0x3b84e3,_0x2e07e5,_0x42bfdc){var _0xe0dea8;delete _0x3b84e3[_0x043d('0x57')]['id'];return db[_0x043d('0x36')]['findOne']({'where':{'id':_0x3b84e3[_0x043d('0x58')]['id']}})['then'](handleEntityNotFound(_0x2e07e5,null))[_0x043d('0x2c')](function(_0x547e94){if(_0x547e94){return db[_0x043d('0x80')][_0x043d('0x81')](function(_0x3f60e6){return db[_0x043d('0x6f')][_0x043d('0x52')](_0x3b84e3[_0x043d('0x57')],{'transaction':_0x3f60e6})['then'](function(_0x552bfd){_0xe0dea8=_0x552bfd;return _0x547e94['addCustomFields'](_0x552bfd,{'transaction':_0x3f60e6});})['then'](function(){var _0x356b2d={'type':db[_0x043d('0x82')][_0x043d('0x83')],'transaction':_0x3f60e6};switch(_0x3b84e3[_0x043d('0x57')][_0x043d('0x46')]){case _0x043d('0x84'):_0x356b2d[_0x043d('0x46')]=db['Sequelize'][_0x043d('0x83')];break;case'number':_0x356b2d[_0x043d('0x46')]=db[_0x043d('0x82')][_0x043d('0x85')];break;case _0x043d('0x86'):_0x356b2d[_0x043d('0x46')]=db[_0x043d('0x82')][_0x043d('0x87')];_0x356b2d['defaultValue']=![];break;default:}return db[_0x043d('0x80')][_0x043d('0x88')][_0x043d('0x89')](_0x043d('0x8a'),util[_0x043d('0x75')](_0x043d('0x8b'),_0xe0dea8['id']),_0x356b2d);})[_0x043d('0x2c')](function(){return _0xe0dea8;});});}})[_0x043d('0x2c')](respondWithResult(_0x2e07e5,null))['catch'](handleError(_0x2e07e5,null));};exports[_0x043d('0x8c')]=function(_0x3fe7b9,_0x21f13a,_0xd2dd29){var _0x53e87e={};var _0xabc991={};var _0x265a58;var _0x45195a;return db[_0x043d('0x36')][_0x043d('0x5d')]({'where':{'id':_0x3fe7b9['params']['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0x21f13a,null))[_0x043d('0x2c')](function(_0xb5498e){if(_0xb5498e){_0x265a58=_0xb5498e;_0xabc991['model']=_['keys'](db[_0x043d('0x6f')]['rawAttributes']);_0xabc991[_0x043d('0x39')]=_[_0x043d('0x3a')](_0x3fe7b9['query']);_0xabc991[_0x043d('0x3b')]=_[_0x043d('0x3c')](_0xabc991[_0x043d('0x38')],_0xabc991[_0x043d('0x39')]);_0x53e87e['attributes']=_[_0x043d('0x3c')](_0xabc991[_0x043d('0x38')],qs[_0x043d('0x3e')](_0x3fe7b9[_0x043d('0x39')][_0x043d('0x3e')]));_0x53e87e[_0x043d('0x3d')]=_0x53e87e[_0x043d('0x3d')]['length']?_0x53e87e['attributes']:_0xabc991[_0x043d('0x38')];_0x53e87e[_0x043d('0x43')]=qs['sort'](_0x3fe7b9[_0x043d('0x39')]['sort']);_0x53e87e[_0x043d('0x45')]=qs[_0x043d('0x3b')](_[_0x043d('0x5e')](_0x3fe7b9[_0x043d('0x39')],_0xabc991[_0x043d('0x3b')]));_0x53e87e[_0x043d('0x45')]=_[_0x043d('0x48')](_0x53e87e[_0x043d('0x45')],{'$or':[{'ListId':_0xb5498e['id']},{'ListId':null}]});if(_0x3fe7b9[_0x043d('0x39')][_0x043d('0x60')]){_0x53e87e[_0x043d('0x45')]=_[_0x043d('0x48')](_0x53e87e[_0x043d('0x45')],{'$or':_[_0x043d('0x35')](_0x53e87e[_0x043d('0x3d')],function(_0x2e5d6d){var _0x16fe78={};_0x16fe78[_0x2e5d6d]={'$like':'%'+_0x3fe7b9[_0x043d('0x39')][_0x043d('0x60')]+'%'};return _0x16fe78;})});}_0x53e87e=_[_0x043d('0x48')]({},_0x53e87e,_0x3fe7b9[_0x043d('0x61')]);return db['CmCustomField'][_0x043d('0x8d')](_0x53e87e);}})[_0x043d('0x2c')](respondWithResult(_0x21f13a,null))[_0x043d('0x51')](handleError(_0x21f13a,null));};exports[_0x043d('0x8e')]=function(_0x2d653b,_0xa640f,_0x7f3a28){return db[_0x043d('0x36')][_0x043d('0x50')]({'where':{'id':_0x2d653b[_0x043d('0x58')]['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0xa640f,null))[_0x043d('0x2c')](function(_0x27cc5b){if(_0x27cc5b){return _0x27cc5b['addAgents'](_0x2d653b['body'][_0x043d('0x63')],_[_0x043d('0x6a')](_0x2d653b[_0x043d('0x57')],[_0x043d('0x63'),'id'])||{})['spread'](function(_0x388e45){for(var _0x342c9d=0x0;_0x342c9d<_0x2d653b[_0x043d('0x57')]['ids'][_0x043d('0x3f')];_0x342c9d+=0x1){socket['emit'](_0x043d('0x8f'),{'UserId':_0x2d653b[_0x043d('0x57')]['ids'][_0x342c9d],'CmListId':_0x2d653b[_0x043d('0x58')]['id']});}return _0x388e45;});}})[_0x043d('0x2c')](respondWithResult(_0xa640f,null))[_0x043d('0x51')](handleError(_0xa640f,null));};exports[_0x043d('0x90')]=function(_0x5cd5e3,_0x1b3ef6,_0x10ca0f){return db[_0x043d('0x36')][_0x043d('0x50')]({'where':{'id':_0x5cd5e3[_0x043d('0x58')]['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0x1b3ef6,null))[_0x043d('0x2c')](function(_0x40e30b){if(_0x40e30b){return _0x40e30b[_0x043d('0x90')](_0x5cd5e3[_0x043d('0x39')]['ids'])[_0x043d('0x2c')](function(){if(_[_0x043d('0x66')](_0x5cd5e3[_0x043d('0x39')][_0x043d('0x63')])){for(var _0x1714ea=0x0;_0x1714ea<_0x5cd5e3[_0x043d('0x39')]['ids'][_0x043d('0x3f')];_0x1714ea+=0x1){socket[_0x043d('0x91')]('userCmList:remove',{'UserId':Number(_0x5cd5e3[_0x043d('0x39')][_0x043d('0x63')][_0x1714ea]),'CmListId':Number(_0x5cd5e3[_0x043d('0x58')]['id'])});}}else{socket[_0x043d('0x91')](_0x043d('0x92'),{'UserId':Number(_0x5cd5e3[_0x043d('0x39')][_0x043d('0x63')]),'CmListId':Number(_0x5cd5e3['params']['id'])});}});}})[_0x043d('0x2c')](respondWithStatusCode(_0x1b3ef6,null))[_0x043d('0x51')](handleError(_0x1b3ef6,null));};exports['getAgents']=function(_0x196c81,_0x4c7dcb,_0x143b34){var _0x30ff31={};var _0x91c303={};var _0x947fcb;var _0x5e1812;return db['CmList'][_0x043d('0x5d')]({'where':{'id':_0x196c81[_0x043d('0x58')]['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0x4c7dcb,null))[_0x043d('0x2c')](function(_0x5637a6){if(_0x5637a6){_0x947fcb=_0x5637a6;_0x91c303[_0x043d('0x38')]=_[_0x043d('0x3a')](db[_0x043d('0x93')][_0x043d('0x4e')]);_0x91c303[_0x043d('0x39')]=_[_0x043d('0x3a')](_0x196c81['query']);_0x91c303[_0x043d('0x3b')]=_[_0x043d('0x3c')](_0x91c303[_0x043d('0x38')],_0x91c303[_0x043d('0x39')]);_0x30ff31[_0x043d('0x3d')]=_[_0x043d('0x3c')](_0x91c303[_0x043d('0x38')],qs['fields'](_0x196c81['query'][_0x043d('0x3e')]));_0x30ff31[_0x043d('0x3d')]=_0x30ff31[_0x043d('0x3d')][_0x043d('0x3f')]?_0x30ff31['attributes']:_0x91c303[_0x043d('0x38')];_0x30ff31['order']=qs[_0x043d('0x44')](_0x196c81[_0x043d('0x39')][_0x043d('0x44')]);_0x30ff31['where']=qs[_0x043d('0x3b')](_[_0x043d('0x5e')](_0x196c81[_0x043d('0x39')],_0x91c303[_0x043d('0x3b')]));if(_0x196c81[_0x043d('0x39')][_0x043d('0x60')]){_0x30ff31['where']=_['merge'](_0x30ff31['where'],{'$or':_[_0x043d('0x35')](_0x30ff31[_0x043d('0x3d')],function(_0x34b00e){var _0x378035={};_0x378035[_0x34b00e]={'$like':'%'+_0x196c81['query'][_0x043d('0x60')]+'%'};return _0x378035;})});}_0x30ff31=_[_0x043d('0x48')]({},_0x30ff31,_0x196c81['options']);return _0x947fcb[_0x043d('0x94')](_0x30ff31);}})[_0x043d('0x2c')](function(_0x3cd418){if(_0x3cd418){_0x5e1812=_0x3cd418['length'];if(!_0x196c81[_0x043d('0x39')][_0x043d('0x40')](_0x043d('0x41'))){_0x30ff31[_0x043d('0x25')]=qs[_0x043d('0x25')](_0x196c81[_0x043d('0x39')]['limit']);_0x30ff31[_0x043d('0x42')]=qs[_0x043d('0x42')](_0x196c81[_0x043d('0x39')]['offset']);}return _0x947fcb[_0x043d('0x94')](_0x30ff31);}})['then'](function(_0x5586ae){if(_0x5586ae){return _0x5586ae?{'count':_0x5e1812,'rows':_0x5586ae}:null;}})[_0x043d('0x2c')](respondWithResult(_0x4c7dcb,null))[_0x043d('0x51')](handleError(_0x4c7dcb,null));};
\ No newline at end of file
+var _0xf128=['count','offset','limit','set','apply','reject','save','update','then','destroy','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','filtears','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','getDispositions','findOne','Disposition','pick','rows','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','omit','dataValues','Malformed\x20request\x20syntax','getContacts','concat','format','cf_%d','getContactsCsv','CmCustomField','CustomFields','raw','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','type','text','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','userCmList:save','removeAgents','userCmList:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json'];(function(_0xd4c56,_0x278a89){var _0x5d8823=function(_0x565732){while(--_0x565732){_0xd4c56['push'](_0xd4c56['shift']());}};_0x5d8823(++_0x278a89);}(_0xf128,0x109));var _0x8f12=function(_0x19017b,_0x56d52c){_0x19017b=_0x19017b-0x0;var _0x3becdc=_0xf128[_0x19017b];return _0x3becdc;};'use strict';var pdf=require(_0x8f12('0x0'));var emlformat=require(_0x8f12('0x1'));var rimraf=require(_0x8f12('0x2'));var zipdir=require(_0x8f12('0x3'));var jsonpatch=require(_0x8f12('0x4'));var rp=require(_0x8f12('0x5'));var moment=require(_0x8f12('0x6'));var BPromise=require(_0x8f12('0x7'));var Mustache=require('mustache');var util=require(_0x8f12('0x8'));var path=require(_0x8f12('0x9'));var sox=require(_0x8f12('0xa'));var csv=require(_0x8f12('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8f12('0xc'));var squel=require(_0x8f12('0xd'));var crypto=require(_0x8f12('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8f12('0xf'));var toCsv=require(_0x8f12('0xb'));var querystring=require(_0x8f12('0x10'));var Papa=require(_0x8f12('0x11'));var Redis=require('ioredis');var authService=require(_0x8f12('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f12('0x13'));var logger=require(_0x8f12('0x14'))('api');var utils=require(_0x8f12('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8f12('0x16'))['db'];config['redis']=_[_0x8f12('0x17')](config[_0x8f12('0x18')],{'host':_0x8f12('0x19'),'port':0x18eb});var socket=require(_0x8f12('0x1a'))(new Redis(config[_0x8f12('0x18')]));require(_0x8f12('0x1b'))[_0x8f12('0x1c')](socket);function respondWithStatusCode(_0x4ef551,_0x40183f){_0x40183f=_0x40183f||0xcc;return function(_0x175615){if(_0x175615){return _0x4ef551[_0x8f12('0x1d')](_0x40183f);}return _0x4ef551[_0x8f12('0x1e')](_0x40183f)[_0x8f12('0x1f')]();};}function respondWithResult(_0x35ed96,_0x155144){_0x155144=_0x155144||0xc8;return function(_0x541f95){if(_0x541f95){return _0x35ed96['status'](_0x155144)[_0x8f12('0x20')](_0x541f95);}};}function respondWithFilteredResult(_0x22d38a,_0xaac5a4){return function(_0x51552c){if(_0x51552c){var _0x4d2be7=_0x51552c[_0x8f12('0x21')],_0x250f30=_0xaac5a4[_0x8f12('0x22')],_0xfb4f65=_0xaac5a4[_0x8f12('0x22')]+_0xaac5a4[_0x8f12('0x23')],_0x377702;if(_0xfb4f65>=_0x4d2be7){_0xfb4f65=_0x4d2be7;_0x377702=0xc8;}else{_0x377702=0xce;}_0x22d38a[_0x8f12('0x1e')](_0x377702);return _0x22d38a[_0x8f12('0x24')]('Content-Range',_0x250f30+'-'+_0xfb4f65+'/'+_0x4d2be7)[_0x8f12('0x20')](_0x51552c);}return null;};}function patchUpdates(_0x31700c){return function(_0x20a8a1){try{jsonpatch[_0x8f12('0x25')](_0x20a8a1,_0x31700c,!![]);}catch(_0xa7d8b){return BPromise[_0x8f12('0x26')](_0xa7d8b);}return _0x20a8a1[_0x8f12('0x27')]();};}function saveUpdates(_0x15cc29,_0x242472){return function(_0x316bfc){if(_0x316bfc){return _0x316bfc[_0x8f12('0x28')](_0x15cc29)[_0x8f12('0x29')](function(_0xc8304c){return _0xc8304c;});}return null;};}function removeEntity(_0x35f3bd,_0x3ae847){return function(_0x3541b3){if(_0x3541b3){return _0x3541b3[_0x8f12('0x2a')]()[_0x8f12('0x29')](function(){var _0x3b07a2=_0x3541b3['get']({'plain':!![]});var _0x47883d=_0x8f12('0x2b');return db[_0x8f12('0x2c')][_0x8f12('0x2a')]({'where':{'type':_0x47883d,'resourceId':_0x3b07a2['id']}})['then'](function(){return _0x3541b3;});})['then'](function(){_0x35f3bd['status'](0xcc)[_0x8f12('0x1f')]();});}};}function handleEntityNotFound(_0x3aca8c,_0xc1064e){return function(_0x36f299){if(!_0x36f299){_0x3aca8c['sendStatus'](0x194);}return _0x36f299;};}function handleError(_0x555fd3,_0xf00ac5){_0xf00ac5=_0xf00ac5||0x1f4;return function(_0x3687fc){logger[_0x8f12('0x2d')](_0x3687fc[_0x8f12('0x2e')]);if(_0x3687fc['name']){delete _0x3687fc[_0x8f12('0x2f')];}_0x555fd3[_0x8f12('0x1e')](_0xf00ac5)[_0x8f12('0x30')](_0x3687fc);};}exports[_0x8f12('0x31')]=function(_0x3fc30d,_0xf04aff){var _0x534861={},_0x40d549={},_0x16f0ee={'count':0x0,'rows':[]};var _0x48c21f=_[_0x8f12('0x32')](db[_0x8f12('0x33')][_0x8f12('0x34')],function(_0x14718b){return{'name':_0x14718b[_0x8f12('0x35')],'type':_0x14718b['type'][_0x8f12('0x36')]};});_0x40d549[_0x8f12('0x37')]=_[_0x8f12('0x32')](_0x48c21f,_0x8f12('0x2f'));_0x40d549[_0x8f12('0x38')]=_[_0x8f12('0x39')](_0x3fc30d[_0x8f12('0x38')]);_0x40d549[_0x8f12('0x3a')]=_['intersection'](_0x40d549[_0x8f12('0x37')],_0x40d549[_0x8f12('0x38')]);_0x534861[_0x8f12('0x3b')]=_['intersection'](_0x40d549[_0x8f12('0x37')],qs[_0x8f12('0x3c')](_0x3fc30d[_0x8f12('0x38')][_0x8f12('0x3c')]));_0x534861[_0x8f12('0x3b')]=_0x534861[_0x8f12('0x3b')][_0x8f12('0x3d')]?_0x534861['attributes']:_0x40d549[_0x8f12('0x37')];if(!_0x3fc30d[_0x8f12('0x38')][_0x8f12('0x3e')](_0x8f12('0x3f'))){_0x534861[_0x8f12('0x23')]=qs[_0x8f12('0x23')](_0x3fc30d[_0x8f12('0x38')]['limit']);_0x534861[_0x8f12('0x22')]=qs[_0x8f12('0x22')](_0x3fc30d['query'][_0x8f12('0x22')]);}_0x534861[_0x8f12('0x40')]=qs[_0x8f12('0x41')](_0x3fc30d[_0x8f12('0x38')][_0x8f12('0x41')]);_0x534861['where']=qs[_0x8f12('0x3a')](_['pick'](_0x3fc30d['query'],_0x40d549['filters']),_0x48c21f);if(_0x3fc30d[_0x8f12('0x38')][_0x8f12('0x42')]){_0x534861[_0x8f12('0x43')]=_[_0x8f12('0x44')](_0x534861['where'],{'$or':_['map'](_0x48c21f,function(_0x4e0f7c){if(_0x4e0f7c['type']!==_0x8f12('0x45')){var _0x16fd72={};_0x16fd72[_0x4e0f7c['name']]={'$like':'%'+_0x3fc30d[_0x8f12('0x38')]['filter']+'%'};return _0x16fd72;}})});}_0x534861=_['merge']({},_0x534861,_0x3fc30d[_0x8f12('0x46')]);var _0x523833={'where':_0x534861[_0x8f12('0x43')]};return db['CmList'][_0x8f12('0x21')](_0x523833)[_0x8f12('0x29')](function(_0x24e064){_0x16f0ee[_0x8f12('0x21')]=_0x24e064;if(_0x3fc30d[_0x8f12('0x38')][_0x8f12('0x47')]){_0x534861[_0x8f12('0x48')]=[{'all':!![]}];}return db['CmList'][_0x8f12('0x49')](_0x534861);})[_0x8f12('0x29')](function(_0x171b9e){_0x16f0ee['rows']=_0x171b9e;return _0x16f0ee;})['then'](respondWithFilteredResult(_0xf04aff,_0x534861))[_0x8f12('0x4a')](handleError(_0xf04aff,null));};exports[_0x8f12('0x4b')]=function(_0x5d6f6e,_0x9ae512){var _0x33b200={'raw':![],'where':{'id':_0x5d6f6e[_0x8f12('0x4c')]['id']}},_0x379edb={};_0x379edb[_0x8f12('0x37')]=_[_0x8f12('0x39')](db[_0x8f12('0x33')][_0x8f12('0x34')]);_0x379edb['query']=_['keys'](_0x5d6f6e[_0x8f12('0x38')]);_0x379edb[_0x8f12('0x4d')]=_[_0x8f12('0x4e')](_0x379edb['model'],_0x379edb[_0x8f12('0x38')]);_0x33b200[_0x8f12('0x3b')]=_[_0x8f12('0x4e')](_0x379edb[_0x8f12('0x37')],qs[_0x8f12('0x3c')](_0x5d6f6e[_0x8f12('0x38')][_0x8f12('0x3c')]));_0x33b200[_0x8f12('0x3b')]=_0x33b200[_0x8f12('0x3b')][_0x8f12('0x3d')]?_0x33b200[_0x8f12('0x3b')]:_0x379edb[_0x8f12('0x37')];if(_0x5d6f6e[_0x8f12('0x38')][_0x8f12('0x47')]){_0x33b200[_0x8f12('0x48')]=[{'all':!![]}];}_0x33b200=_[_0x8f12('0x44')]({},_0x33b200,_0x5d6f6e[_0x8f12('0x46')]);return db[_0x8f12('0x33')][_0x8f12('0x4f')](_0x33b200)['then'](handleEntityNotFound(_0x9ae512,null))[_0x8f12('0x29')](respondWithResult(_0x9ae512,null))['catch'](handleError(_0x9ae512,null));};exports[_0x8f12('0x50')]=function(_0x6412be,_0x433517){return db[_0x8f12('0x33')][_0x8f12('0x50')](_0x6412be[_0x8f12('0x51')],{})[_0x8f12('0x29')](function(_0x14274d){var _0x310304=_0x6412be[_0x8f12('0x52')][_0x8f12('0x53')]({'plain':!![]});if(!_0x310304)throw new Error(_0x8f12('0x54'));if(_0x310304[_0x8f12('0x55')]===_0x8f12('0x52')){var _0x44342c=_0x14274d[_0x8f12('0x53')]({'plain':!![]});var _0x1e786b=_0x8f12('0x2b');return db[_0x8f12('0x56')][_0x8f12('0x4f')]({'where':{'name':_0x1e786b,'userProfileId':_0x310304[_0x8f12('0x57')]},'raw':!![]})[_0x8f12('0x29')](function(_0x116807){if(_0x116807&&_0x116807['autoAssociation']===0x0){return db['UserProfileResource'][_0x8f12('0x50')]({'name':_0x44342c[_0x8f12('0x2f')],'resourceId':_0x44342c['id'],'type':_0x116807[_0x8f12('0x2f')],'sectionId':_0x116807['id']},{})[_0x8f12('0x29')](function(){return _0x14274d;});}else{return _0x14274d;}})['catch'](function(_0x30ec86){logger[_0x8f12('0x2d')](_0x8f12('0x58'),_0x30ec86);throw _0x30ec86;});}return _0x14274d;})[_0x8f12('0x29')](respondWithResult(_0x433517,0xc9))[_0x8f12('0x4a')](handleError(_0x433517,null));};exports['update']=function(_0x578c8a,_0x2b613a){if(_0x578c8a[_0x8f12('0x51')]['id']){delete _0x578c8a[_0x8f12('0x51')]['id'];}return db[_0x8f12('0x33')][_0x8f12('0x4f')]({'where':{'id':_0x578c8a[_0x8f12('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2b613a,null))['then'](saveUpdates(_0x578c8a[_0x8f12('0x51')],null))[_0x8f12('0x29')](respondWithResult(_0x2b613a,null))[_0x8f12('0x4a')](handleError(_0x2b613a,null));};exports[_0x8f12('0x2a')]=function(_0x5dbd6a,_0x5a5ac1){return db[_0x8f12('0x33')][_0x8f12('0x4f')]({'where':{'id':_0x5dbd6a[_0x8f12('0x4c')]['id']}})[_0x8f12('0x29')](handleEntityNotFound(_0x5a5ac1,null))[_0x8f12('0x29')](removeEntity(_0x5a5ac1,null))[_0x8f12('0x4a')](handleError(_0x5a5ac1,null));};exports['describe']=function(_0x474908,_0x51aa2a){return db[_0x8f12('0x33')][_0x8f12('0x59')]()['then'](respondWithResult(_0x51aa2a,null))['catch'](handleError(_0x51aa2a,null));};exports[_0x8f12('0x5a')]=function(_0xd420e4,_0x50e4e5,_0x2de28){if(_0xd420e4[_0x8f12('0x51')]['id']){delete _0xd420e4[_0x8f12('0x51')]['id'];}return db[_0x8f12('0x33')][_0x8f12('0x4f')]({'where':{'id':_0xd420e4['params']['id']}})[_0x8f12('0x29')](handleEntityNotFound(_0x50e4e5,null))['then'](function(_0x22bb61){if(_0x22bb61){_0xd420e4[_0x8f12('0x51')][_0x8f12('0x5b')]=_0x22bb61['id'];return db['Disposition'][_0x8f12('0x50')](_0xd420e4[_0x8f12('0x51')]);}})[_0x8f12('0x29')](respondWithResult(_0x50e4e5,null))['catch'](handleError(_0x50e4e5,null));};exports[_0x8f12('0x5c')]=function(_0x4c2529,_0x5e9ebd,_0x50e0d0){var _0x1cbd89={'raw':![],'where':{}};var _0x42cd00={};var _0x19cffe={'count':0x0,'rows':[]};return db[_0x8f12('0x33')][_0x8f12('0x5d')]({'where':{'id':_0x4c2529[_0x8f12('0x4c')]['id']}})[_0x8f12('0x29')](handleEntityNotFound(_0x5e9ebd,null))[_0x8f12('0x29')](function(_0x197044){if(_0x197044){_0x42cd00[_0x8f12('0x37')]=_[_0x8f12('0x39')](db[_0x8f12('0x5e')][_0x8f12('0x34')]);_0x42cd00[_0x8f12('0x38')]=_['keys'](_0x4c2529[_0x8f12('0x38')]);_0x42cd00[_0x8f12('0x3a')]=_['intersection'](_0x42cd00[_0x8f12('0x37')],_0x42cd00['query']);_0x1cbd89[_0x8f12('0x3b')]=_[_0x8f12('0x4e')](_0x42cd00[_0x8f12('0x37')],qs[_0x8f12('0x3c')](_0x4c2529[_0x8f12('0x38')][_0x8f12('0x3c')]));_0x1cbd89[_0x8f12('0x3b')]=_0x1cbd89[_0x8f12('0x3b')][_0x8f12('0x3d')]?_0x1cbd89[_0x8f12('0x3b')]:_0x42cd00[_0x8f12('0x37')];if(!_0x4c2529['query']['hasOwnProperty'](_0x8f12('0x3f'))){_0x1cbd89['limit']=qs[_0x8f12('0x23')](_0x4c2529[_0x8f12('0x38')][_0x8f12('0x23')]);_0x1cbd89[_0x8f12('0x22')]=qs[_0x8f12('0x22')](_0x4c2529[_0x8f12('0x38')][_0x8f12('0x22')]);}_0x1cbd89['order']=qs[_0x8f12('0x41')](_0x4c2529[_0x8f12('0x38')]['sort']);_0x1cbd89[_0x8f12('0x43')]=qs[_0x8f12('0x3a')](_[_0x8f12('0x5f')](_0x4c2529['query'],_0x42cd00[_0x8f12('0x3a')]));_0x1cbd89['where'][_0x8f12('0x5b')]=_0x197044['id'];if(_0x4c2529['query'][_0x8f12('0x42')]){_0x1cbd89[_0x8f12('0x43')]=_[_0x8f12('0x44')](_0x1cbd89['where'],{'$or':_['map'](_0x1cbd89[_0x8f12('0x3b')],function(_0x16fed5){var _0x3622f7={};_0x3622f7[_0x16fed5]={'$like':'%'+_0x4c2529['query'][_0x8f12('0x42')]+'%'};return _0x3622f7;})});}_0x1cbd89=_['merge']({},_0x1cbd89,_0x4c2529[_0x8f12('0x46')]);return db[_0x8f12('0x5e')][_0x8f12('0x21')]({'where':_0x1cbd89[_0x8f12('0x43')]})['then'](function(_0x285d5e){_0x19cffe[_0x8f12('0x21')]=_0x285d5e;if(_0x4c2529['query'][_0x8f12('0x47')]){_0x1cbd89[_0x8f12('0x48')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x1cbd89);})[_0x8f12('0x29')](function(_0x439e0c){_0x19cffe[_0x8f12('0x60')]=_0x439e0c;return _0x19cffe;});}})[_0x8f12('0x29')](respondWithFilteredResult(_0x5e9ebd,_0x1cbd89))[_0x8f12('0x4a')](handleError(_0x5e9ebd,null));};exports[_0x8f12('0x61')]=function(_0x3f0ec6,_0x527a98,_0x534f93){return db[_0x8f12('0x33')][_0x8f12('0x4f')]({'where':{'id':_0x3f0ec6['params']['id']}})[_0x8f12('0x29')](handleEntityNotFound(_0x527a98,null))['then'](function(_0x415875){if(_0x415875){return _0x415875[_0x8f12('0x61')](_0x3f0ec6['query'][_0x8f12('0x62')]);}})[_0x8f12('0x29')](respondWithStatusCode(_0x527a98,null))[_0x8f12('0x4a')](handleError(_0x527a98,null));};exports[_0x8f12('0x63')]=function(_0x3da198,_0x48a099,_0x293adf){return db['CmList'][_0x8f12('0x4f')]({'where':{'id':_0x3da198[_0x8f12('0x4c')]['id']}})[_0x8f12('0x29')](handleEntityNotFound(_0x48a099,null))[_0x8f12('0x29')](function(_0x351fc3){if(_0x351fc3){var _0x21a5eb=[];var _0x6cf5fa={'success':[],'errors':[]};return db[_0x8f12('0x64')][_0x8f12('0x59')]()['then'](function(_0x156ea1){if(_0x3da198['body'][_0x8f12('0x65')]&&_[_0x8f12('0x66')](_0x3da198[_0x8f12('0x51')][_0x8f12('0x65')])){if(_0x3da198[_0x8f12('0x51')][_0x8f12('0x65')][_0x8f12('0x3d')]){_0x3da198[_0x8f12('0x51')][_0x8f12('0x65')]=_0x3da198['body']['tags'][_0x8f12('0x67')](';')+';';}else{_0x3da198[_0x8f12('0x51')][_0x8f12('0x65')]=null;}}else{_0x3da198[_0x8f12('0x51')][_0x8f12('0x65')]=null;}if(_0x3da198[_0x8f12('0x51')]&&_[_0x8f12('0x66')](_0x3da198[_0x8f12('0x51')])){for(var _0x5c92f5=0x0;_0x5c92f5<_0x3da198[_0x8f12('0x51')][_0x8f12('0x3d')];_0x5c92f5+=0x1){_0x3da198['body'][_0x5c92f5][_0x8f12('0x5b')]=_0x3da198[_0x8f12('0x4c')]['id'];_0x21a5eb[_0x8f12('0x68')](_0x3da198[_0x8f12('0x51')][_0x5c92f5]);}return BPromise['each'](_0x21a5eb,function(_0x16465b){return db[_0x8f12('0x64')][_0x8f12('0x50')](_[_0x8f12('0x69')](_0x16465b,[_0x8f12('0x62'),'id'])||{},{'fields':_[_0x8f12('0x39')](_0x156ea1),'raw':!![]})[_0x8f12('0x29')](function(_0x1b7cf4){_0x6cf5fa['success'][_0x8f12('0x68')](_0x1b7cf4[_0x8f12('0x6a')]);})[_0x8f12('0x4a')](function(_0x49e75f){_0x6cf5fa['errors'][_0x8f12('0x68')]({'data':_0x16465b,'error':_0x49e75f['message']});});})[_0x8f12('0x29')](function(_0x325b4b){return _0x6cf5fa;})[_0x8f12('0x4a')](function(_0x37a821){return _0x37a821;});}else{_0x48a099[_0x8f12('0x1e')](0x190)[_0x8f12('0x20')]({'message':_0x8f12('0x6b')});}});}})[_0x8f12('0x29')](respondWithResult(_0x48a099,null))[_0x8f12('0x4a')](handleError(_0x48a099,null));};exports[_0x8f12('0x6c')]=function(_0x26d89c,_0xe2528b,_0x2b85b7){var _0x2bf863;return db['CmList'][_0x8f12('0x4f')]({'where':{'id':_0x26d89c[_0x8f12('0x4c')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0xe2528b,null))[_0x8f12('0x29')](function(_0x3290b9){if(_0x3290b9){_0x2bf863=_0x3290b9;return db[_0x8f12('0x64')][_0x8f12('0x34')];}})[_0x8f12('0x29')](function(_0x27b99c){if(_0x27b99c){var _0x2a86ed={};var _0x2f90f2={};_0x2f90f2[_0x8f12('0x37')]=_[_0x8f12('0x6d')](_['keys'](_0x27b99c),_[_0x8f12('0x32')](_0x2bf863['CustomFields'],function(_0x352300){return util[_0x8f12('0x6e')](_0x8f12('0x6f'),_0x352300['id']);}));_0x2f90f2[_0x8f12('0x38')]=_[_0x8f12('0x39')](_0x26d89c[_0x8f12('0x38')]);_0x2f90f2['filters']=_[_0x8f12('0x4e')](_0x2f90f2['model'],_0x2f90f2[_0x8f12('0x38')]);_0x2a86ed[_0x8f12('0x3b')]=_[_0x8f12('0x4e')](_0x2f90f2[_0x8f12('0x37')],qs[_0x8f12('0x3c')](_0x26d89c[_0x8f12('0x38')]['fields']));_0x2a86ed['attributes']=_0x2a86ed[_0x8f12('0x3b')][_0x8f12('0x3d')]?_0x2a86ed[_0x8f12('0x3b')]:_0x2f90f2[_0x8f12('0x37')];if(!_0x26d89c[_0x8f12('0x38')]['hasOwnProperty'](_0x8f12('0x3f'))){_0x2a86ed[_0x8f12('0x23')]=qs[_0x8f12('0x23')](_0x26d89c[_0x8f12('0x38')]['limit']);_0x2a86ed[_0x8f12('0x22')]=qs[_0x8f12('0x22')](_0x26d89c['query'][_0x8f12('0x22')]);}_0x2a86ed[_0x8f12('0x40')]=qs[_0x8f12('0x41')](_0x26d89c[_0x8f12('0x38')][_0x8f12('0x41')]);_0x2a86ed[_0x8f12('0x43')]=qs['filters'](_[_0x8f12('0x5f')](_0x26d89c['query'],_0x2f90f2[_0x8f12('0x3a')]));_0x2a86ed['raw']=!![];if(_0x26d89c[_0x8f12('0x38')][_0x8f12('0x42')]){_0x2a86ed[_0x8f12('0x43')]=_[_0x8f12('0x44')](_0x2a86ed[_0x8f12('0x43')],{'$or':_[_0x8f12('0x32')](_0x2a86ed['attributes'],function(_0x3f0442){var _0x34fd1b={};_0x34fd1b[_0x3f0442]={'$like':'%'+_0x26d89c[_0x8f12('0x38')][_0x8f12('0x42')]+'%'};return _0x34fd1b;})});}_0x2a86ed=_[_0x8f12('0x44')]({},_0x2a86ed,_0x26d89c[_0x8f12('0x46')]);return _0x2bf863[_0x8f12('0x6c')](_0x2a86ed);}})[_0x8f12('0x29')](respondWithResult(_0xe2528b,null))[_0x8f12('0x4a')](handleError(_0xe2528b,null));};exports[_0x8f12('0x70')]=function(_0x1947d9,_0xc5296e,_0x4d8fc2){var _0x1b13b2;return db['CmList'][_0x8f12('0x4f')]({'where':{'id':_0x1947d9['params']['id']},'include':[{'model':db[_0x8f12('0x71')],'as':'CustomFields'}]})[_0x8f12('0x29')](handleEntityNotFound(_0xc5296e,null))['then'](function(_0x2e2e60){if(_0x2e2e60){_0x1b13b2=_0x2e2e60;return db[_0x8f12('0x64')][_0x8f12('0x34')];}})['then'](function(_0x48f6eb){if(_0x48f6eb){var _0x4e2876={};var _0x333042={};_0x333042[_0x8f12('0x37')]=_[_0x8f12('0x6d')](_[_0x8f12('0x39')](_0x48f6eb),_[_0x8f12('0x32')](_0x1b13b2[_0x8f12('0x72')],function(_0x3a90b2){return util[_0x8f12('0x6e')](_0x8f12('0x6f'),_0x3a90b2['id']);}));_0x333042['query']=_['keys'](_0x1947d9['query']);_0x333042[_0x8f12('0x3a')]=_[_0x8f12('0x4e')](_0x333042[_0x8f12('0x37')],_0x333042[_0x8f12('0x38')]);_0x4e2876[_0x8f12('0x3b')]=_[_0x8f12('0x4e')](_0x333042[_0x8f12('0x37')],qs['fields'](_0x1947d9['query']['fields']));_0x4e2876[_0x8f12('0x3b')]=_0x4e2876[_0x8f12('0x3b')][_0x8f12('0x3d')]?_0x4e2876[_0x8f12('0x3b')]:_0x333042[_0x8f12('0x37')];if(!_0x1947d9[_0x8f12('0x38')][_0x8f12('0x3e')](_0x8f12('0x3f'))){_0x4e2876[_0x8f12('0x23')]=qs['limit'](_0x1947d9['query'][_0x8f12('0x23')]);_0x4e2876['offset']=qs['offset'](_0x1947d9[_0x8f12('0x38')][_0x8f12('0x22')]);}_0x4e2876[_0x8f12('0x40')]=qs[_0x8f12('0x41')](_0x1947d9['query']['sort']);_0x4e2876[_0x8f12('0x43')]=qs['filters'](_['pick'](_0x1947d9[_0x8f12('0x38')],_0x333042['filters']));_0x4e2876[_0x8f12('0x73')]=!![];if(_0x1947d9[_0x8f12('0x38')][_0x8f12('0x42')]){_0x4e2876[_0x8f12('0x43')]=_[_0x8f12('0x44')](_0x4e2876['where'],{'$or':_['map'](_0x4e2876['attributes'],function(_0x5bd6c7){var _0x4f6928={};_0x4f6928[_0x5bd6c7]={'$like':'%'+_0x1947d9['query'][_0x8f12('0x42')]+'%'};return _0x4f6928;})});}_0x4e2876=_[_0x8f12('0x44')]({},_0x4e2876,_0x1947d9[_0x8f12('0x46')]);return _0x1b13b2[_0x8f12('0x6c')](_0x4e2876);}})[_0x8f12('0x29')](function(_0x4c2266){if(!_[_0x8f12('0x74')](_0x4c2266)){var _0x19fe43=toCsv(_0x4c2266);var _0x4083df=Date[_0x8f12('0x75')]();fs[_0x8f12('0x76')](util[_0x8f12('0x6e')](_0x8f12('0x77'),_0x1b13b2['id'],_0x4083df),_0x19fe43);_0xc5296e[_0x8f12('0x78')]('Content-disposition',_0x8f12('0x79')+util[_0x8f12('0x6e')](_0x8f12('0x7a'),_0x1b13b2['id'],_0x4083df));_0xc5296e['setHeader'](_0x8f12('0x7b'),_0x8f12('0x7c'));return _0xc5296e[_0x8f12('0x7d')](util['format']('/tmp/list_%d_%s.csv',_0x1b13b2['id'],_0x4083df));}else{return _0xc5296e[_0x8f12('0x1d')](0xcc);}})[_0x8f12('0x4a')](handleError(_0xc5296e,null));};exports[_0x8f12('0x7e')]=function(_0x402d99,_0x213b1d,_0x41efd0){var _0x22a723;delete _0x402d99[_0x8f12('0x51')]['id'];return db[_0x8f12('0x33')][_0x8f12('0x5d')]({'where':{'id':_0x402d99[_0x8f12('0x4c')]['id']}})[_0x8f12('0x29')](handleEntityNotFound(_0x213b1d,null))['then'](function(_0x53fccf){if(_0x53fccf){return db[_0x8f12('0x7f')][_0x8f12('0x80')](function(_0x44edb8){return db['CmCustomField'][_0x8f12('0x50')](_0x402d99['body'],{'transaction':_0x44edb8})[_0x8f12('0x29')](function(_0x209f01){_0x22a723=_0x209f01;return _0x53fccf[_0x8f12('0x81')](_0x209f01,{'transaction':_0x44edb8});})[_0x8f12('0x29')](function(){var _0x3fdb1c={'type':db[_0x8f12('0x82')][_0x8f12('0x83')],'transaction':_0x44edb8};switch(_0x402d99[_0x8f12('0x51')][_0x8f12('0x84')]){case _0x8f12('0x85'):_0x3fdb1c[_0x8f12('0x84')]=db[_0x8f12('0x82')]['TEXT'];break;case _0x8f12('0x86'):_0x3fdb1c[_0x8f12('0x84')]=db['Sequelize'][_0x8f12('0x87')];break;case _0x8f12('0x88'):_0x3fdb1c[_0x8f12('0x84')]=db[_0x8f12('0x82')][_0x8f12('0x89')];_0x3fdb1c['defaultValue']=![];break;default:}return db[_0x8f12('0x7f')][_0x8f12('0x8a')][_0x8f12('0x8b')](_0x8f12('0x8c'),util[_0x8f12('0x6e')](_0x8f12('0x8d'),_0x22a723['id']),_0x3fdb1c);})[_0x8f12('0x29')](function(){return _0x22a723;});});}})['then'](respondWithResult(_0x213b1d,null))[_0x8f12('0x4a')](handleError(_0x213b1d,null));};exports[_0x8f12('0x8e')]=function(_0x49325a,_0x9a5683,_0x5b3d09){var _0x132d91={};var _0x44cf56={};var _0x255b8b;var _0x2ba6cd;return db[_0x8f12('0x33')][_0x8f12('0x5d')]({'where':{'id':_0x49325a[_0x8f12('0x4c')]['id']}})[_0x8f12('0x29')](handleEntityNotFound(_0x9a5683,null))[_0x8f12('0x29')](function(_0x3e8b67){if(_0x3e8b67){_0x255b8b=_0x3e8b67;_0x44cf56[_0x8f12('0x37')]=_['keys'](db[_0x8f12('0x71')][_0x8f12('0x34')]);_0x44cf56['query']=_['keys'](_0x49325a[_0x8f12('0x38')]);_0x44cf56[_0x8f12('0x3a')]=_[_0x8f12('0x4e')](_0x44cf56['model'],_0x44cf56[_0x8f12('0x38')]);_0x132d91['attributes']=_[_0x8f12('0x4e')](_0x44cf56[_0x8f12('0x37')],qs[_0x8f12('0x3c')](_0x49325a[_0x8f12('0x38')]['fields']));_0x132d91[_0x8f12('0x3b')]=_0x132d91[_0x8f12('0x3b')][_0x8f12('0x3d')]?_0x132d91[_0x8f12('0x3b')]:_0x44cf56[_0x8f12('0x37')];_0x132d91[_0x8f12('0x40')]=qs[_0x8f12('0x41')](_0x49325a['query'][_0x8f12('0x41')]);_0x132d91['where']=qs['filters'](_[_0x8f12('0x5f')](_0x49325a[_0x8f12('0x38')],_0x44cf56['filters']));_0x132d91[_0x8f12('0x43')]=_[_0x8f12('0x44')](_0x132d91[_0x8f12('0x43')],{'$or':[{'ListId':_0x3e8b67['id']},{'ListId':null}]});if(_0x49325a[_0x8f12('0x38')][_0x8f12('0x42')]){_0x132d91[_0x8f12('0x43')]=_[_0x8f12('0x44')](_0x132d91['where'],{'$or':_[_0x8f12('0x32')](_0x132d91[_0x8f12('0x3b')],function(_0x33dcfa){var _0xfcd6c9={};_0xfcd6c9[_0x33dcfa]={'$like':'%'+_0x49325a[_0x8f12('0x38')][_0x8f12('0x42')]+'%'};return _0xfcd6c9;})});}_0x132d91=_[_0x8f12('0x44')]({},_0x132d91,_0x49325a[_0x8f12('0x46')]);return db[_0x8f12('0x71')][_0x8f12('0x8f')](_0x132d91);}})[_0x8f12('0x29')](respondWithResult(_0x9a5683,null))[_0x8f12('0x4a')](handleError(_0x9a5683,null));};exports[_0x8f12('0x90')]=function(_0x43c7af,_0x47bfd0,_0x3e2fc8){return db[_0x8f12('0x33')][_0x8f12('0x4f')]({'where':{'id':_0x43c7af['params']['id']}})['then'](handleEntityNotFound(_0x47bfd0,null))[_0x8f12('0x29')](function(_0x20ffbd){if(_0x20ffbd){return _0x20ffbd['addAgents'](_0x43c7af['body'][_0x8f12('0x62')],_[_0x8f12('0x69')](_0x43c7af[_0x8f12('0x51')],[_0x8f12('0x62'),'id'])||{})['spread'](function(_0x16e2a9){for(var _0x38acfc=0x0;_0x38acfc<_0x43c7af[_0x8f12('0x51')]['ids'][_0x8f12('0x3d')];_0x38acfc+=0x1){socket['emit'](_0x8f12('0x91'),{'UserId':_0x43c7af['body'][_0x8f12('0x62')][_0x38acfc],'CmListId':_0x43c7af[_0x8f12('0x4c')]['id']});}return _0x16e2a9;});}})[_0x8f12('0x29')](respondWithResult(_0x47bfd0,null))[_0x8f12('0x4a')](handleError(_0x47bfd0,null));};exports[_0x8f12('0x92')]=function(_0x2a8266,_0x497fa9,_0x38a7ad){return db['CmList'][_0x8f12('0x4f')]({'where':{'id':_0x2a8266[_0x8f12('0x4c')]['id']}})[_0x8f12('0x29')](handleEntityNotFound(_0x497fa9,null))[_0x8f12('0x29')](function(_0x54705c){if(_0x54705c){return _0x54705c[_0x8f12('0x92')](_0x2a8266[_0x8f12('0x38')][_0x8f12('0x62')])['then'](function(){if(_[_0x8f12('0x66')](_0x2a8266[_0x8f12('0x38')][_0x8f12('0x62')])){for(var _0x1378d2=0x0;_0x1378d2<_0x2a8266[_0x8f12('0x38')]['ids'][_0x8f12('0x3d')];_0x1378d2+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x2a8266[_0x8f12('0x38')][_0x8f12('0x62')][_0x1378d2]),'CmListId':Number(_0x2a8266[_0x8f12('0x4c')]['id'])});}}else{socket['emit'](_0x8f12('0x93'),{'UserId':Number(_0x2a8266[_0x8f12('0x38')][_0x8f12('0x62')]),'CmListId':Number(_0x2a8266[_0x8f12('0x4c')]['id'])});}});}})[_0x8f12('0x29')](respondWithStatusCode(_0x497fa9,null))[_0x8f12('0x4a')](handleError(_0x497fa9,null));};exports[_0x8f12('0x94')]=function(_0x3d5c64,_0x58e7c5,_0x6bce5b){var _0xd8e2fd={};var _0x3ff95f={};var _0x4ac4cb;var _0x14e832;return db['CmList'][_0x8f12('0x5d')]({'where':{'id':_0x3d5c64[_0x8f12('0x4c')]['id']}})[_0x8f12('0x29')](handleEntityNotFound(_0x58e7c5,null))[_0x8f12('0x29')](function(_0x18e2c7){if(_0x18e2c7){_0x4ac4cb=_0x18e2c7;_0x3ff95f[_0x8f12('0x37')]=_[_0x8f12('0x39')](db['User'][_0x8f12('0x34')]);_0x3ff95f[_0x8f12('0x38')]=_[_0x8f12('0x39')](_0x3d5c64['query']);_0x3ff95f['filters']=_[_0x8f12('0x4e')](_0x3ff95f[_0x8f12('0x37')],_0x3ff95f[_0x8f12('0x38')]);_0xd8e2fd[_0x8f12('0x3b')]=_['intersection'](_0x3ff95f[_0x8f12('0x37')],qs[_0x8f12('0x3c')](_0x3d5c64[_0x8f12('0x38')][_0x8f12('0x3c')]));_0xd8e2fd['attributes']=_0xd8e2fd[_0x8f12('0x3b')]['length']?_0xd8e2fd[_0x8f12('0x3b')]:_0x3ff95f[_0x8f12('0x37')];_0xd8e2fd[_0x8f12('0x40')]=qs[_0x8f12('0x41')](_0x3d5c64[_0x8f12('0x38')][_0x8f12('0x41')]);_0xd8e2fd[_0x8f12('0x43')]=qs[_0x8f12('0x3a')](_[_0x8f12('0x5f')](_0x3d5c64[_0x8f12('0x38')],_0x3ff95f[_0x8f12('0x3a')]));if(_0x3d5c64['query']['filter']){_0xd8e2fd[_0x8f12('0x43')]=_[_0x8f12('0x44')](_0xd8e2fd[_0x8f12('0x43')],{'$or':_[_0x8f12('0x32')](_0xd8e2fd[_0x8f12('0x3b')],function(_0x160c80){var _0x56c38e={};_0x56c38e[_0x160c80]={'$like':'%'+_0x3d5c64[_0x8f12('0x38')][_0x8f12('0x42')]+'%'};return _0x56c38e;})});}_0xd8e2fd=_['merge']({},_0xd8e2fd,_0x3d5c64[_0x8f12('0x46')]);return _0x4ac4cb[_0x8f12('0x94')](_0xd8e2fd);}})[_0x8f12('0x29')](function(_0x3640e7){if(_0x3640e7){_0x14e832=_0x3640e7[_0x8f12('0x3d')];if(!_0x3d5c64[_0x8f12('0x38')]['hasOwnProperty']('nolimit')){_0xd8e2fd[_0x8f12('0x23')]=qs[_0x8f12('0x23')](_0x3d5c64[_0x8f12('0x38')][_0x8f12('0x23')]);_0xd8e2fd[_0x8f12('0x22')]=qs[_0x8f12('0x22')](_0x3d5c64[_0x8f12('0x38')][_0x8f12('0x22')]);}return _0x4ac4cb[_0x8f12('0x94')](_0xd8e2fd);}})[_0x8f12('0x29')](function(_0x2412cf){if(_0x2412cf){return _0x2412cf?{'count':_0x14e832,'rows':_0x2412cf}:null;}})['then'](respondWithResult(_0x58e7c5,null))[_0x8f12('0x4a')](handleError(_0x58e7c5,null));};
\ No newline at end of file