Built motion from commit (unavailable).|2.5.15
[motion2.git] / server / api / chatTransferReport / chatTransferReport.controller.js
index d4d9089..d2caccd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8f99=['bluebird','mustache','path','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','pick','filters','where','merge','filter','options','ChatTransferReport','include','rows','length','includeAll','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x339e1d,_0x4a81cb){var _0x33616a=function(_0x1e98ac){while(--_0x1e98ac){_0x339e1d['push'](_0x339e1d['shift']());}};_0x33616a(++_0x4a81cb);}(_0x8f99,0x7e));var _0x98f9=function(_0x46db09,_0x629145){_0x46db09=_0x46db09-0x0;var _0x2bf57c=_0x8f99[_0x46db09];return _0x2bf57c;};'use strict';var pdf=require(_0x98f9('0x0'));var emlformat=require(_0x98f9('0x1'));var rimraf=require(_0x98f9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x98f9('0x3'));var rp=require(_0x98f9('0x4'));var moment=require(_0x98f9('0x5'));var BPromise=require(_0x98f9('0x6'));var Mustache=require(_0x98f9('0x7'));var util=require('util');var path=require(_0x98f9('0x8'));var sox=require('sox');var csv=require(_0x98f9('0x9'));var ejs=require(_0x98f9('0xa'));var fs=require('fs');var _=require(_0x98f9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98f9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x98f9('0x9'));var querystring=require(_0x98f9('0xd'));var Papa=require(_0x98f9('0xe'));var Redis=require('ioredis');var authService=require(_0x98f9('0xf'));var qs=require(_0x98f9('0x10'));var as=require(_0x98f9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x98f9('0x12'));var utils=require(_0x98f9('0x13'));var config=require('../../config/environment');var db=require(_0x98f9('0x14'))['db'];function respondWithStatusCode(_0x17030b,_0x1f5803){_0x1f5803=_0x1f5803||0xcc;return function(_0x2546f8){if(_0x2546f8){return _0x17030b[_0x98f9('0x15')](_0x1f5803);}return _0x17030b[_0x98f9('0x16')](_0x1f5803)[_0x98f9('0x17')]();};}function respondWithResult(_0x19c470,_0x5d3717){_0x5d3717=_0x5d3717||0xc8;return function(_0x23eeae){if(_0x23eeae){return _0x19c470[_0x98f9('0x16')](_0x5d3717)['json'](_0x23eeae);}};}function respondWithFilteredResult(_0x112717,_0x530373){return function(_0xa8aa68){if(_0xa8aa68){var _0x2f42f3=_0xa8aa68[_0x98f9('0x18')],_0x3ff136=_0x530373[_0x98f9('0x19')],_0x1e8524=_0x530373['offset']+_0x530373[_0x98f9('0x1a')],_0x41d8a9;if(_0x1e8524>=_0x2f42f3){_0x1e8524=_0x2f42f3;_0x41d8a9=0xc8;}else{_0x41d8a9=0xce;}_0x112717[_0x98f9('0x16')](_0x41d8a9);return _0x112717[_0x98f9('0x1b')](_0x98f9('0x1c'),_0x3ff136+'-'+_0x1e8524+'/'+_0x2f42f3)[_0x98f9('0x1d')](_0xa8aa68);}return null;};}function patchUpdates(_0x114dd3){return function(_0x5603d9){try{jsonpatch[_0x98f9('0x1e')](_0x5603d9,_0x114dd3,!![]);}catch(_0x243710){return BPromise['reject'](_0x243710);}return _0x5603d9['save']();};}function saveUpdates(_0x461922,_0x4b6731){return function(_0x2fba1f){if(_0x2fba1f){return _0x2fba1f[_0x98f9('0x1f')](_0x461922)[_0x98f9('0x20')](function(_0x2c89b2){return _0x2c89b2;});}return null;};}function removeEntity(_0x18527e,_0x345fbd){return function(_0x492d04){if(_0x492d04){return _0x492d04['destroy']()[_0x98f9('0x20')](function(){_0x18527e[_0x98f9('0x16')](0xcc)[_0x98f9('0x17')]();});}};}function handleEntityNotFound(_0x3d94e4,_0x5ce932){return function(_0x5bc53b){if(!_0x5bc53b){_0x3d94e4[_0x98f9('0x15')](0x194);}return _0x5bc53b;};}function handleError(_0x47543d,_0x39ae1c){_0x39ae1c=_0x39ae1c||0x1f4;return function(_0x2c0281){logger[_0x98f9('0x21')](_0x2c0281['stack']);if(_0x2c0281[_0x98f9('0x22')]){delete _0x2c0281[_0x98f9('0x22')];}_0x47543d['status'](_0x39ae1c)[_0x98f9('0x23')](_0x2c0281);};}exports['index']=function(_0x139c3c,_0x4979bc){var _0x2d50c9={},_0x1274f5={},_0x6e151b={'count':0x0,'rows':[]};var _0x50e644=_[_0x98f9('0x24')](db['ChatTransferReport'][_0x98f9('0x25')],function(_0x209650){return{'name':_0x209650[_0x98f9('0x26')],'type':_0x209650[_0x98f9('0x27')][_0x98f9('0x28')]};});_0x1274f5[_0x98f9('0x29')]=_['map'](_0x50e644,_0x98f9('0x22'));_0x1274f5[_0x98f9('0x2a')]=_[_0x98f9('0x2b')](_0x139c3c[_0x98f9('0x2a')]);_0x1274f5['filters']=_[_0x98f9('0x2c')](_0x1274f5[_0x98f9('0x29')],_0x1274f5[_0x98f9('0x2a')]);_0x2d50c9[_0x98f9('0x2d')]=_[_0x98f9('0x2c')](_0x1274f5[_0x98f9('0x29')],qs[_0x98f9('0x2e')](_0x139c3c[_0x98f9('0x2a')]['fields']));_0x2d50c9[_0x98f9('0x2d')]=_0x2d50c9[_0x98f9('0x2d')]['length']?_0x2d50c9[_0x98f9('0x2d')]:_0x1274f5[_0x98f9('0x29')];if(!_0x139c3c[_0x98f9('0x2a')][_0x98f9('0x2f')]('nolimit')){_0x2d50c9[_0x98f9('0x1a')]=qs[_0x98f9('0x1a')](_0x139c3c['query'][_0x98f9('0x1a')]);_0x2d50c9[_0x98f9('0x19')]=qs[_0x98f9('0x19')](_0x139c3c[_0x98f9('0x2a')][_0x98f9('0x19')]);}_0x2d50c9['order']=qs[_0x98f9('0x30')](_0x139c3c[_0x98f9('0x2a')][_0x98f9('0x30')]);_0x2d50c9['where']=qs['filters'](_[_0x98f9('0x31')](_0x139c3c['query'],_0x1274f5[_0x98f9('0x32')]));if(_0x139c3c[_0x98f9('0x2a')]['filter']){_0x2d50c9[_0x98f9('0x33')]=_[_0x98f9('0x34')](_0x2d50c9[_0x98f9('0x33')],{'$or':_[_0x98f9('0x24')](_0x50e644,function(_0x69024c){if(_0x69024c[_0x98f9('0x27')]!=='VIRTUAL'){var _0x974ce={};_0x974ce[_0x69024c[_0x98f9('0x22')]]={'$like':'%'+_0x139c3c[_0x98f9('0x2a')][_0x98f9('0x35')]+'%'};return _0x974ce;}})});}_0x2d50c9=_[_0x98f9('0x34')]({},_0x2d50c9,_0x139c3c[_0x98f9('0x36')]);var _0x402528={'where':_0x2d50c9[_0x98f9('0x33')]};return db[_0x98f9('0x37')][_0x98f9('0x18')](_0x402528)[_0x98f9('0x20')](function(_0x2157bd){_0x6e151b['count']=_0x2157bd;if(_0x139c3c[_0x98f9('0x2a')]['includeAll']){_0x2d50c9[_0x98f9('0x38')]=[{'all':!![]}];}return db[_0x98f9('0x37')]['findAll'](_0x2d50c9);})[_0x98f9('0x20')](function(_0x11f2e1){_0x6e151b[_0x98f9('0x39')]=_0x11f2e1;return _0x6e151b;})[_0x98f9('0x20')](respondWithFilteredResult(_0x4979bc,_0x2d50c9))['catch'](handleError(_0x4979bc,null));};exports['show']=function(_0x5683e0,_0x255eb4){var _0x2fc746={'raw':!![],'where':{'id':_0x5683e0['params']['id']}},_0x44585f={};_0x44585f[_0x98f9('0x29')]=_[_0x98f9('0x2b')](db[_0x98f9('0x37')][_0x98f9('0x25')]);_0x44585f['query']=_[_0x98f9('0x2b')](_0x5683e0[_0x98f9('0x2a')]);_0x44585f[_0x98f9('0x32')]=_[_0x98f9('0x2c')](_0x44585f[_0x98f9('0x29')],_0x44585f['query']);_0x2fc746[_0x98f9('0x2d')]=_[_0x98f9('0x2c')](_0x44585f['model'],qs[_0x98f9('0x2e')](_0x5683e0[_0x98f9('0x2a')][_0x98f9('0x2e')]));_0x2fc746[_0x98f9('0x2d')]=_0x2fc746['attributes'][_0x98f9('0x3a')]?_0x2fc746[_0x98f9('0x2d')]:_0x44585f[_0x98f9('0x29')];if(_0x5683e0[_0x98f9('0x2a')][_0x98f9('0x3b')]){_0x2fc746[_0x98f9('0x38')]=[{'all':!![]}];}_0x2fc746=_[_0x98f9('0x34')]({},_0x2fc746,_0x5683e0[_0x98f9('0x36')]);return db[_0x98f9('0x37')][_0x98f9('0x3c')](_0x2fc746)['then'](handleEntityNotFound(_0x255eb4,null))[_0x98f9('0x20')](respondWithResult(_0x255eb4,null))[_0x98f9('0x3d')](handleError(_0x255eb4,null));};exports[_0x98f9('0x3e')]=function(_0x190458,_0x4cda9f){return db[_0x98f9('0x37')][_0x98f9('0x3e')](_0x190458[_0x98f9('0x3f')],{})['then'](respondWithResult(_0x4cda9f,0xc9))[_0x98f9('0x3d')](handleError(_0x4cda9f,null));};exports[_0x98f9('0x1f')]=function(_0x1d6690,_0x20919d){if(_0x1d6690[_0x98f9('0x3f')]['id']){delete _0x1d6690['body']['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x1d6690['params']['id']}})[_0x98f9('0x20')](handleEntityNotFound(_0x20919d,null))[_0x98f9('0x20')](saveUpdates(_0x1d6690[_0x98f9('0x3f')],null))[_0x98f9('0x20')](respondWithResult(_0x20919d,null))['catch'](handleError(_0x20919d,null));};exports['destroy']=function(_0x14ee07,_0x380121){return db[_0x98f9('0x37')][_0x98f9('0x3c')]({'where':{'id':_0x14ee07[_0x98f9('0x40')]['id']}})[_0x98f9('0x20')](handleEntityNotFound(_0x380121,null))[_0x98f9('0x20')](removeEntity(_0x380121,null))[_0x98f9('0x3d')](handleError(_0x380121,null));};exports[_0x98f9('0x41')]=function(_0x3acb66,_0x507703){return db[_0x98f9('0x37')][_0x98f9('0x41')]()[_0x98f9('0x20')](respondWithResult(_0x507703,null))[_0x98f9('0x3d')](handleError(_0x507703,null));};
\ No newline at end of file
+var _0x6118=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','show','params','includeAll','include','options','find','create','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x54e3c3,_0x59bf6e){var _0x411fdd=function(_0x266f42){while(--_0x266f42){_0x54e3c3['push'](_0x54e3c3['shift']());}};_0x411fdd(++_0x59bf6e);}(_0x6118,0x1bf));var _0x8611=function(_0x5a7618,_0x3f44c2){_0x5a7618=_0x5a7618-0x0;var _0x12dc65=_0x6118[_0x5a7618];return _0x12dc65;};'use strict';var pdf=require(_0x8611('0x0'));var emlformat=require(_0x8611('0x1'));var rimraf=require(_0x8611('0x2'));var zipdir=require(_0x8611('0x3'));var jsonpatch=require(_0x8611('0x4'));var rp=require(_0x8611('0x5'));var moment=require(_0x8611('0x6'));var BPromise=require(_0x8611('0x7'));var Mustache=require(_0x8611('0x8'));var util=require(_0x8611('0x9'));var path=require(_0x8611('0xa'));var sox=require('sox');var csv=require(_0x8611('0xb'));var ejs=require(_0x8611('0xc'));var fs=require('fs');var _=require(_0x8611('0xd'));var squel=require(_0x8611('0xe'));var crypto=require(_0x8611('0xf'));var jsforce=require(_0x8611('0x10'));var deskjs=require(_0x8611('0x11'));var toCsv=require(_0x8611('0xb'));var querystring=require(_0x8611('0x12'));var Papa=require(_0x8611('0x13'));var Redis=require(_0x8611('0x14'));var authService=require(_0x8611('0x15'));var qs=require(_0x8611('0x16'));var as=require(_0x8611('0x17'));var hardwareService=require(_0x8611('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0x8611('0x19'));var config=require(_0x8611('0x1a'));var licenseUtil=require(_0x8611('0x1b'));var db=require(_0x8611('0x1c'))['db'];function respondWithStatusCode(_0x160e25,_0x4f229a){_0x4f229a=_0x4f229a||0xcc;return function(_0xf88890){if(_0xf88890){return _0x160e25[_0x8611('0x1d')](_0x4f229a);}return _0x160e25[_0x8611('0x1e')](_0x4f229a)[_0x8611('0x1f')]();};}function respondWithResult(_0x3135de,_0x1d0fee){_0x1d0fee=_0x1d0fee||0xc8;return function(_0x112079){if(_0x112079){return _0x3135de[_0x8611('0x1e')](_0x1d0fee)[_0x8611('0x20')](_0x112079);}};}function respondWithFilteredResult(_0x12c8d2,_0x57bc6f){return function(_0x4eac39){if(_0x4eac39){var _0x4e1ae1=_0x4eac39[_0x8611('0x21')],_0x4b25ee=_0x57bc6f[_0x8611('0x22')],_0x424a32=_0x57bc6f['offset']+_0x57bc6f[_0x8611('0x23')],_0x4e597a;if(_0x424a32>=_0x4e1ae1){_0x424a32=_0x4e1ae1;_0x4e597a=0xc8;}else{_0x4e597a=0xce;}_0x12c8d2[_0x8611('0x1e')](_0x4e597a);return _0x12c8d2[_0x8611('0x24')]('Content-Range',_0x4b25ee+'-'+_0x424a32+'/'+_0x4e1ae1)[_0x8611('0x20')](_0x4eac39);}return null;};}function patchUpdates(_0x589144){return function(_0x495f39){try{jsonpatch[_0x8611('0x25')](_0x495f39,_0x589144,!![]);}catch(_0x2e0ccd){return BPromise[_0x8611('0x26')](_0x2e0ccd);}return _0x495f39[_0x8611('0x27')]();};}function saveUpdates(_0x4cfa71,_0x2c63ca){return function(_0x5c4c71){if(_0x5c4c71){return _0x5c4c71[_0x8611('0x28')](_0x4cfa71)[_0x8611('0x29')](function(_0x5de646){return _0x5de646;});}return null;};}function removeEntity(_0x41ae24,_0x361f8d){return function(_0x56042a){if(_0x56042a){return _0x56042a[_0x8611('0x2a')]()[_0x8611('0x29')](function(){_0x41ae24[_0x8611('0x1e')](0xcc)[_0x8611('0x1f')]();});}};}function handleEntityNotFound(_0x3fa4bb,_0x5904cf){return function(_0x3866ac){if(!_0x3866ac){_0x3fa4bb[_0x8611('0x1d')](0x194);}return _0x3866ac;};}function handleError(_0x343db9,_0x2ce92a){_0x2ce92a=_0x2ce92a||0x1f4;return function(_0x54c489){logger[_0x8611('0x2b')](_0x54c489[_0x8611('0x2c')]);if(_0x54c489[_0x8611('0x2d')]){delete _0x54c489[_0x8611('0x2d')];}_0x343db9['status'](_0x2ce92a)[_0x8611('0x2e')](_0x54c489);};}exports[_0x8611('0x2f')]=function(_0x2807d8,_0x3723f0){var _0x32bb39={},_0x1151b5={},_0x1ff9a3={'count':0x0,'rows':[]};var _0x3c5a1c=_['map'](db[_0x8611('0x30')][_0x8611('0x31')],function(_0x8604a2){return{'name':_0x8604a2[_0x8611('0x32')],'type':_0x8604a2[_0x8611('0x33')][_0x8611('0x34')]};});_0x1151b5['model']=_[_0x8611('0x35')](_0x3c5a1c,_0x8611('0x2d'));_0x1151b5[_0x8611('0x36')]=_[_0x8611('0x37')](_0x2807d8[_0x8611('0x36')]);_0x1151b5[_0x8611('0x38')]=_[_0x8611('0x39')](_0x1151b5[_0x8611('0x3a')],_0x1151b5[_0x8611('0x36')]);_0x32bb39[_0x8611('0x3b')]=_[_0x8611('0x39')](_0x1151b5[_0x8611('0x3a')],qs['fields'](_0x2807d8[_0x8611('0x36')][_0x8611('0x3c')]));_0x32bb39[_0x8611('0x3b')]=_0x32bb39[_0x8611('0x3b')][_0x8611('0x3d')]?_0x32bb39['attributes']:_0x1151b5[_0x8611('0x3a')];if(!_0x2807d8[_0x8611('0x36')]['hasOwnProperty'](_0x8611('0x3e'))){_0x32bb39[_0x8611('0x23')]=qs[_0x8611('0x23')](_0x2807d8[_0x8611('0x36')][_0x8611('0x23')]);_0x32bb39[_0x8611('0x22')]=qs[_0x8611('0x22')](_0x2807d8[_0x8611('0x36')][_0x8611('0x22')]);}_0x32bb39[_0x8611('0x3f')]=qs[_0x8611('0x40')](_0x2807d8[_0x8611('0x36')][_0x8611('0x40')]);_0x32bb39[_0x8611('0x41')]=qs['filters'](_[_0x8611('0x42')](_0x2807d8[_0x8611('0x36')],_0x1151b5[_0x8611('0x38')]),_0x3c5a1c);if(_0x2807d8[_0x8611('0x36')][_0x8611('0x43')]){_0x32bb39[_0x8611('0x41')]=_[_0x8611('0x44')](_0x32bb39[_0x8611('0x41')],{'$or':_[_0x8611('0x35')](_0x3c5a1c,function(_0x298381){if(_0x298381[_0x8611('0x33')]!=='VIRTUAL'){var _0xdb0235={};_0xdb0235[_0x298381['name']]={'$like':'%'+_0x2807d8['query'][_0x8611('0x43')]+'%'};return _0xdb0235;}})});}_0x32bb39=_[_0x8611('0x44')]({},_0x32bb39,_0x2807d8['options']);var _0x155482={'where':_0x32bb39[_0x8611('0x41')]};return db[_0x8611('0x30')]['count'](_0x155482)[_0x8611('0x29')](function(_0x5a5717){_0x1ff9a3[_0x8611('0x21')]=_0x5a5717;if(_0x2807d8[_0x8611('0x36')]['includeAll']){_0x32bb39['include']=[{'all':!![]}];}return db[_0x8611('0x30')]['findAll'](_0x32bb39);})[_0x8611('0x29')](function(_0x268f6c){_0x1ff9a3['rows']=_0x268f6c;return _0x1ff9a3;})[_0x8611('0x29')](respondWithFilteredResult(_0x3723f0,_0x32bb39))['catch'](handleError(_0x3723f0,null));};exports[_0x8611('0x45')]=function(_0x5a9cdb,_0xf3781b){var _0x102b65={'raw':!![],'where':{'id':_0x5a9cdb[_0x8611('0x46')]['id']}},_0x87691b={};_0x87691b[_0x8611('0x3a')]=_[_0x8611('0x37')](db[_0x8611('0x30')]['rawAttributes']);_0x87691b['query']=_[_0x8611('0x37')](_0x5a9cdb[_0x8611('0x36')]);_0x87691b['filters']=_['intersection'](_0x87691b['model'],_0x87691b[_0x8611('0x36')]);_0x102b65['attributes']=_['intersection'](_0x87691b['model'],qs['fields'](_0x5a9cdb[_0x8611('0x36')][_0x8611('0x3c')]));_0x102b65[_0x8611('0x3b')]=_0x102b65[_0x8611('0x3b')][_0x8611('0x3d')]?_0x102b65[_0x8611('0x3b')]:_0x87691b[_0x8611('0x3a')];if(_0x5a9cdb[_0x8611('0x36')][_0x8611('0x47')]){_0x102b65[_0x8611('0x48')]=[{'all':!![]}];}_0x102b65=_[_0x8611('0x44')]({},_0x102b65,_0x5a9cdb[_0x8611('0x49')]);return db['ChatTransferReport'][_0x8611('0x4a')](_0x102b65)['then'](handleEntityNotFound(_0xf3781b,null))[_0x8611('0x29')](respondWithResult(_0xf3781b,null))['catch'](handleError(_0xf3781b,null));};exports[_0x8611('0x4b')]=function(_0x5d054e,_0x4ce06b){return db[_0x8611('0x30')][_0x8611('0x4b')](_0x5d054e[_0x8611('0x4c')],{})['then'](respondWithResult(_0x4ce06b,0xc9))[_0x8611('0x4d')](handleError(_0x4ce06b,null));};exports[_0x8611('0x28')]=function(_0x2a7925,_0x5b4a51){if(_0x2a7925[_0x8611('0x4c')]['id']){delete _0x2a7925['body']['id'];}return db[_0x8611('0x30')][_0x8611('0x4a')]({'where':{'id':_0x2a7925['params']['id']}})['then'](handleEntityNotFound(_0x5b4a51,null))['then'](saveUpdates(_0x2a7925[_0x8611('0x4c')],null))[_0x8611('0x29')](respondWithResult(_0x5b4a51,null))['catch'](handleError(_0x5b4a51,null));};exports[_0x8611('0x2a')]=function(_0x1fd12f,_0x6cf5f4){return db[_0x8611('0x30')]['find']({'where':{'id':_0x1fd12f[_0x8611('0x46')]['id']}})[_0x8611('0x29')](handleEntityNotFound(_0x6cf5f4,null))[_0x8611('0x29')](removeEntity(_0x6cf5f4,null))[_0x8611('0x4d')](handleError(_0x6cf5f4,null));};exports[_0x8611('0x4e')]=function(_0x7d1c61,_0x37c100){return db[_0x8611('0x30')]['describe']()['then'](respondWithResult(_0x37c100,null))['catch'](handleError(_0x37c100,null));};
\ No newline at end of file