Built motion from commit (unavailable).|2.5.27
[motion2.git] / server / api / cmList / cmList.controller.js
index 2f3b850..79dfacc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','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','success','errors','message','CmCustomField','CustomFields','concat','format','cf_%d','nolimit','raw','getContacts','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll'];(function(_0x402577,_0x557fc5){var _0x12a6d3=function(_0x4386c1){while(--_0x4386c1){_0x402577['push'](_0x402577['shift']());}};_0x12a6d3(++_0x557fc5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];config[_0x0a9e('0x14')]=_[_0x0a9e('0x15')](config[_0x0a9e('0x14')],{'host':_0x0a9e('0x16'),'port':0x18eb});var socket=require(_0x0a9e('0x17'))(new Redis(config['redis']));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x2b4227,_0x281129){_0x281129=_0x281129||0xcc;return function(_0x44dcfd){if(_0x44dcfd){return _0x2b4227[_0x0a9e('0x1a')](_0x281129);}return _0x2b4227['status'](_0x281129)[_0x0a9e('0x1b')]();};}function respondWithResult(_0x5d0880,_0x1985b6){_0x1985b6=_0x1985b6||0xc8;return function(_0x519dfd){if(_0x519dfd){return _0x5d0880[_0x0a9e('0x1c')](_0x1985b6)[_0x0a9e('0x1d')](_0x519dfd);}};}function respondWithFilteredResult(_0x48f32d,_0x225616){return function(_0x5a0a06){if(_0x5a0a06){var _0x459eb1=_0x5a0a06[_0x0a9e('0x1e')],_0x478723=_0x225616[_0x0a9e('0x1f')],_0x106033=_0x225616[_0x0a9e('0x1f')]+_0x225616[_0x0a9e('0x20')],_0x205fd6;if(_0x106033>=_0x459eb1){_0x106033=_0x459eb1;_0x205fd6=0xc8;}else{_0x205fd6=0xce;}_0x48f32d[_0x0a9e('0x1c')](_0x205fd6);return _0x48f32d[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x478723+'-'+_0x106033+'/'+_0x459eb1)[_0x0a9e('0x1d')](_0x5a0a06);}return null;};}function patchUpdates(_0x4bb1e3){return function(_0x2c3407){try{jsonpatch[_0x0a9e('0x23')](_0x2c3407,_0x4bb1e3,!![]);}catch(_0x53682f){return BPromise[_0x0a9e('0x24')](_0x53682f);}return _0x2c3407['save']();};}function saveUpdates(_0x588269,_0x3a02e1){return function(_0x432e56){if(_0x432e56){return _0x432e56[_0x0a9e('0x25')](_0x588269)[_0x0a9e('0x26')](function(_0x4abc77){return _0x4abc77;});}return null;};}function removeEntity(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(_0x3b45bc){return _0x3b45bc[_0x0a9e('0x27')]()[_0x0a9e('0x26')](function(){var _0x42ac8f=_0x3b45bc[_0x0a9e('0x28')]({'plain':!![]});var _0x5ea472='Lists';return db[_0x0a9e('0x29')][_0x0a9e('0x27')]({'where':{'type':_0x5ea472,'resourceId':_0x42ac8f['id']}})[_0x0a9e('0x26')](function(){return _0x3b45bc;});})[_0x0a9e('0x26')](function(){_0xfb6e48['status'](0xcc)[_0x0a9e('0x1b')]();});}};}function handleEntityNotFound(_0x479bc4,_0x45a1e7){return function(_0x5bfb33){if(!_0x5bfb33){_0x479bc4[_0x0a9e('0x1a')](0x194);}return _0x5bfb33;};}function handleError(_0x34dc65,_0x25fba9){_0x25fba9=_0x25fba9||0x1f4;return function(_0x14433c){logger[_0x0a9e('0x2a')](_0x14433c[_0x0a9e('0x2b')]);if(_0x14433c[_0x0a9e('0x2c')]){delete _0x14433c[_0x0a9e('0x2c')];}_0x34dc65['status'](_0x25fba9)[_0x0a9e('0x2d')](_0x14433c);};}exports[_0x0a9e('0x2e')]=function(_0x2b1f27,_0x2ec755){var _0x5c877d={},_0x15b200={},_0x40e7a3={'count':0x0,'rows':[]};var _0x1843b2=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x296f41){return{'name':_0x296f41[_0x0a9e('0x32')],'type':_0x296f41[_0x0a9e('0x33')]['key']};});_0x15b200[_0x0a9e('0x34')]=_['map'](_0x1843b2,_0x0a9e('0x2c'));_0x15b200[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x2b1f27[_0x0a9e('0x35')]);_0x15b200[_0x0a9e('0x37')]=_['intersection'](_0x15b200[_0x0a9e('0x34')],_0x15b200[_0x0a9e('0x35')]);_0x5c877d[_0x0a9e('0x38')]=_[_0x0a9e('0x39')](_0x15b200[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x5c877d['attributes']=_0x5c877d[_0x0a9e('0x38')]['length']?_0x5c877d[_0x0a9e('0x38')]:_0x15b200[_0x0a9e('0x34')];if(!_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x3b')]('nolimit')){_0x5c877d[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x20')]);_0x5c877d['offset']=qs['offset'](_0x2b1f27[_0x0a9e('0x35')]['offset']);}_0x5c877d[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x5c877d['where']=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x2b1f27[_0x0a9e('0x35')],_0x15b200['filters']));if(_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x5c877d[_0x0a9e('0x40')]=_['merge'](_0x5c877d['where'],{'$or':_[_0x0a9e('0x2f')](_0x1843b2,function(_0x40d766){if(_0x40d766['type']!==_0x0a9e('0x41')){var _0x419125={};_0x419125[_0x40d766[_0x0a9e('0x2c')]]={'$like':'%'+_0x2b1f27[_0x0a9e('0x35')]['filter']+'%'};return _0x419125;}})});}_0x5c877d=_['merge']({},_0x5c877d,_0x2b1f27[_0x0a9e('0x42')]);var _0x45b3d0={'where':_0x5c877d['where']};return db[_0x0a9e('0x30')][_0x0a9e('0x1e')](_0x45b3d0)[_0x0a9e('0x26')](function(_0x5b4f5e){_0x40e7a3[_0x0a9e('0x1e')]=_0x5b4f5e;if(_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x43')]){_0x5c877d[_0x0a9e('0x44')]=[{'all':!![]}];}return db[_0x0a9e('0x30')][_0x0a9e('0x45')](_0x5c877d);})[_0x0a9e('0x26')](function(_0x45a9b8){_0x40e7a3[_0x0a9e('0x46')]=_0x45a9b8;return _0x40e7a3;})[_0x0a9e('0x26')](respondWithFilteredResult(_0x2ec755,_0x5c877d))[_0x0a9e('0x47')](handleError(_0x2ec755,null));};exports[_0x0a9e('0x48')]=function(_0x1a7bce,_0x11ca30){var _0x37f6cc={'raw':![],'where':{'id':_0x1a7bce['params']['id']}},_0x4d04c8={};_0x4d04c8[_0x0a9e('0x34')]=_[_0x0a9e('0x36')](db[_0x0a9e('0x30')][_0x0a9e('0x31')]);_0x4d04c8[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x1a7bce[_0x0a9e('0x35')]);_0x4d04c8[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x4d04c8[_0x0a9e('0x34')],_0x4d04c8[_0x0a9e('0x35')]);_0x37f6cc[_0x0a9e('0x38')]=_['intersection'](_0x4d04c8[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x1a7bce[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x37f6cc[_0x0a9e('0x38')]=_0x37f6cc[_0x0a9e('0x38')][_0x0a9e('0x49')]?_0x37f6cc[_0x0a9e('0x38')]:_0x4d04c8['model'];if(_0x1a7bce[_0x0a9e('0x35')]['includeAll']){_0x37f6cc[_0x0a9e('0x44')]=[{'all':!![]}];}_0x37f6cc=_[_0x0a9e('0x4a')]({},_0x37f6cc,_0x1a7bce[_0x0a9e('0x42')]);return db['CmList'][_0x0a9e('0x4b')](_0x37f6cc)[_0x0a9e('0x26')](handleEntityNotFound(_0x11ca30,null))[_0x0a9e('0x26')](respondWithResult(_0x11ca30,null))[_0x0a9e('0x47')](handleError(_0x11ca30,null));};exports[_0x0a9e('0x4c')]=function(_0x37be73,_0x45bf7f){return db['CmList'][_0x0a9e('0x4c')](_0x37be73[_0x0a9e('0x4d')],{})[_0x0a9e('0x26')](function(_0x16f976){var _0x409789=_0x37be73[_0x0a9e('0x4e')][_0x0a9e('0x28')]({'plain':!![]});if(!_0x409789)throw new Error(_0x0a9e('0x4f'));if(_0x409789[_0x0a9e('0x50')]==='user'){var _0xe401a=_0x16f976[_0x0a9e('0x28')]({'plain':!![]});var _0x4f7240='Lists';return db['UserProfileSection'][_0x0a9e('0x4b')]({'where':{'name':_0x4f7240,'userProfileId':_0x409789[_0x0a9e('0x51')]},'raw':!![]})[_0x0a9e('0x26')](function(_0x11545a){if(_0x11545a&&_0x11545a[_0x0a9e('0x52')]===0x0){return db[_0x0a9e('0x29')][_0x0a9e('0x4c')]({'name':_0xe401a[_0x0a9e('0x2c')],'resourceId':_0xe401a['id'],'type':_0x11545a['name'],'sectionId':_0x11545a['id']},{})['then'](function(){return _0x16f976;});}else{return _0x16f976;}})['catch'](function(_0x39d77d){logger[_0x0a9e('0x2a')](_0x0a9e('0x53'),_0x39d77d);throw _0x39d77d;});}return _0x16f976;})['then'](respondWithResult(_0x45bf7f,0xc9))[_0x0a9e('0x47')](handleError(_0x45bf7f,null));};exports[_0x0a9e('0x25')]=function(_0x53d113,_0x5a88da){if(_0x53d113[_0x0a9e('0x4d')]['id']){delete _0x53d113['body']['id'];}return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x53d113[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x5a88da,null))[_0x0a9e('0x26')](saveUpdates(_0x53d113['body'],null))[_0x0a9e('0x26')](respondWithResult(_0x5a88da,null))[_0x0a9e('0x47')](handleError(_0x5a88da,null));};exports['destroy']=function(_0x50f687,_0x128aa6){return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x50f687[_0x0a9e('0x54')]['id']}})['then'](handleEntityNotFound(_0x128aa6,null))[_0x0a9e('0x26')](removeEntity(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x55')]=function(_0x4a6deb,_0x5da27d){return db['CmList'][_0x0a9e('0x55')]()['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0x47')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x56')]=function(_0x3cfd00,_0x19b4df,_0x232830){if(_0x3cfd00[_0x0a9e('0x4d')]['id']){delete _0x3cfd00[_0x0a9e('0x4d')]['id'];}return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x3cfd00[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x19b4df,null))[_0x0a9e('0x26')](function(_0x30c491){if(_0x30c491){_0x3cfd00[_0x0a9e('0x4d')][_0x0a9e('0x57')]=_0x30c491['id'];return db['Disposition'][_0x0a9e('0x4c')](_0x3cfd00[_0x0a9e('0x4d')]);}})['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0x47')](handleError(_0x19b4df,null));};exports['getDispositions']=function(_0x20c668,_0x5ba1f9,_0x4b3c1a){var _0x5674ee={'raw':![],'where':{}};var _0x273cb5={};var _0x49d231={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')][_0x0a9e('0x58')]({'where':{'id':_0x20c668[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x5ba1f9,null))[_0x0a9e('0x26')](function(_0x26d7db){if(_0x26d7db){_0x273cb5['model']=_[_0x0a9e('0x36')](db['Disposition'][_0x0a9e('0x31')]);_0x273cb5[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x20c668['query']);_0x273cb5[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x273cb5[_0x0a9e('0x34')],_0x273cb5[_0x0a9e('0x35')]);_0x5674ee['attributes']=_[_0x0a9e('0x39')](_0x273cb5[_0x0a9e('0x34')],qs['fields'](_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x5674ee[_0x0a9e('0x38')]=_0x5674ee[_0x0a9e('0x38')][_0x0a9e('0x49')]?_0x5674ee['attributes']:_0x273cb5[_0x0a9e('0x34')];if(!_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x3b')]('nolimit')){_0x5674ee[_0x0a9e('0x20')]=qs['limit'](_0x20c668['query'][_0x0a9e('0x20')]);_0x5674ee[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x1f')]);}_0x5674ee[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x5674ee[_0x0a9e('0x40')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x20c668[_0x0a9e('0x35')],_0x273cb5[_0x0a9e('0x37')]));_0x5674ee[_0x0a9e('0x40')][_0x0a9e('0x57')]=_0x26d7db['id'];if(_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x5674ee['where']=_[_0x0a9e('0x4a')](_0x5674ee[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2f')](_0x5674ee['attributes'],function(_0x1148a1){var _0x30944e={};_0x30944e[_0x1148a1]={'$like':'%'+_0x20c668['query'][_0x0a9e('0x3f')]+'%'};return _0x30944e;})});}_0x5674ee=_[_0x0a9e('0x4a')]({},_0x5674ee,_0x20c668[_0x0a9e('0x42')]);return db[_0x0a9e('0x59')][_0x0a9e('0x1e')]({'where':_0x5674ee['where']})['then'](function(_0x4a2438){_0x49d231[_0x0a9e('0x1e')]=_0x4a2438;if(_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x43')]){_0x5674ee[_0x0a9e('0x44')]=[{'all':!![]}];}return db[_0x0a9e('0x59')][_0x0a9e('0x45')](_0x5674ee);})[_0x0a9e('0x26')](function(_0x1a0677){_0x49d231['rows']=_0x1a0677;return _0x49d231;});}})[_0x0a9e('0x26')](respondWithFilteredResult(_0x5ba1f9,_0x5674ee))[_0x0a9e('0x47')](handleError(_0x5ba1f9,null));};exports[_0x0a9e('0x5a')]=function(_0x4a4fc7,_0x2bdc44,_0x583b2e){return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x4a4fc7['params']['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x2bdc44,null))[_0x0a9e('0x26')](function(_0x2cc7a7){if(_0x2cc7a7){return _0x2cc7a7[_0x0a9e('0x5a')](_0x4a4fc7['query'][_0x0a9e('0x5b')]);}})[_0x0a9e('0x26')](respondWithStatusCode(_0x2bdc44,null))[_0x0a9e('0x47')](handleError(_0x2bdc44,null));};exports[_0x0a9e('0x5c')]=function(_0x5b7fc3,_0x109ccb,_0x3d91db){return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x5b7fc3['params']['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x109ccb,null))[_0x0a9e('0x26')](function(_0x30a4c7){if(_0x30a4c7){var _0xf410e5=[];var _0x332367={'success':[],'errors':[]};return db[_0x0a9e('0x5d')][_0x0a9e('0x55')]()[_0x0a9e('0x26')](function(_0x1a7b03){if(_0x5b7fc3[_0x0a9e('0x4d')][_0x0a9e('0x5e')]&&_[_0x0a9e('0x5f')](_0x5b7fc3[_0x0a9e('0x4d')][_0x0a9e('0x5e')])){if(_0x5b7fc3['body'][_0x0a9e('0x5e')][_0x0a9e('0x49')]){_0x5b7fc3[_0x0a9e('0x4d')]['tags']=_0x5b7fc3[_0x0a9e('0x4d')][_0x0a9e('0x5e')][_0x0a9e('0x60')](';')+';';}else{_0x5b7fc3[_0x0a9e('0x4d')]['tags']=null;}}else{_0x5b7fc3['body'][_0x0a9e('0x5e')]=null;}if(_0x5b7fc3[_0x0a9e('0x4d')]&&_['isArray'](_0x5b7fc3[_0x0a9e('0x4d')])){for(var _0x53a6a1=0x0;_0x53a6a1<_0x5b7fc3[_0x0a9e('0x4d')][_0x0a9e('0x49')];_0x53a6a1+=0x1){_0x5b7fc3['body'][_0x53a6a1][_0x0a9e('0x57')]=_0x5b7fc3[_0x0a9e('0x54')]['id'];_0xf410e5[_0x0a9e('0x61')](_0x5b7fc3[_0x0a9e('0x4d')][_0x53a6a1]);}return BPromise[_0x0a9e('0x62')](_0xf410e5,function(_0x1f42a0){return db[_0x0a9e('0x5d')]['create'](_[_0x0a9e('0x63')](_0x1f42a0,[_0x0a9e('0x5b'),'id'])||{},{'fields':_[_0x0a9e('0x36')](_0x1a7b03),'raw':!![]})[_0x0a9e('0x26')](function(_0x492543){_0x332367[_0x0a9e('0x64')][_0x0a9e('0x61')](_0x492543['dataValues']);})[_0x0a9e('0x47')](function(_0x5b7940){_0x332367[_0x0a9e('0x65')][_0x0a9e('0x61')]({'data':_0x1f42a0,'error':_0x5b7940[_0x0a9e('0x66')]});});})[_0x0a9e('0x26')](function(_0x5af453){return _0x332367;})['catch'](function(_0x353384){return _0x353384;});}else{_0x109ccb[_0x0a9e('0x1c')](0x190)[_0x0a9e('0x1d')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x0a9e('0x26')](respondWithResult(_0x109ccb,null))[_0x0a9e('0x47')](handleError(_0x109ccb,null));};exports['getContacts']=function(_0x4e46b2,_0xf0a802,_0x56acca){var _0x5ea541;return db['CmList'][_0x0a9e('0x4b')]({'where':{'id':_0x4e46b2[_0x0a9e('0x54')]['id']},'include':[{'model':db[_0x0a9e('0x67')],'as':_0x0a9e('0x68')}]})[_0x0a9e('0x26')](handleEntityNotFound(_0xf0a802,null))[_0x0a9e('0x26')](function(_0x5a8854){if(_0x5a8854){_0x5ea541=_0x5a8854;return db[_0x0a9e('0x5d')]['rawAttributes'];}})[_0x0a9e('0x26')](function(_0x2aabab){if(_0x2aabab){var _0x18ad56={};var _0x4566b0={};_0x4566b0['model']=_[_0x0a9e('0x69')](_[_0x0a9e('0x36')](_0x2aabab),_[_0x0a9e('0x2f')](_0x5ea541['CustomFields'],function(_0xb6e411){return util[_0x0a9e('0x6a')](_0x0a9e('0x6b'),_0xb6e411['id']);}));_0x4566b0[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x4e46b2[_0x0a9e('0x35')]);_0x4566b0[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x4566b0['model'],_0x4566b0[_0x0a9e('0x35')]);_0x18ad56[_0x0a9e('0x38')]=_['intersection'](_0x4566b0[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x4e46b2[_0x0a9e('0x35')]['fields']));_0x18ad56[_0x0a9e('0x38')]=_0x18ad56['attributes'][_0x0a9e('0x49')]?_0x18ad56[_0x0a9e('0x38')]:_0x4566b0[_0x0a9e('0x34')];if(!_0x4e46b2[_0x0a9e('0x35')][_0x0a9e('0x3b')](_0x0a9e('0x6c'))){_0x18ad56[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x4e46b2['query'][_0x0a9e('0x20')]);_0x18ad56[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x4e46b2[_0x0a9e('0x35')][_0x0a9e('0x1f')]);}_0x18ad56[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x4e46b2[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x18ad56[_0x0a9e('0x40')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x4e46b2[_0x0a9e('0x35')],_0x4566b0['filters']));_0x18ad56[_0x0a9e('0x6d')]=!![];if(_0x4e46b2[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x18ad56[_0x0a9e('0x40')]=_[_0x0a9e('0x4a')](_0x18ad56['where'],{'$or':_[_0x0a9e('0x2f')](_0x18ad56[_0x0a9e('0x38')],function(_0x5ce99d){var _0x23b447={};_0x23b447[_0x5ce99d]={'$like':'%'+_0x4e46b2['query'][_0x0a9e('0x3f')]+'%'};return _0x23b447;})});}_0x18ad56=_[_0x0a9e('0x4a')]({},_0x18ad56,_0x4e46b2[_0x0a9e('0x42')]);return _0x5ea541[_0x0a9e('0x6e')](_0x18ad56);}})['then'](respondWithResult(_0xf0a802,null))[_0x0a9e('0x47')](handleError(_0xf0a802,null));};exports['getContactsCsv']=function(_0x2ec396,_0x3d0a77,_0x5e5b89){var _0x231c6a;return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x2ec396['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x0a9e('0x68')}]})[_0x0a9e('0x26')](handleEntityNotFound(_0x3d0a77,null))[_0x0a9e('0x26')](function(_0x413190){if(_0x413190){_0x231c6a=_0x413190;return db[_0x0a9e('0x5d')][_0x0a9e('0x31')];}})[_0x0a9e('0x26')](function(_0x3c75b9){if(_0x3c75b9){var _0x3f8124={};var _0x586510={};_0x586510[_0x0a9e('0x34')]=_['concat'](_[_0x0a9e('0x36')](_0x3c75b9),_[_0x0a9e('0x2f')](_0x231c6a[_0x0a9e('0x68')],function(_0x28ce92){return util[_0x0a9e('0x6a')]('cf_%d',_0x28ce92['id']);}));_0x586510[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x2ec396[_0x0a9e('0x35')]);_0x586510[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x586510['model'],_0x586510['query']);_0x3f8124[_0x0a9e('0x38')]=_['intersection'](_0x586510[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x2ec396[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x3f8124[_0x0a9e('0x38')]=_0x3f8124[_0x0a9e('0x38')]['length']?_0x3f8124['attributes']:_0x586510[_0x0a9e('0x34')];if(!_0x2ec396['query'][_0x0a9e('0x3b')]('nolimit')){_0x3f8124[_0x0a9e('0x20')]=qs['limit'](_0x2ec396['query'][_0x0a9e('0x20')]);_0x3f8124[_0x0a9e('0x1f')]=qs['offset'](_0x2ec396[_0x0a9e('0x35')][_0x0a9e('0x1f')]);}_0x3f8124[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2ec396[_0x0a9e('0x35')]['sort']);_0x3f8124['where']=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x2ec396[_0x0a9e('0x35')],_0x586510[_0x0a9e('0x37')]));_0x3f8124[_0x0a9e('0x6d')]=!![];if(_0x2ec396['query'][_0x0a9e('0x3f')]){_0x3f8124[_0x0a9e('0x40')]=_['merge'](_0x3f8124[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2f')](_0x3f8124[_0x0a9e('0x38')],function(_0x2427d5){var _0x23b25b={};_0x23b25b[_0x2427d5]={'$like':'%'+_0x2ec396[_0x0a9e('0x35')][_0x0a9e('0x3f')]+'%'};return _0x23b25b;})});}_0x3f8124=_[_0x0a9e('0x4a')]({},_0x3f8124,_0x2ec396[_0x0a9e('0x42')]);return _0x231c6a[_0x0a9e('0x6e')](_0x3f8124);}})['then'](function(_0x1065a7){if(!_[_0x0a9e('0x6f')](_0x1065a7)){var _0x2ada60=toCsv(_0x1065a7);var _0x1c4232=Date[_0x0a9e('0x70')]();fs['writeFileSync'](util['format'](_0x0a9e('0x71'),_0x231c6a['id'],_0x1c4232),_0x2ada60);_0x3d0a77[_0x0a9e('0x72')](_0x0a9e('0x73'),_0x0a9e('0x74')+util[_0x0a9e('0x6a')]('list_%d_%s.csv',_0x231c6a['id'],_0x1c4232));_0x3d0a77[_0x0a9e('0x72')](_0x0a9e('0x75'),_0x0a9e('0x76'));return _0x3d0a77['download'](util[_0x0a9e('0x6a')]('/tmp/list_%d_%s.csv',_0x231c6a['id'],_0x1c4232));}else{return _0x3d0a77[_0x0a9e('0x1a')](0xcc);}})['catch'](handleError(_0x3d0a77,null));};exports[_0x0a9e('0x77')]=function(_0x42b833,_0xe339b1,_0x5c500c){var _0xc9529d;delete _0x42b833['body']['id'];return db[_0x0a9e('0x30')][_0x0a9e('0x58')]({'where':{'id':_0x42b833[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0xe339b1,null))[_0x0a9e('0x26')](function(_0x1bee04){if(_0x1bee04){return db[_0x0a9e('0x78')][_0x0a9e('0x79')](function(_0x2aaf07){return db[_0x0a9e('0x67')][_0x0a9e('0x4c')](_0x42b833[_0x0a9e('0x4d')],{'transaction':_0x2aaf07})[_0x0a9e('0x26')](function(_0x399def){_0xc9529d=_0x399def;return _0x1bee04[_0x0a9e('0x7a')](_0x399def,{'transaction':_0x2aaf07});})[_0x0a9e('0x26')](function(){var _0x5b93dd={'type':db['Sequelize'][_0x0a9e('0x7b')],'transaction':_0x2aaf07};switch(_0x42b833['body'][_0x0a9e('0x33')]){case _0x0a9e('0x7c'):_0x5b93dd['type']=db[_0x0a9e('0x7d')][_0x0a9e('0x7b')];break;case _0x0a9e('0x7e'):_0x5b93dd[_0x0a9e('0x33')]=db['Sequelize'][_0x0a9e('0x7f')];break;case _0x0a9e('0x80'):_0x5b93dd[_0x0a9e('0x33')]=db[_0x0a9e('0x7d')]['BOOLEAN'];_0x5b93dd[_0x0a9e('0x81')]=![];break;default:}return db[_0x0a9e('0x78')][_0x0a9e('0x82')]['addColumn'](_0x0a9e('0x83'),util[_0x0a9e('0x6a')](_0x0a9e('0x84'),_0xc9529d['id']),_0x5b93dd);})['then'](function(){return _0xc9529d;});});}})[_0x0a9e('0x26')](respondWithResult(_0xe339b1,null))[_0x0a9e('0x47')](handleError(_0xe339b1,null));};exports[_0x0a9e('0x85')]=function(_0x1a7f58,_0x2394d3,_0x555780){var _0x3211d2={};var _0x289e65={};var _0x4795ae;var _0x3bab3e;return db[_0x0a9e('0x30')][_0x0a9e('0x58')]({'where':{'id':_0x1a7f58['params']['id']}})['then'](handleEntityNotFound(_0x2394d3,null))['then'](function(_0x1015aa){if(_0x1015aa){_0x4795ae=_0x1015aa;_0x289e65[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x67')][_0x0a9e('0x31')]);_0x289e65[_0x0a9e('0x35')]=_['keys'](_0x1a7f58[_0x0a9e('0x35')]);_0x289e65[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x289e65[_0x0a9e('0x34')],_0x289e65[_0x0a9e('0x35')]);_0x3211d2[_0x0a9e('0x38')]=_[_0x0a9e('0x39')](_0x289e65[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x1a7f58['query'][_0x0a9e('0x3a')]));_0x3211d2['attributes']=_0x3211d2[_0x0a9e('0x38')][_0x0a9e('0x49')]?_0x3211d2[_0x0a9e('0x38')]:_0x289e65[_0x0a9e('0x34')];_0x3211d2[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x1a7f58['query'][_0x0a9e('0x3d')]);_0x3211d2[_0x0a9e('0x40')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x1a7f58['query'],_0x289e65[_0x0a9e('0x37')]));_0x3211d2[_0x0a9e('0x40')]=_[_0x0a9e('0x4a')](_0x3211d2[_0x0a9e('0x40')],{'$or':[{'ListId':_0x1015aa['id']},{'ListId':null}]});if(_0x1a7f58[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x3211d2[_0x0a9e('0x40')]=_[_0x0a9e('0x4a')](_0x3211d2[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2f')](_0x3211d2['attributes'],function(_0x2272bc){var _0x88b25f={};_0x88b25f[_0x2272bc]={'$like':'%'+_0x1a7f58[_0x0a9e('0x35')][_0x0a9e('0x3f')]+'%'};return _0x88b25f;})});}_0x3211d2=_[_0x0a9e('0x4a')]({},_0x3211d2,_0x1a7f58[_0x0a9e('0x42')]);return db[_0x0a9e('0x67')][_0x0a9e('0x86')](_0x3211d2);}})['then'](respondWithResult(_0x2394d3,null))[_0x0a9e('0x47')](handleError(_0x2394d3,null));};exports[_0x0a9e('0x87')]=function(_0x1a9ef1,_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x1a9ef1[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x5c65fc,null))[_0x0a9e('0x26')](function(_0x424f1b){if(_0x424f1b){return _0x424f1b[_0x0a9e('0x87')](_0x1a9ef1[_0x0a9e('0x4d')][_0x0a9e('0x5b')],_['omit'](_0x1a9ef1[_0x0a9e('0x4d')],[_0x0a9e('0x5b'),'id'])||{})[_0x0a9e('0x88')](function(_0x3db98f){for(var _0x2b624e=0x0;_0x2b624e<_0x1a9ef1[_0x0a9e('0x4d')]['ids'][_0x0a9e('0x49')];_0x2b624e+=0x1){socket['emit']('userCmList:save',{'UserId':_0x1a9ef1['body'][_0x0a9e('0x5b')][_0x2b624e],'CmListId':_0x1a9ef1[_0x0a9e('0x54')]['id']});}return _0x3db98f;});}})[_0x0a9e('0x26')](respondWithResult(_0x5c65fc,null))[_0x0a9e('0x47')](handleError(_0x5c65fc,null));};exports['removeAgents']=function(_0x4156a5,_0x309fa9,_0x3ddbc7){return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x4156a5['params']['id']}})['then'](handleEntityNotFound(_0x309fa9,null))[_0x0a9e('0x26')](function(_0x33bcb2){if(_0x33bcb2){return _0x33bcb2[_0x0a9e('0x89')](_0x4156a5['query'][_0x0a9e('0x5b')])[_0x0a9e('0x26')](function(){if(_[_0x0a9e('0x5f')](_0x4156a5['query'][_0x0a9e('0x5b')])){for(var _0x2bf85d=0x0;_0x2bf85d<_0x4156a5[_0x0a9e('0x35')]['ids'][_0x0a9e('0x49')];_0x2bf85d+=0x1){socket[_0x0a9e('0x8a')](_0x0a9e('0x8b'),{'UserId':Number(_0x4156a5['query']['ids'][_0x2bf85d]),'CmListId':Number(_0x4156a5['params']['id'])});}}else{socket[_0x0a9e('0x8a')](_0x0a9e('0x8b'),{'UserId':Number(_0x4156a5[_0x0a9e('0x35')][_0x0a9e('0x5b')]),'CmListId':Number(_0x4156a5['params']['id'])});}});}})[_0x0a9e('0x26')](respondWithStatusCode(_0x309fa9,null))['catch'](handleError(_0x309fa9,null));};exports[_0x0a9e('0x8c')]=function(_0x2ff2ab,_0x242f23,_0x57f673){var _0x33b4b3={};var _0x33a26c={};var _0xb8a476;var _0x580dd6;return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x2ff2ab[_0x0a9e('0x54')]['id']}})['then'](handleEntityNotFound(_0x242f23,null))[_0x0a9e('0x26')](function(_0x57b7d4){if(_0x57b7d4){_0xb8a476=_0x57b7d4;_0x33a26c[_0x0a9e('0x34')]=_[_0x0a9e('0x36')](db[_0x0a9e('0x8d')][_0x0a9e('0x31')]);_0x33a26c[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x2ff2ab[_0x0a9e('0x35')]);_0x33a26c['filters']=_[_0x0a9e('0x39')](_0x33a26c[_0x0a9e('0x34')],_0x33a26c['query']);_0x33b4b3[_0x0a9e('0x38')]=_[_0x0a9e('0x39')](_0x33a26c['model'],qs[_0x0a9e('0x3a')](_0x2ff2ab[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x33b4b3['attributes']=_0x33b4b3[_0x0a9e('0x38')][_0x0a9e('0x49')]?_0x33b4b3[_0x0a9e('0x38')]:_0x33a26c[_0x0a9e('0x34')];_0x33b4b3[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2ff2ab[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x33b4b3[_0x0a9e('0x40')]=qs[_0x0a9e('0x37')](_['pick'](_0x2ff2ab[_0x0a9e('0x35')],_0x33a26c['filters']));if(_0x2ff2ab[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x33b4b3[_0x0a9e('0x40')]=_[_0x0a9e('0x4a')](_0x33b4b3[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2f')](_0x33b4b3['attributes'],function(_0x119708){var _0x469035={};_0x469035[_0x119708]={'$like':'%'+_0x2ff2ab[_0x0a9e('0x35')]['filter']+'%'};return _0x469035;})});}_0x33b4b3=_[_0x0a9e('0x4a')]({},_0x33b4b3,_0x2ff2ab[_0x0a9e('0x42')]);return _0xb8a476[_0x0a9e('0x8c')](_0x33b4b3);}})[_0x0a9e('0x26')](function(_0x31e1e0){if(_0x31e1e0){_0x580dd6=_0x31e1e0[_0x0a9e('0x49')];if(!_0x2ff2ab[_0x0a9e('0x35')]['hasOwnProperty'](_0x0a9e('0x6c'))){_0x33b4b3[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x2ff2ab[_0x0a9e('0x35')][_0x0a9e('0x20')]);_0x33b4b3[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x2ff2ab['query']['offset']);}return _0xb8a476[_0x0a9e('0x8c')](_0x33b4b3);}})[_0x0a9e('0x26')](function(_0x1f4929){if(_0x1f4929){return _0x1f4929?{'count':_0x580dd6,'rows':_0x1f4929}:null;}})[_0x0a9e('0x26')](respondWithResult(_0x242f23,null))[_0x0a9e('0x47')](handleError(_0x242f23,null));};
\ No newline at end of file
+var _0xff26=['/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','isArray','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./cmList.socket','register','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','Lists','UserProfileResource','error','name','send','index','map','CmList','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','includeAll','include','findAll','show','params','merge','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','Disposition','getDispositions','findOne','options','ids','tags','join','push','each','CmContact','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','cf_%d','order','raw','format','isEmpty','writeFileSync'];(function(_0x248df4,_0x2c9820){var _0x593986=function(_0x5b69df){while(--_0x5b69df){_0x248df4['push'](_0x248df4['shift']());}};_0x593986(++_0x2c9820);}(_0xff26,0x1da));var _0x6ff2=function(_0x2af235,_0x45f664){_0x2af235=_0x2af235-0x0;var _0x593c0e=_0xff26[_0x2af235];return _0x593c0e;};'use strict';var emlformat=require(_0x6ff2('0x0'));var rimraf=require(_0x6ff2('0x1'));var zipdir=require(_0x6ff2('0x2'));var jsonpatch=require(_0x6ff2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6ff2('0x4'));var Mustache=require(_0x6ff2('0x5'));var util=require('util');var path=require(_0x6ff2('0x6'));var sox=require('sox');var csv=require(_0x6ff2('0x7'));var ejs=require(_0x6ff2('0x8'));var fs=require('fs');var fs_extra=require(_0x6ff2('0x9'));var _=require(_0x6ff2('0xa'));var squel=require(_0x6ff2('0xb'));var crypto=require(_0x6ff2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6ff2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6ff2('0xe'));var Papa=require(_0x6ff2('0xf'));var Redis=require(_0x6ff2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6ff2('0x11'));var as=require(_0x6ff2('0x12'));var hardwareService=require(_0x6ff2('0x13'));var logger=require(_0x6ff2('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6ff2('0x15'));var licenseUtil=require(_0x6ff2('0x16'));var db=require(_0x6ff2('0x17'))['db'];config['redis']=_[_0x6ff2('0x18')](config[_0x6ff2('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6ff2('0x19')]));require(_0x6ff2('0x1a'))[_0x6ff2('0x1b')](socket);function respondWithStatusCode(_0x5e3005,_0x124cae){_0x124cae=_0x124cae||0xcc;return function(_0x58edf9){if(_0x58edf9){return _0x5e3005[_0x6ff2('0x1c')](_0x124cae);}return _0x5e3005['status'](_0x124cae)[_0x6ff2('0x1d')]();};}function respondWithResult(_0x5f3f5b,_0x3f4994){_0x3f4994=_0x3f4994||0xc8;return function(_0x327879){if(_0x327879){return _0x5f3f5b[_0x6ff2('0x1e')](_0x3f4994)[_0x6ff2('0x1f')](_0x327879);}};}function respondWithFilteredResult(_0xf6f203,_0x5de493){return function(_0x2793fb){if(_0x2793fb){var _0x4ec2e8=_0x2793fb[_0x6ff2('0x20')],_0x198d95=_0x5de493[_0x6ff2('0x21')],_0x5c93b8=_0x5de493[_0x6ff2('0x21')]+_0x5de493[_0x6ff2('0x22')],_0x25814a;if(_0x5c93b8>=_0x4ec2e8){_0x5c93b8=_0x4ec2e8;_0x25814a=0xc8;}else{_0x25814a=0xce;}_0xf6f203[_0x6ff2('0x1e')](_0x25814a);return _0xf6f203['set'](_0x6ff2('0x23'),_0x198d95+'-'+_0x5c93b8+'/'+_0x4ec2e8)[_0x6ff2('0x1f')](_0x2793fb);}return null;};}function patchUpdates(_0x4242d7){return function(_0x38c078){try{jsonpatch[_0x6ff2('0x24')](_0x38c078,_0x4242d7,!![]);}catch(_0x45669f){return BPromise[_0x6ff2('0x25')](_0x45669f);}return _0x38c078[_0x6ff2('0x26')]();};}function saveUpdates(_0xceb810,_0x2f502b){return function(_0x2a9d88){if(_0x2a9d88){return _0x2a9d88[_0x6ff2('0x27')](_0xceb810)['then'](function(_0x336e72){return _0x336e72;});}return null;};}function removeEntity(_0x17322d,_0x24f96a){return function(_0x577bd3){if(_0x577bd3){return _0x577bd3[_0x6ff2('0x28')]()[_0x6ff2('0x29')](function(){var _0x435260=_0x577bd3[_0x6ff2('0x2a')]({'plain':!![]});var _0x5f1d03=_0x6ff2('0x2b');return db[_0x6ff2('0x2c')][_0x6ff2('0x28')]({'where':{'type':_0x5f1d03,'resourceId':_0x435260['id']}})['then'](function(){return _0x577bd3;});})['then'](function(){_0x17322d[_0x6ff2('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26337c,_0x52590d){return function(_0x48633c){if(!_0x48633c){_0x26337c[_0x6ff2('0x1c')](0x194);}return _0x48633c;};}function handleError(_0x3853aa,_0x225a9a){_0x225a9a=_0x225a9a||0x1f4;return function(_0x41b2ab){logger[_0x6ff2('0x2d')](_0x41b2ab['stack']);if(_0x41b2ab[_0x6ff2('0x2e')]){delete _0x41b2ab['name'];}_0x3853aa[_0x6ff2('0x1e')](_0x225a9a)[_0x6ff2('0x2f')](_0x41b2ab);};}exports[_0x6ff2('0x30')]=function(_0x5b222d,_0xc6f200){var _0x4442cc={},_0x29c914={},_0x35e5a6={'count':0x0,'rows':[]};var _0x3fac3b=_[_0x6ff2('0x31')](db[_0x6ff2('0x32')][_0x6ff2('0x33')],function(_0x276ea2){return{'name':_0x276ea2[_0x6ff2('0x34')],'type':_0x276ea2[_0x6ff2('0x35')][_0x6ff2('0x36')]};});_0x29c914['model']=_[_0x6ff2('0x31')](_0x3fac3b,_0x6ff2('0x2e'));_0x29c914['query']=_[_0x6ff2('0x37')](_0x5b222d[_0x6ff2('0x38')]);_0x29c914['filters']=_[_0x6ff2('0x39')](_0x29c914[_0x6ff2('0x3a')],_0x29c914['query']);_0x4442cc[_0x6ff2('0x3b')]=_[_0x6ff2('0x39')](_0x29c914['model'],qs[_0x6ff2('0x3c')](_0x5b222d[_0x6ff2('0x38')][_0x6ff2('0x3c')]));_0x4442cc[_0x6ff2('0x3b')]=_0x4442cc[_0x6ff2('0x3b')][_0x6ff2('0x3d')]?_0x4442cc[_0x6ff2('0x3b')]:_0x29c914[_0x6ff2('0x3a')];if(!_0x5b222d[_0x6ff2('0x38')][_0x6ff2('0x3e')](_0x6ff2('0x3f'))){_0x4442cc['limit']=qs[_0x6ff2('0x22')](_0x5b222d[_0x6ff2('0x38')]['limit']);_0x4442cc['offset']=qs['offset'](_0x5b222d['query'][_0x6ff2('0x21')]);}_0x4442cc['order']=qs[_0x6ff2('0x40')](_0x5b222d['query'][_0x6ff2('0x40')]);_0x4442cc[_0x6ff2('0x41')]=qs[_0x6ff2('0x42')](_[_0x6ff2('0x43')](_0x5b222d[_0x6ff2('0x38')],_0x29c914['filters']),_0x3fac3b);if(_0x5b222d['query'][_0x6ff2('0x44')]){_0x4442cc[_0x6ff2('0x41')]=_['merge'](_0x4442cc[_0x6ff2('0x41')],{'$or':_[_0x6ff2('0x31')](_0x3fac3b,function(_0x49fa57){if(_0x49fa57[_0x6ff2('0x35')]!=='VIRTUAL'){var _0x475546={};_0x475546[_0x49fa57['name']]={'$like':'%'+_0x5b222d[_0x6ff2('0x38')][_0x6ff2('0x44')]+'%'};return _0x475546;}})});}_0x4442cc=_['merge']({},_0x4442cc,_0x5b222d['options']);var _0x167be7={'where':_0x4442cc[_0x6ff2('0x41')]};return db[_0x6ff2('0x32')][_0x6ff2('0x20')](_0x167be7)[_0x6ff2('0x29')](function(_0x30e504){_0x35e5a6['count']=_0x30e504;if(_0x5b222d[_0x6ff2('0x38')][_0x6ff2('0x45')]){_0x4442cc[_0x6ff2('0x46')]=[{'all':!![]}];}return db['CmList'][_0x6ff2('0x47')](_0x4442cc);})['then'](function(_0x4286d6){_0x35e5a6['rows']=_0x4286d6;return _0x35e5a6;})['then'](respondWithFilteredResult(_0xc6f200,_0x4442cc))['catch'](handleError(_0xc6f200,null));};exports[_0x6ff2('0x48')]=function(_0x22374a,_0x2f7351){var _0x5dc031={'raw':![],'where':{'id':_0x22374a[_0x6ff2('0x49')]['id']}},_0x5c9b7b={};_0x5c9b7b[_0x6ff2('0x3a')]=_[_0x6ff2('0x37')](db['CmList'][_0x6ff2('0x33')]);_0x5c9b7b[_0x6ff2('0x38')]=_[_0x6ff2('0x37')](_0x22374a['query']);_0x5c9b7b['filters']=_[_0x6ff2('0x39')](_0x5c9b7b[_0x6ff2('0x3a')],_0x5c9b7b[_0x6ff2('0x38')]);_0x5dc031[_0x6ff2('0x3b')]=_[_0x6ff2('0x39')](_0x5c9b7b['model'],qs[_0x6ff2('0x3c')](_0x22374a['query']['fields']));_0x5dc031['attributes']=_0x5dc031[_0x6ff2('0x3b')][_0x6ff2('0x3d')]?_0x5dc031[_0x6ff2('0x3b')]:_0x5c9b7b[_0x6ff2('0x3a')];if(_0x22374a['query'][_0x6ff2('0x45')]){_0x5dc031[_0x6ff2('0x46')]=[{'all':!![]}];}_0x5dc031=_[_0x6ff2('0x4a')]({},_0x5dc031,_0x22374a['options']);return db[_0x6ff2('0x32')]['find'](_0x5dc031)[_0x6ff2('0x29')](handleEntityNotFound(_0x2f7351,null))[_0x6ff2('0x29')](respondWithResult(_0x2f7351,null))['catch'](handleError(_0x2f7351,null));};exports[_0x6ff2('0x4b')]=function(_0x76c4b1,_0x50a5ca){return db[_0x6ff2('0x32')]['create'](_0x76c4b1['body'],{})['then'](function(_0x4c238e){var _0x264596=_0x76c4b1[_0x6ff2('0x4c')][_0x6ff2('0x2a')]({'plain':!![]});if(!_0x264596)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x264596[_0x6ff2('0x4d')]===_0x6ff2('0x4c')){var _0x6bbef9=_0x4c238e[_0x6ff2('0x2a')]({'plain':!![]});var _0x99f5b7=_0x6ff2('0x2b');return db[_0x6ff2('0x4e')][_0x6ff2('0x4f')]({'where':{'name':_0x99f5b7,'userProfileId':_0x264596[_0x6ff2('0x50')]},'raw':!![]})[_0x6ff2('0x29')](function(_0x3b3916){if(_0x3b3916&&_0x3b3916[_0x6ff2('0x51')]===0x0){return db[_0x6ff2('0x2c')]['create']({'name':_0x6bbef9['name'],'resourceId':_0x6bbef9['id'],'type':_0x3b3916[_0x6ff2('0x2e')],'sectionId':_0x3b3916['id']},{})[_0x6ff2('0x29')](function(){return _0x4c238e;});}else{return _0x4c238e;}})[_0x6ff2('0x52')](function(_0x47a824){logger['error'](_0x6ff2('0x53'),_0x47a824);throw _0x47a824;});}return _0x4c238e;})[_0x6ff2('0x29')](respondWithResult(_0x50a5ca,0xc9))['catch'](handleError(_0x50a5ca,null));};exports[_0x6ff2('0x27')]=function(_0x533bf4,_0x44cced){if(_0x533bf4[_0x6ff2('0x54')]['id']){delete _0x533bf4[_0x6ff2('0x54')]['id'];}return db[_0x6ff2('0x32')][_0x6ff2('0x4f')]({'where':{'id':_0x533bf4[_0x6ff2('0x49')]['id']}})[_0x6ff2('0x29')](handleEntityNotFound(_0x44cced,null))[_0x6ff2('0x29')](saveUpdates(_0x533bf4['body'],null))[_0x6ff2('0x29')](respondWithResult(_0x44cced,null))[_0x6ff2('0x52')](handleError(_0x44cced,null));};exports[_0x6ff2('0x28')]=function(_0x5f0f39,_0x1d4776){return db[_0x6ff2('0x32')][_0x6ff2('0x4f')]({'where':{'id':_0x5f0f39[_0x6ff2('0x49')]['id']}})['then'](handleEntityNotFound(_0x1d4776,null))[_0x6ff2('0x29')](removeEntity(_0x1d4776,null))[_0x6ff2('0x52')](handleError(_0x1d4776,null));};exports[_0x6ff2('0x55')]=function(_0x2f73b8,_0x5cbe70){return db['CmList'][_0x6ff2('0x55')]()[_0x6ff2('0x29')](respondWithResult(_0x5cbe70,null))[_0x6ff2('0x52')](handleError(_0x5cbe70,null));};exports[_0x6ff2('0x56')]=function(_0x545bce,_0x398bb8,_0x15df09){if(_0x545bce[_0x6ff2('0x54')]['id']){delete _0x545bce[_0x6ff2('0x54')]['id'];}return db[_0x6ff2('0x32')][_0x6ff2('0x4f')]({'where':{'id':_0x545bce[_0x6ff2('0x49')]['id']}})['then'](handleEntityNotFound(_0x398bb8,null))[_0x6ff2('0x29')](function(_0x34f803){if(_0x34f803){_0x545bce['body'][_0x6ff2('0x57')]=_0x34f803['id'];return db[_0x6ff2('0x58')][_0x6ff2('0x4b')](_0x545bce[_0x6ff2('0x54')]);}})[_0x6ff2('0x29')](respondWithResult(_0x398bb8,null))[_0x6ff2('0x52')](handleError(_0x398bb8,null));};exports[_0x6ff2('0x59')]=function(_0x1944cd,_0x105cfc,_0xdc52bb){var _0x2fe7a4={'raw':![],'where':{}};var _0x2d3e19={};var _0x492086={'count':0x0,'rows':[]};return db['CmList'][_0x6ff2('0x5a')]({'where':{'id':_0x1944cd[_0x6ff2('0x49')]['id']}})[_0x6ff2('0x29')](handleEntityNotFound(_0x105cfc,null))[_0x6ff2('0x29')](function(_0x5935de){if(_0x5935de){_0x2d3e19[_0x6ff2('0x3a')]=_['keys'](db[_0x6ff2('0x58')][_0x6ff2('0x33')]);_0x2d3e19[_0x6ff2('0x38')]=_[_0x6ff2('0x37')](_0x1944cd[_0x6ff2('0x38')]);_0x2d3e19[_0x6ff2('0x42')]=_[_0x6ff2('0x39')](_0x2d3e19[_0x6ff2('0x3a')],_0x2d3e19['query']);_0x2fe7a4[_0x6ff2('0x3b')]=_['intersection'](_0x2d3e19[_0x6ff2('0x3a')],qs['fields'](_0x1944cd[_0x6ff2('0x38')][_0x6ff2('0x3c')]));_0x2fe7a4[_0x6ff2('0x3b')]=_0x2fe7a4[_0x6ff2('0x3b')][_0x6ff2('0x3d')]?_0x2fe7a4[_0x6ff2('0x3b')]:_0x2d3e19[_0x6ff2('0x3a')];if(!_0x1944cd[_0x6ff2('0x38')][_0x6ff2('0x3e')](_0x6ff2('0x3f'))){_0x2fe7a4[_0x6ff2('0x22')]=qs[_0x6ff2('0x22')](_0x1944cd[_0x6ff2('0x38')][_0x6ff2('0x22')]);_0x2fe7a4[_0x6ff2('0x21')]=qs[_0x6ff2('0x21')](_0x1944cd[_0x6ff2('0x38')][_0x6ff2('0x21')]);}_0x2fe7a4['order']=qs[_0x6ff2('0x40')](_0x1944cd[_0x6ff2('0x38')]['sort']);_0x2fe7a4[_0x6ff2('0x41')]=qs[_0x6ff2('0x42')](_[_0x6ff2('0x43')](_0x1944cd[_0x6ff2('0x38')],_0x2d3e19['filters']));_0x2fe7a4[_0x6ff2('0x41')]['ListId']=_0x5935de['id'];if(_0x1944cd[_0x6ff2('0x38')][_0x6ff2('0x44')]){_0x2fe7a4[_0x6ff2('0x41')]=_[_0x6ff2('0x4a')](_0x2fe7a4[_0x6ff2('0x41')],{'$or':_[_0x6ff2('0x31')](_0x2fe7a4[_0x6ff2('0x3b')],function(_0x2c05ae){var _0x3e3e3c={};_0x3e3e3c[_0x2c05ae]={'$like':'%'+_0x1944cd[_0x6ff2('0x38')][_0x6ff2('0x44')]+'%'};return _0x3e3e3c;})});}_0x2fe7a4=_[_0x6ff2('0x4a')]({},_0x2fe7a4,_0x1944cd[_0x6ff2('0x5b')]);return db['Disposition'][_0x6ff2('0x20')]({'where':_0x2fe7a4[_0x6ff2('0x41')]})[_0x6ff2('0x29')](function(_0x471d0d){_0x492086[_0x6ff2('0x20')]=_0x471d0d;if(_0x1944cd[_0x6ff2('0x38')]['includeAll']){_0x2fe7a4[_0x6ff2('0x46')]=[{'all':!![]}];}return db[_0x6ff2('0x58')][_0x6ff2('0x47')](_0x2fe7a4);})[_0x6ff2('0x29')](function(_0x295b12){_0x492086['rows']=_0x295b12;return _0x492086;});}})[_0x6ff2('0x29')](respondWithFilteredResult(_0x105cfc,_0x2fe7a4))[_0x6ff2('0x52')](handleError(_0x105cfc,null));};exports['removeDispositions']=function(_0x460e4b,_0x34a75f,_0x2ae490){return db['CmList'][_0x6ff2('0x4f')]({'where':{'id':_0x460e4b[_0x6ff2('0x49')]['id']}})[_0x6ff2('0x29')](handleEntityNotFound(_0x34a75f,null))['then'](function(_0x3015ec){if(_0x3015ec){return _0x3015ec['removeDispositions'](_0x460e4b['query'][_0x6ff2('0x5c')]);}})[_0x6ff2('0x29')](respondWithStatusCode(_0x34a75f,null))[_0x6ff2('0x52')](handleError(_0x34a75f,null));};exports['addContacts']=function(_0x28242b,_0xd2f935,_0x2f5894){return db[_0x6ff2('0x32')]['find']({'where':{'id':_0x28242b['params']['id']}})[_0x6ff2('0x29')](handleEntityNotFound(_0xd2f935,null))[_0x6ff2('0x29')](function(_0x3fd259){if(_0x3fd259){var _0x2d300e=[];var _0x3a6c96={'success':[],'errors':[]};return db['CmContact']['describe']()['then'](function(_0xc21fa7){if(_0x28242b['body'][_0x6ff2('0x5d')]&&_['isArray'](_0x28242b[_0x6ff2('0x54')][_0x6ff2('0x5d')])){if(_0x28242b[_0x6ff2('0x54')][_0x6ff2('0x5d')][_0x6ff2('0x3d')]){_0x28242b[_0x6ff2('0x54')][_0x6ff2('0x5d')]=_0x28242b['body'][_0x6ff2('0x5d')][_0x6ff2('0x5e')](';')+';';}else{_0x28242b[_0x6ff2('0x54')][_0x6ff2('0x5d')]=null;}}else{_0x28242b[_0x6ff2('0x54')]['tags']=null;}if(_0x28242b[_0x6ff2('0x54')]&&_['isArray'](_0x28242b['body'])){for(var _0x4eafb2=0x0;_0x4eafb2<_0x28242b['body']['length'];_0x4eafb2+=0x1){_0x28242b[_0x6ff2('0x54')][_0x4eafb2][_0x6ff2('0x57')]=_0x28242b[_0x6ff2('0x49')]['id'];_0x2d300e[_0x6ff2('0x5f')](_0x28242b[_0x6ff2('0x54')][_0x4eafb2]);}return BPromise[_0x6ff2('0x60')](_0x2d300e,function(_0x2f8882){return db[_0x6ff2('0x61')][_0x6ff2('0x4b')](_[_0x6ff2('0x62')](_0x2f8882,[_0x6ff2('0x5c'),'id'])||{},{'fields':_[_0x6ff2('0x37')](_0xc21fa7),'raw':!![]})[_0x6ff2('0x29')](function(_0x1c93e3){_0x3a6c96[_0x6ff2('0x63')]['push'](_0x1c93e3[_0x6ff2('0x64')]);})[_0x6ff2('0x52')](function(_0x4c1a08){_0x3a6c96[_0x6ff2('0x65')][_0x6ff2('0x5f')]({'data':_0x2f8882,'error':_0x4c1a08[_0x6ff2('0x66')]});});})['then'](function(_0x26c5d7){return _0x3a6c96;})['catch'](function(_0x1cb9cd){return _0x1cb9cd;});}else{_0xd2f935[_0x6ff2('0x1e')](0x190)[_0x6ff2('0x1f')]({'message':_0x6ff2('0x67')});}});}})[_0x6ff2('0x29')](respondWithResult(_0xd2f935,null))['catch'](handleError(_0xd2f935,null));};exports[_0x6ff2('0x68')]=function(_0x15a19c,_0x46d83c,_0xaa0822){var _0x407518;return db[_0x6ff2('0x32')][_0x6ff2('0x4f')]({'where':{'id':_0x15a19c[_0x6ff2('0x49')]['id']},'include':[{'model':db[_0x6ff2('0x69')],'as':'CustomFields'}]})[_0x6ff2('0x29')](handleEntityNotFound(_0x46d83c,null))[_0x6ff2('0x29')](function(_0x2d30cd){if(_0x2d30cd){_0x407518=_0x2d30cd;return db[_0x6ff2('0x61')][_0x6ff2('0x33')];}})[_0x6ff2('0x29')](function(_0x24274c){if(_0x24274c){var _0xbec059={};var _0x4a2911={};_0x4a2911[_0x6ff2('0x3a')]=_[_0x6ff2('0x6a')](_[_0x6ff2('0x37')](_0x24274c),_['map'](_0x407518[_0x6ff2('0x6b')],function(_0x4ac468){return util['format'](_0x6ff2('0x6c'),_0x4ac468['id']);}));_0x4a2911[_0x6ff2('0x38')]=_['keys'](_0x15a19c[_0x6ff2('0x38')]);_0x4a2911['filters']=_['intersection'](_0x4a2911[_0x6ff2('0x3a')],_0x4a2911[_0x6ff2('0x38')]);_0xbec059[_0x6ff2('0x3b')]=_['intersection'](_0x4a2911[_0x6ff2('0x3a')],qs[_0x6ff2('0x3c')](_0x15a19c['query'][_0x6ff2('0x3c')]));_0xbec059[_0x6ff2('0x3b')]=_0xbec059[_0x6ff2('0x3b')][_0x6ff2('0x3d')]?_0xbec059[_0x6ff2('0x3b')]:_0x4a2911[_0x6ff2('0x3a')];if(!_0x15a19c[_0x6ff2('0x38')][_0x6ff2('0x3e')]('nolimit')){_0xbec059['limit']=qs['limit'](_0x15a19c['query'][_0x6ff2('0x22')]);_0xbec059['offset']=qs[_0x6ff2('0x21')](_0x15a19c['query'][_0x6ff2('0x21')]);}_0xbec059[_0x6ff2('0x6d')]=qs[_0x6ff2('0x40')](_0x15a19c[_0x6ff2('0x38')]['sort']);_0xbec059[_0x6ff2('0x41')]=qs[_0x6ff2('0x42')](_[_0x6ff2('0x43')](_0x15a19c[_0x6ff2('0x38')],_0x4a2911[_0x6ff2('0x42')]));_0xbec059[_0x6ff2('0x6e')]=!![];if(_0x15a19c[_0x6ff2('0x38')]['filter']){_0xbec059[_0x6ff2('0x41')]=_[_0x6ff2('0x4a')](_0xbec059[_0x6ff2('0x41')],{'$or':_['map'](_0xbec059['attributes'],function(_0x3804b8){var _0x293310={};_0x293310[_0x3804b8]={'$like':'%'+_0x15a19c[_0x6ff2('0x38')][_0x6ff2('0x44')]+'%'};return _0x293310;})});}_0xbec059=_['merge']({},_0xbec059,_0x15a19c[_0x6ff2('0x5b')]);return _0x407518['getContacts'](_0xbec059);}})[_0x6ff2('0x29')](respondWithResult(_0x46d83c,null))['catch'](handleError(_0x46d83c,null));};exports['getContactsCsv']=function(_0x586791,_0x1aac01,_0x3cb449){var _0x18b541;return db[_0x6ff2('0x32')]['find']({'where':{'id':_0x586791[_0x6ff2('0x49')]['id']},'include':[{'model':db[_0x6ff2('0x69')],'as':_0x6ff2('0x6b')}]})['then'](handleEntityNotFound(_0x1aac01,null))['then'](function(_0x419e55){if(_0x419e55){_0x18b541=_0x419e55;return db[_0x6ff2('0x61')]['rawAttributes'];}})['then'](function(_0x7dc66d){if(_0x7dc66d){var _0x175b6f={};var _0x51ab92={};_0x51ab92['model']=_[_0x6ff2('0x6a')](_[_0x6ff2('0x37')](_0x7dc66d),_[_0x6ff2('0x31')](_0x18b541['CustomFields'],function(_0x4008d7){return util[_0x6ff2('0x6f')](_0x6ff2('0x6c'),_0x4008d7['id']);}));_0x51ab92[_0x6ff2('0x38')]=_[_0x6ff2('0x37')](_0x586791[_0x6ff2('0x38')]);_0x51ab92['filters']=_[_0x6ff2('0x39')](_0x51ab92[_0x6ff2('0x3a')],_0x51ab92[_0x6ff2('0x38')]);_0x175b6f[_0x6ff2('0x3b')]=_[_0x6ff2('0x39')](_0x51ab92['model'],qs['fields'](_0x586791[_0x6ff2('0x38')][_0x6ff2('0x3c')]));_0x175b6f[_0x6ff2('0x3b')]=_0x175b6f[_0x6ff2('0x3b')][_0x6ff2('0x3d')]?_0x175b6f[_0x6ff2('0x3b')]:_0x51ab92['model'];if(!_0x586791[_0x6ff2('0x38')]['hasOwnProperty']('nolimit')){_0x175b6f[_0x6ff2('0x22')]=qs[_0x6ff2('0x22')](_0x586791[_0x6ff2('0x38')][_0x6ff2('0x22')]);_0x175b6f[_0x6ff2('0x21')]=qs[_0x6ff2('0x21')](_0x586791[_0x6ff2('0x38')][_0x6ff2('0x21')]);}_0x175b6f[_0x6ff2('0x6d')]=qs[_0x6ff2('0x40')](_0x586791['query'][_0x6ff2('0x40')]);_0x175b6f[_0x6ff2('0x41')]=qs[_0x6ff2('0x42')](_['pick'](_0x586791[_0x6ff2('0x38')],_0x51ab92['filters']));_0x175b6f[_0x6ff2('0x6e')]=!![];if(_0x586791[_0x6ff2('0x38')][_0x6ff2('0x44')]){_0x175b6f[_0x6ff2('0x41')]=_[_0x6ff2('0x4a')](_0x175b6f[_0x6ff2('0x41')],{'$or':_[_0x6ff2('0x31')](_0x175b6f[_0x6ff2('0x3b')],function(_0x1f9fb1){var _0x4bbdbe={};_0x4bbdbe[_0x1f9fb1]={'$like':'%'+_0x586791[_0x6ff2('0x38')][_0x6ff2('0x44')]+'%'};return _0x4bbdbe;})});}_0x175b6f=_[_0x6ff2('0x4a')]({},_0x175b6f,_0x586791[_0x6ff2('0x5b')]);return _0x18b541[_0x6ff2('0x68')](_0x175b6f);}})[_0x6ff2('0x29')](function(_0x46c046){if(!_[_0x6ff2('0x70')](_0x46c046)){var _0x430c9f=toCsv(_0x46c046);var _0x277eb3=Date['now']();fs[_0x6ff2('0x71')](util['format'](_0x6ff2('0x72'),_0x18b541['id'],_0x277eb3),_0x430c9f);_0x1aac01[_0x6ff2('0x73')](_0x6ff2('0x74'),_0x6ff2('0x75')+util[_0x6ff2('0x6f')](_0x6ff2('0x76'),_0x18b541['id'],_0x277eb3));_0x1aac01[_0x6ff2('0x73')](_0x6ff2('0x77'),_0x6ff2('0x78'));return _0x1aac01['download'](util[_0x6ff2('0x6f')](_0x6ff2('0x72'),_0x18b541['id'],_0x277eb3));}else{return _0x1aac01[_0x6ff2('0x1c')](0xcc);}})[_0x6ff2('0x52')](handleError(_0x1aac01,null));};exports[_0x6ff2('0x79')]=function(_0x2e6b55,_0x318e72,_0x1e5589){var _0x140a76;delete _0x2e6b55[_0x6ff2('0x54')]['id'];return db[_0x6ff2('0x32')][_0x6ff2('0x5a')]({'where':{'id':_0x2e6b55[_0x6ff2('0x49')]['id']}})['then'](handleEntityNotFound(_0x318e72,null))[_0x6ff2('0x29')](function(_0x47323f){if(_0x47323f){return db[_0x6ff2('0x7a')][_0x6ff2('0x7b')](function(_0x48db42){return db[_0x6ff2('0x69')]['create'](_0x2e6b55[_0x6ff2('0x54')],{'transaction':_0x48db42})[_0x6ff2('0x29')](function(_0x111c35){_0x140a76=_0x111c35;return _0x47323f[_0x6ff2('0x7c')](_0x111c35,{'transaction':_0x48db42});})['then'](function(){var _0x348b73={'type':db['Sequelize'][_0x6ff2('0x7d')],'transaction':_0x48db42};switch(_0x2e6b55[_0x6ff2('0x54')][_0x6ff2('0x35')]){case _0x6ff2('0x7e'):_0x348b73[_0x6ff2('0x35')]=db[_0x6ff2('0x7f')][_0x6ff2('0x7d')];break;case _0x6ff2('0x80'):_0x348b73['type']=db[_0x6ff2('0x7f')][_0x6ff2('0x81')];break;case _0x6ff2('0x82'):_0x348b73[_0x6ff2('0x35')]=db['Sequelize'][_0x6ff2('0x83')];_0x348b73['defaultValue']=![];break;default:}return db[_0x6ff2('0x7a')][_0x6ff2('0x84')][_0x6ff2('0x85')](_0x6ff2('0x86'),util[_0x6ff2('0x6f')](_0x6ff2('0x87'),_0x140a76['id']),_0x348b73);})[_0x6ff2('0x29')](function(){return _0x140a76;});});}})[_0x6ff2('0x29')](respondWithResult(_0x318e72,null))[_0x6ff2('0x52')](handleError(_0x318e72,null));};exports[_0x6ff2('0x88')]=function(_0x3c6e26,_0x28f710,_0x4cd30a){var _0x2d3502={};var _0x16a6b4={};var _0x46138d;var _0x1105a5;return db['CmList'][_0x6ff2('0x5a')]({'where':{'id':_0x3c6e26[_0x6ff2('0x49')]['id']}})[_0x6ff2('0x29')](handleEntityNotFound(_0x28f710,null))[_0x6ff2('0x29')](function(_0x2c0015){if(_0x2c0015){_0x46138d=_0x2c0015;_0x16a6b4['model']=_[_0x6ff2('0x37')](db[_0x6ff2('0x69')][_0x6ff2('0x33')]);_0x16a6b4[_0x6ff2('0x38')]=_[_0x6ff2('0x37')](_0x3c6e26[_0x6ff2('0x38')]);_0x16a6b4[_0x6ff2('0x42')]=_[_0x6ff2('0x39')](_0x16a6b4[_0x6ff2('0x3a')],_0x16a6b4[_0x6ff2('0x38')]);_0x2d3502[_0x6ff2('0x3b')]=_[_0x6ff2('0x39')](_0x16a6b4['model'],qs['fields'](_0x3c6e26['query']['fields']));_0x2d3502[_0x6ff2('0x3b')]=_0x2d3502[_0x6ff2('0x3b')][_0x6ff2('0x3d')]?_0x2d3502[_0x6ff2('0x3b')]:_0x16a6b4['model'];_0x2d3502[_0x6ff2('0x6d')]=qs[_0x6ff2('0x40')](_0x3c6e26['query'][_0x6ff2('0x40')]);_0x2d3502[_0x6ff2('0x41')]=qs[_0x6ff2('0x42')](_[_0x6ff2('0x43')](_0x3c6e26['query'],_0x16a6b4[_0x6ff2('0x42')]));_0x2d3502['where']=_[_0x6ff2('0x4a')](_0x2d3502['where'],{'$or':[{'ListId':_0x2c0015['id']},{'ListId':null}]});if(_0x3c6e26[_0x6ff2('0x38')][_0x6ff2('0x44')]){_0x2d3502[_0x6ff2('0x41')]=_[_0x6ff2('0x4a')](_0x2d3502[_0x6ff2('0x41')],{'$or':_[_0x6ff2('0x31')](_0x2d3502[_0x6ff2('0x3b')],function(_0x5848b5){var _0x505f21={};_0x505f21[_0x5848b5]={'$like':'%'+_0x3c6e26['query'][_0x6ff2('0x44')]+'%'};return _0x505f21;})});}_0x2d3502=_[_0x6ff2('0x4a')]({},_0x2d3502,_0x3c6e26['options']);return db[_0x6ff2('0x69')][_0x6ff2('0x89')](_0x2d3502);}})['then'](respondWithResult(_0x28f710,null))[_0x6ff2('0x52')](handleError(_0x28f710,null));};exports[_0x6ff2('0x8a')]=function(_0x51c037,_0x4c39f3,_0x1ae6f1){return db['CmList'][_0x6ff2('0x4f')]({'where':{'id':_0x51c037[_0x6ff2('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c39f3,null))[_0x6ff2('0x29')](function(_0x33aa99){if(_0x33aa99){return _0x33aa99[_0x6ff2('0x8a')](_0x51c037[_0x6ff2('0x54')]['ids'],_[_0x6ff2('0x62')](_0x51c037[_0x6ff2('0x54')],[_0x6ff2('0x5c'),'id'])||{})[_0x6ff2('0x8b')](function(_0x2dd9d6){for(var _0x27d9ff=0x0;_0x27d9ff<_0x51c037['body'][_0x6ff2('0x5c')][_0x6ff2('0x3d')];_0x27d9ff+=0x1){socket[_0x6ff2('0x8c')](_0x6ff2('0x8d'),{'UserId':_0x51c037[_0x6ff2('0x54')]['ids'][_0x27d9ff],'CmListId':_0x51c037['params']['id']});}return _0x2dd9d6;});}})[_0x6ff2('0x29')](respondWithResult(_0x4c39f3,null))['catch'](handleError(_0x4c39f3,null));};exports[_0x6ff2('0x8e')]=function(_0x235f61,_0xd78186,_0x4240c6){return db['CmList'][_0x6ff2('0x4f')]({'where':{'id':_0x235f61[_0x6ff2('0x49')]['id']}})[_0x6ff2('0x29')](handleEntityNotFound(_0xd78186,null))[_0x6ff2('0x29')](function(_0x18f002){if(_0x18f002){return _0x18f002[_0x6ff2('0x8e')](_0x235f61[_0x6ff2('0x38')][_0x6ff2('0x5c')])[_0x6ff2('0x29')](function(){if(_[_0x6ff2('0x8f')](_0x235f61[_0x6ff2('0x38')][_0x6ff2('0x5c')])){for(var _0x33ad16=0x0;_0x33ad16<_0x235f61[_0x6ff2('0x38')][_0x6ff2('0x5c')]['length'];_0x33ad16+=0x1){socket[_0x6ff2('0x8c')](_0x6ff2('0x90'),{'UserId':Number(_0x235f61['query'][_0x6ff2('0x5c')][_0x33ad16]),'CmListId':Number(_0x235f61['params']['id'])});}}else{socket[_0x6ff2('0x8c')](_0x6ff2('0x90'),{'UserId':Number(_0x235f61['query'][_0x6ff2('0x5c')]),'CmListId':Number(_0x235f61[_0x6ff2('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0xd78186,null))[_0x6ff2('0x52')](handleError(_0xd78186,null));};exports[_0x6ff2('0x91')]=function(_0x4ffce2,_0x4a59a9,_0x4a24e5){var _0x458237={};var _0x250ab0={};var _0x2dc0e9;var _0x3c5401;return db['CmList'][_0x6ff2('0x5a')]({'where':{'id':_0x4ffce2[_0x6ff2('0x49')]['id']}})[_0x6ff2('0x29')](handleEntityNotFound(_0x4a59a9,null))['then'](function(_0x4a0c34){if(_0x4a0c34){_0x2dc0e9=_0x4a0c34;_0x250ab0[_0x6ff2('0x3a')]=_[_0x6ff2('0x37')](db[_0x6ff2('0x92')][_0x6ff2('0x33')]);_0x250ab0[_0x6ff2('0x38')]=_[_0x6ff2('0x37')](_0x4ffce2[_0x6ff2('0x38')]);_0x250ab0[_0x6ff2('0x42')]=_[_0x6ff2('0x39')](_0x250ab0['model'],_0x250ab0[_0x6ff2('0x38')]);_0x458237[_0x6ff2('0x3b')]=_[_0x6ff2('0x39')](_0x250ab0[_0x6ff2('0x3a')],qs[_0x6ff2('0x3c')](_0x4ffce2[_0x6ff2('0x38')][_0x6ff2('0x3c')]));_0x458237[_0x6ff2('0x3b')]=_0x458237[_0x6ff2('0x3b')][_0x6ff2('0x3d')]?_0x458237[_0x6ff2('0x3b')]:_0x250ab0[_0x6ff2('0x3a')];_0x458237[_0x6ff2('0x6d')]=qs[_0x6ff2('0x40')](_0x4ffce2['query'][_0x6ff2('0x40')]);_0x458237[_0x6ff2('0x41')]=qs['filters'](_[_0x6ff2('0x43')](_0x4ffce2[_0x6ff2('0x38')],_0x250ab0[_0x6ff2('0x42')]));if(_0x4ffce2[_0x6ff2('0x38')][_0x6ff2('0x44')]){_0x458237['where']=_[_0x6ff2('0x4a')](_0x458237[_0x6ff2('0x41')],{'$or':_[_0x6ff2('0x31')](_0x458237[_0x6ff2('0x3b')],function(_0x27b954){var _0x54da87={};_0x54da87[_0x27b954]={'$like':'%'+_0x4ffce2['query'][_0x6ff2('0x44')]+'%'};return _0x54da87;})});}_0x458237=_[_0x6ff2('0x4a')]({},_0x458237,_0x4ffce2[_0x6ff2('0x5b')]);return _0x2dc0e9['getAgents'](_0x458237);}})['then'](function(_0x402caa){if(_0x402caa){_0x3c5401=_0x402caa[_0x6ff2('0x3d')];if(!_0x4ffce2[_0x6ff2('0x38')][_0x6ff2('0x3e')]('nolimit')){_0x458237[_0x6ff2('0x22')]=qs[_0x6ff2('0x22')](_0x4ffce2[_0x6ff2('0x38')]['limit']);_0x458237[_0x6ff2('0x21')]=qs[_0x6ff2('0x21')](_0x4ffce2[_0x6ff2('0x38')]['offset']);}return _0x2dc0e9['getAgents'](_0x458237);}})['then'](function(_0x16172b){if(_0x16172b){return _0x16172b?{'count':_0x3c5401,'rows':_0x16172b}:null;}})[_0x6ff2('0x29')](respondWithResult(_0x4a59a9,null))['catch'](handleError(_0x4a59a9,null));};
\ No newline at end of file