Built motion from commit (unavailable).|2.5.1
[motion2.git] / server / api / chatTransferReport / chatTransferReport.controller.js
index d4d9089..7b107b9 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 _0x5591=['findAll','rows','includeAll','include','find','create','body','catch','describe','eml-format','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','set','apply','reject','update','destroy','error','stack','name','send','ChatTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','count','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5591,0x158));var _0x1559=function(_0x52b746,_0x43d29a){_0x52b746=_0x52b746-0x0;var _0x56a505=_0x5591[_0x52b746];return _0x56a505;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1559('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1559('0x1'));var moment=require(_0x1559('0x2'));var BPromise=require(_0x1559('0x3'));var Mustache=require(_0x1559('0x4'));var util=require('util');var path=require('path');var sox=require(_0x1559('0x5'));var csv=require(_0x1559('0x6'));var ejs=require(_0x1559('0x7'));var fs=require('fs');var _=require(_0x1559('0x8'));var squel=require(_0x1559('0x9'));var crypto=require('crypto');var jsforce=require(_0x1559('0xa'));var deskjs=require(_0x1559('0xb'));var toCsv=require(_0x1559('0x6'));var querystring=require(_0x1559('0xc'));var Papa=require(_0x1559('0xd'));var Redis=require(_0x1559('0xe'));var authService=require(_0x1559('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1559('0x10'));var hardwareService=require(_0x1559('0x11'));var logger=require(_0x1559('0x12'))(_0x1559('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1559('0x14'))['db'];function respondWithStatusCode(_0x418b5c,_0x1c6745){_0x1c6745=_0x1c6745||0xcc;return function(_0x34a70a){if(_0x34a70a){return _0x418b5c[_0x1559('0x15')](_0x1c6745);}return _0x418b5c[_0x1559('0x16')](_0x1c6745)[_0x1559('0x17')]();};}function respondWithResult(_0x19657c,_0x11021a){_0x11021a=_0x11021a||0xc8;return function(_0x15099c){if(_0x15099c){return _0x19657c[_0x1559('0x16')](_0x11021a)[_0x1559('0x18')](_0x15099c);}};}function respondWithFilteredResult(_0x392ace,_0x584211){return function(_0x28a79a){if(_0x28a79a){var _0x217e5a=_0x28a79a['count'],_0x48515f=_0x584211[_0x1559('0x19')],_0x55077d=_0x584211[_0x1559('0x19')]+_0x584211['limit'],_0x6534cd;if(_0x55077d>=_0x217e5a){_0x55077d=_0x217e5a;_0x6534cd=0xc8;}else{_0x6534cd=0xce;}_0x392ace[_0x1559('0x16')](_0x6534cd);return _0x392ace[_0x1559('0x1a')]('Content-Range',_0x48515f+'-'+_0x55077d+'/'+_0x217e5a)[_0x1559('0x18')](_0x28a79a);}return null;};}function patchUpdates(_0x5b3089){return function(_0x3a0067){try{jsonpatch[_0x1559('0x1b')](_0x3a0067,_0x5b3089,!![]);}catch(_0x329abf){return BPromise[_0x1559('0x1c')](_0x329abf);}return _0x3a0067['save']();};}function saveUpdates(_0x256740,_0x3cc528){return function(_0x446118){if(_0x446118){return _0x446118[_0x1559('0x1d')](_0x256740)['then'](function(_0x2487ae){return _0x2487ae;});}return null;};}function removeEntity(_0x2d364d,_0x826e3b){return function(_0x3f6902){if(_0x3f6902){return _0x3f6902[_0x1559('0x1e')]()['then'](function(){_0x2d364d['status'](0xcc)[_0x1559('0x17')]();});}};}function handleEntityNotFound(_0x5edcf3,_0x46fbdc){return function(_0x296ea8){if(!_0x296ea8){_0x5edcf3[_0x1559('0x15')](0x194);}return _0x296ea8;};}function handleError(_0xaf36cf,_0x36913e){_0x36913e=_0x36913e||0x1f4;return function(_0x389f88){logger[_0x1559('0x1f')](_0x389f88[_0x1559('0x20')]);if(_0x389f88[_0x1559('0x21')]){delete _0x389f88[_0x1559('0x21')];}_0xaf36cf[_0x1559('0x16')](_0x36913e)[_0x1559('0x22')](_0x389f88);};}exports['index']=function(_0x3ed5c5,_0xdd8f52){var _0x51eb8a={},_0x1ee96d={},_0x4a47d5={'count':0x0,'rows':[]};var _0x27bb01=_['map'](db[_0x1559('0x23')][_0x1559('0x24')],function(_0x70a871){return{'name':_0x70a871[_0x1559('0x25')],'type':_0x70a871[_0x1559('0x26')]['key']};});_0x1ee96d[_0x1559('0x27')]=_['map'](_0x27bb01,_0x1559('0x21'));_0x1ee96d['query']=_[_0x1559('0x28')](_0x3ed5c5[_0x1559('0x29')]);_0x1ee96d[_0x1559('0x2a')]=_[_0x1559('0x2b')](_0x1ee96d[_0x1559('0x27')],_0x1ee96d['query']);_0x51eb8a[_0x1559('0x2c')]=_[_0x1559('0x2b')](_0x1ee96d[_0x1559('0x27')],qs[_0x1559('0x2d')](_0x3ed5c5[_0x1559('0x29')][_0x1559('0x2d')]));_0x51eb8a[_0x1559('0x2c')]=_0x51eb8a[_0x1559('0x2c')][_0x1559('0x2e')]?_0x51eb8a[_0x1559('0x2c')]:_0x1ee96d[_0x1559('0x27')];if(!_0x3ed5c5[_0x1559('0x29')][_0x1559('0x2f')](_0x1559('0x30'))){_0x51eb8a[_0x1559('0x31')]=qs[_0x1559('0x31')](_0x3ed5c5['query'][_0x1559('0x31')]);_0x51eb8a['offset']=qs[_0x1559('0x19')](_0x3ed5c5[_0x1559('0x29')][_0x1559('0x19')]);}_0x51eb8a[_0x1559('0x32')]=qs[_0x1559('0x33')](_0x3ed5c5[_0x1559('0x29')][_0x1559('0x33')]);_0x51eb8a[_0x1559('0x34')]=qs[_0x1559('0x2a')](_['pick'](_0x3ed5c5['query'],_0x1ee96d[_0x1559('0x2a')]),_0x27bb01);if(_0x3ed5c5[_0x1559('0x29')][_0x1559('0x35')]){_0x51eb8a[_0x1559('0x34')]=_['merge'](_0x51eb8a[_0x1559('0x34')],{'$or':_['map'](_0x27bb01,function(_0x44568f){if(_0x44568f[_0x1559('0x26')]!=='VIRTUAL'){var _0x51bdec={};_0x51bdec[_0x44568f[_0x1559('0x21')]]={'$like':'%'+_0x3ed5c5[_0x1559('0x29')][_0x1559('0x35')]+'%'};return _0x51bdec;}})});}_0x51eb8a=_[_0x1559('0x36')]({},_0x51eb8a,_0x3ed5c5[_0x1559('0x37')]);var _0x283b40={'where':_0x51eb8a[_0x1559('0x34')]};return db['ChatTransferReport'][_0x1559('0x38')](_0x283b40)[_0x1559('0x39')](function(_0x2b2af5){_0x4a47d5[_0x1559('0x38')]=_0x2b2af5;if(_0x3ed5c5['query']['includeAll']){_0x51eb8a['include']=[{'all':!![]}];}return db[_0x1559('0x23')][_0x1559('0x3a')](_0x51eb8a);})['then'](function(_0xc303dc){_0x4a47d5[_0x1559('0x3b')]=_0xc303dc;return _0x4a47d5;})[_0x1559('0x39')](respondWithFilteredResult(_0xdd8f52,_0x51eb8a))['catch'](handleError(_0xdd8f52,null));};exports['show']=function(_0x9e47e0,_0x51bc19){var _0x45885c={'raw':!![],'where':{'id':_0x9e47e0['params']['id']}},_0x58d876={};_0x58d876[_0x1559('0x27')]=_[_0x1559('0x28')](db['ChatTransferReport'][_0x1559('0x24')]);_0x58d876[_0x1559('0x29')]=_[_0x1559('0x28')](_0x9e47e0[_0x1559('0x29')]);_0x58d876[_0x1559('0x2a')]=_['intersection'](_0x58d876[_0x1559('0x27')],_0x58d876['query']);_0x45885c[_0x1559('0x2c')]=_[_0x1559('0x2b')](_0x58d876[_0x1559('0x27')],qs[_0x1559('0x2d')](_0x9e47e0[_0x1559('0x29')]['fields']));_0x45885c[_0x1559('0x2c')]=_0x45885c[_0x1559('0x2c')][_0x1559('0x2e')]?_0x45885c[_0x1559('0x2c')]:_0x58d876[_0x1559('0x27')];if(_0x9e47e0[_0x1559('0x29')][_0x1559('0x3c')]){_0x45885c[_0x1559('0x3d')]=[{'all':!![]}];}_0x45885c=_[_0x1559('0x36')]({},_0x45885c,_0x9e47e0['options']);return db['ChatTransferReport'][_0x1559('0x3e')](_0x45885c)[_0x1559('0x39')](handleEntityNotFound(_0x51bc19,null))['then'](respondWithResult(_0x51bc19,null))['catch'](handleError(_0x51bc19,null));};exports['create']=function(_0xbd98da,_0x2a7b08){return db[_0x1559('0x23')][_0x1559('0x3f')](_0xbd98da[_0x1559('0x40')],{})[_0x1559('0x39')](respondWithResult(_0x2a7b08,0xc9))[_0x1559('0x41')](handleError(_0x2a7b08,null));};exports[_0x1559('0x1d')]=function(_0x5626bf,_0x269ffe){if(_0x5626bf[_0x1559('0x40')]['id']){delete _0x5626bf['body']['id'];}return db[_0x1559('0x23')][_0x1559('0x3e')]({'where':{'id':_0x5626bf['params']['id']}})['then'](handleEntityNotFound(_0x269ffe,null))[_0x1559('0x39')](saveUpdates(_0x5626bf[_0x1559('0x40')],null))['then'](respondWithResult(_0x269ffe,null))[_0x1559('0x41')](handleError(_0x269ffe,null));};exports[_0x1559('0x1e')]=function(_0x12f118,_0x36a281){return db[_0x1559('0x23')]['find']({'where':{'id':_0x12f118['params']['id']}})[_0x1559('0x39')](handleEntityNotFound(_0x36a281,null))[_0x1559('0x39')](removeEntity(_0x36a281,null))[_0x1559('0x41')](handleError(_0x36a281,null));};exports[_0x1559('0x42')]=function(_0x535fbc,_0x4f39a9){return db[_0x1559('0x23')][_0x1559('0x42')]()[_0x1559('0x39')](respondWithResult(_0x4f39a9,null))[_0x1559('0x41')](handleError(_0x4f39a9,null));};
\ No newline at end of file