Built motion from commit f7863d46.|2.5.41
[motion2.git] / server / api / chatTransferReport / chatTransferReport.controller.js
index 0847749..b8e8db2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x29a0=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4c332b,_0x442b6c){var _0x251662=function(_0x1ef041){while(--_0x1ef041){_0x4c332b['push'](_0x4c332b['shift']());}};_0x251662(++_0x442b6c);}(_0x29a0,0xd1));var _0x029a=function(_0x31c930,_0x5cb0d7){_0x31c930=_0x31c930-0x0;var _0x5760b4=_0x29a0[_0x31c930];return _0x5760b4;};'use strict';var pdf=require(_0x029a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x029a('0x1'));var zipdir=require(_0x029a('0x2'));var jsonpatch=require(_0x029a('0x3'));var rp=require(_0x029a('0x4'));var moment=require('moment');var BPromise=require(_0x029a('0x5'));var Mustache=require(_0x029a('0x6'));var util=require(_0x029a('0x7'));var path=require(_0x029a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x029a('0x9'));var fs=require('fs');var _=require(_0x029a('0xa'));var squel=require(_0x029a('0xb'));var crypto=require('crypto');var jsforce=require(_0x029a('0xc'));var deskjs=require(_0x029a('0xd'));var toCsv=require(_0x029a('0xe'));var querystring=require(_0x029a('0xf'));var Papa=require(_0x029a('0x10'));var Redis=require(_0x029a('0x11'));var authService=require(_0x029a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x029a('0x13'));var hardwareService=require(_0x029a('0x14'));var logger=require(_0x029a('0x15'))(_0x029a('0x16'));var utils=require(_0x029a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x029a('0x18'));var db=require(_0x029a('0x19'))['db'];function respondWithStatusCode(_0x1ce58c,_0x4d7e3c){_0x4d7e3c=_0x4d7e3c||0xcc;return function(_0x13a4ce){if(_0x13a4ce){return _0x1ce58c[_0x029a('0x1a')](_0x4d7e3c);}return _0x1ce58c[_0x029a('0x1b')](_0x4d7e3c)[_0x029a('0x1c')]();};}function respondWithResult(_0x2f36ba,_0x1dfb68){_0x1dfb68=_0x1dfb68||0xc8;return function(_0xa88685){if(_0xa88685){return _0x2f36ba[_0x029a('0x1b')](_0x1dfb68)[_0x029a('0x1d')](_0xa88685);}};}function respondWithFilteredResult(_0x50cf4c,_0x268d86){return function(_0x1315e9){if(_0x1315e9){var _0x2ec1a8=_0x1315e9[_0x029a('0x1e')],_0xd8d04c=_0x268d86[_0x029a('0x1f')],_0xbfb0d7=_0x268d86[_0x029a('0x1f')]+_0x268d86[_0x029a('0x20')],_0x43833b;if(_0xbfb0d7>=_0x2ec1a8){_0xbfb0d7=_0x2ec1a8;_0x43833b=0xc8;}else{_0x43833b=0xce;}_0x50cf4c['status'](_0x43833b);return _0x50cf4c['set'](_0x029a('0x21'),_0xd8d04c+'-'+_0xbfb0d7+'/'+_0x2ec1a8)[_0x029a('0x1d')](_0x1315e9);}return null;};}function patchUpdates(_0x1e87ec){return function(_0x42341d){try{jsonpatch[_0x029a('0x22')](_0x42341d,_0x1e87ec,!![]);}catch(_0x504223){return BPromise[_0x029a('0x23')](_0x504223);}return _0x42341d[_0x029a('0x24')]();};}function saveUpdates(_0x182ce8,_0x3242df){return function(_0x1f6b7a){if(_0x1f6b7a){return _0x1f6b7a['update'](_0x182ce8)[_0x029a('0x25')](function(_0x454a63){return _0x454a63;});}return null;};}function removeEntity(_0x377b7f,_0x3dae0b){return function(_0x100cee){if(_0x100cee){return _0x100cee[_0x029a('0x26')]()[_0x029a('0x25')](function(){_0x377b7f['status'](0xcc)[_0x029a('0x1c')]();});}};}function handleEntityNotFound(_0x43bbd3,_0x25dc6a){return function(_0x2eeaf1){if(!_0x2eeaf1){_0x43bbd3['sendStatus'](0x194);}return _0x2eeaf1;};}function handleError(_0x57f583,_0x5b7a82){_0x5b7a82=_0x5b7a82||0x1f4;return function(_0x2d269){logger[_0x029a('0x27')](_0x2d269[_0x029a('0x28')]);if(_0x2d269[_0x029a('0x29')]){delete _0x2d269[_0x029a('0x29')];}_0x57f583[_0x029a('0x1b')](_0x5b7a82)['send'](_0x2d269);};}exports[_0x029a('0x2a')]=function(_0x5ba1f4,_0x495863){var _0xd33da2={},_0x1ed3a5={},_0x2af8fb={'count':0x0,'rows':[]};var _0x7a77d7=_[_0x029a('0x2b')](db[_0x029a('0x2c')][_0x029a('0x2d')],function(_0x523d75){return{'name':_0x523d75[_0x029a('0x2e')],'type':_0x523d75['type']['key']};});_0x1ed3a5[_0x029a('0x2f')]=_[_0x029a('0x2b')](_0x7a77d7,_0x029a('0x29'));_0x1ed3a5[_0x029a('0x30')]=_[_0x029a('0x31')](_0x5ba1f4[_0x029a('0x30')]);_0x1ed3a5[_0x029a('0x32')]=_[_0x029a('0x33')](_0x1ed3a5['model'],_0x1ed3a5[_0x029a('0x30')]);_0xd33da2[_0x029a('0x34')]=_['intersection'](_0x1ed3a5[_0x029a('0x2f')],qs[_0x029a('0x35')](_0x5ba1f4[_0x029a('0x30')]['fields']));_0xd33da2['attributes']=_0xd33da2[_0x029a('0x34')][_0x029a('0x36')]?_0xd33da2['attributes']:_0x1ed3a5[_0x029a('0x2f')];if(!_0x5ba1f4[_0x029a('0x30')][_0x029a('0x37')](_0x029a('0x38'))){_0xd33da2[_0x029a('0x20')]=qs['limit'](_0x5ba1f4[_0x029a('0x30')]['limit']);_0xd33da2[_0x029a('0x1f')]=qs[_0x029a('0x1f')](_0x5ba1f4['query'][_0x029a('0x1f')]);}_0xd33da2[_0x029a('0x39')]=qs[_0x029a('0x3a')](_0x5ba1f4[_0x029a('0x30')][_0x029a('0x3a')]);_0xd33da2[_0x029a('0x3b')]=qs['filters'](_[_0x029a('0x3c')](_0x5ba1f4[_0x029a('0x30')],_0x1ed3a5['filters']),_0x7a77d7);if(_0x5ba1f4[_0x029a('0x30')]['filter']){_0xd33da2[_0x029a('0x3b')]=_['merge'](_0xd33da2[_0x029a('0x3b')],{'$or':_[_0x029a('0x2b')](_0x7a77d7,function(_0xda4299){if(_0xda4299[_0x029a('0x3d')]!==_0x029a('0x3e')){var _0x902d3c={};_0x902d3c[_0xda4299[_0x029a('0x29')]]={'$like':'%'+_0x5ba1f4[_0x029a('0x30')][_0x029a('0x3f')]+'%'};return _0x902d3c;}})});}_0xd33da2=_[_0x029a('0x40')]({},_0xd33da2,_0x5ba1f4[_0x029a('0x41')]);var _0x2575a2={'where':_0xd33da2['where']};return db[_0x029a('0x2c')][_0x029a('0x1e')](_0x2575a2)['then'](function(_0x5ed038){_0x2af8fb[_0x029a('0x1e')]=_0x5ed038;if(_0x5ba1f4[_0x029a('0x30')][_0x029a('0x42')]){_0xd33da2[_0x029a('0x43')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x029a('0x44')](_0xd33da2);})['then'](function(_0xfed6c0){_0x2af8fb['rows']=_0xfed6c0;return _0x2af8fb;})[_0x029a('0x25')](respondWithFilteredResult(_0x495863,_0xd33da2))[_0x029a('0x45')](handleError(_0x495863,null));};exports[_0x029a('0x46')]=function(_0x503fc0,_0x392410){var _0x1bf723={'raw':!![],'where':{'id':_0x503fc0[_0x029a('0x47')]['id']}},_0x561a51={};_0x561a51[_0x029a('0x2f')]=_[_0x029a('0x31')](db[_0x029a('0x2c')][_0x029a('0x2d')]);_0x561a51['query']=_[_0x029a('0x31')](_0x503fc0[_0x029a('0x30')]);_0x561a51['filters']=_[_0x029a('0x33')](_0x561a51[_0x029a('0x2f')],_0x561a51[_0x029a('0x30')]);_0x1bf723[_0x029a('0x34')]=_[_0x029a('0x33')](_0x561a51[_0x029a('0x2f')],qs[_0x029a('0x35')](_0x503fc0[_0x029a('0x30')]['fields']));_0x1bf723[_0x029a('0x34')]=_0x1bf723[_0x029a('0x34')][_0x029a('0x36')]?_0x1bf723[_0x029a('0x34')]:_0x561a51['model'];if(_0x503fc0[_0x029a('0x30')][_0x029a('0x42')]){_0x1bf723['include']=[{'all':!![]}];}_0x1bf723=_['merge']({},_0x1bf723,_0x503fc0['options']);return db[_0x029a('0x2c')][_0x029a('0x48')](_0x1bf723)['then'](handleEntityNotFound(_0x392410,null))[_0x029a('0x25')](respondWithResult(_0x392410,null))[_0x029a('0x45')](handleError(_0x392410,null));};exports[_0x029a('0x49')]=function(_0x2b0187,_0x548017){return db['ChatTransferReport'][_0x029a('0x49')](_0x2b0187[_0x029a('0x4a')],{})[_0x029a('0x25')](respondWithResult(_0x548017,0xc9))[_0x029a('0x45')](handleError(_0x548017,null));};exports[_0x029a('0x4b')]=function(_0x1684b2,_0x3b92a0){if(_0x1684b2[_0x029a('0x4a')]['id']){delete _0x1684b2[_0x029a('0x4a')]['id'];}return db[_0x029a('0x2c')][_0x029a('0x48')]({'where':{'id':_0x1684b2['params']['id']}})[_0x029a('0x25')](handleEntityNotFound(_0x3b92a0,null))[_0x029a('0x25')](saveUpdates(_0x1684b2[_0x029a('0x4a')],null))[_0x029a('0x25')](respondWithResult(_0x3b92a0,null))[_0x029a('0x45')](handleError(_0x3b92a0,null));};exports[_0x029a('0x26')]=function(_0x217076,_0xf9c2ce){return db['ChatTransferReport'][_0x029a('0x48')]({'where':{'id':_0x217076[_0x029a('0x47')]['id']}})['then'](handleEntityNotFound(_0xf9c2ce,null))[_0x029a('0x25')](removeEntity(_0xf9c2ce,null))['catch'](handleError(_0xf9c2ce,null));};exports[_0x029a('0x4c')]=function(_0x5f2159,_0x4be83a){return db['ChatTransferReport']['describe']()[_0x029a('0x25')](respondWithResult(_0x4be83a,null))[_0x029a('0x45')](handleError(_0x4be83a,null));};
\ No newline at end of file
+var _0x756f=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','apply','save','update','then','destroy','end','stack','name','send','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x756f,0x137));var _0xf756=function(_0x778a18,_0x26f54d){_0x778a18=_0x778a18-0x0;var _0x354822=_0x756f[_0x778a18];return _0x354822;};'use strict';var emlformat=require(_0xf756('0x0'));var rimraf=require(_0xf756('0x1'));var zipdir=require(_0xf756('0x2'));var jsonpatch=require(_0xf756('0x3'));var rp=require('request-promise');var moment=require(_0xf756('0x4'));var BPromise=require(_0xf756('0x5'));var Mustache=require(_0xf756('0x6'));var util=require(_0xf756('0x7'));var path=require(_0xf756('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf756('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf756('0xa'));var squel=require(_0xf756('0xb'));var crypto=require(_0xf756('0xc'));var jsforce=require(_0xf756('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf756('0xe'));var Papa=require(_0xf756('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf756('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf756('0x11'));var logger=require(_0xf756('0x12'))(_0xf756('0x13'));var utils=require(_0xf756('0x14'));var config=require(_0xf756('0x15'));var licenseUtil=require(_0xf756('0x16'));var db=require(_0xf756('0x17'))['db'];function respondWithStatusCode(_0x24e0b9,_0x43d40c){_0x43d40c=_0x43d40c||0xcc;return function(_0x3e2ce7){if(_0x3e2ce7){return _0x24e0b9[_0xf756('0x18')](_0x43d40c);}return _0x24e0b9[_0xf756('0x19')](_0x43d40c)['end']();};}function respondWithResult(_0x159436,_0x35f91d){_0x35f91d=_0x35f91d||0xc8;return function(_0x31e27e){if(_0x31e27e){return _0x159436['status'](_0x35f91d)['json'](_0x31e27e);}};}function respondWithFilteredResult(_0x560976,_0x532520){return function(_0x479e90){if(_0x479e90){var _0x4a340f=typeof _0x532520[_0xf756('0x1a')]==='undefined'&&typeof _0x532520['limit']===_0xf756('0x1b');var _0x2bcea4=_0x479e90[_0xf756('0x1c')];var _0x2b6430=_0x4a340f?0x0:_0x532520[_0xf756('0x1a')];var _0x348fdc=_0x4a340f?_0x479e90['count']:_0x532520[_0xf756('0x1a')]+_0x532520[_0xf756('0x1d')];var _0x3b32f8;if(_0x348fdc>=_0x2bcea4){_0x348fdc=_0x2bcea4;_0x3b32f8=0xc8;}else{_0x3b32f8=0xce;}_0x560976[_0xf756('0x19')](_0x3b32f8);return _0x560976[_0xf756('0x1e')]('Content-Range',_0x2b6430+'-'+_0x348fdc+'/'+_0x2bcea4)[_0xf756('0x1f')](_0x479e90);}return null;};}function patchUpdates(_0x1f481a){return function(_0x210f2e){try{jsonpatch[_0xf756('0x20')](_0x210f2e,_0x1f481a,!![]);}catch(_0x56c9d4){return BPromise['reject'](_0x56c9d4);}return _0x210f2e[_0xf756('0x21')]();};}function saveUpdates(_0x4399c7,_0x198613){return function(_0x1af286){if(_0x1af286){return _0x1af286[_0xf756('0x22')](_0x4399c7)[_0xf756('0x23')](function(_0x252112){return _0x252112;});}return null;};}function removeEntity(_0x36d62c,_0x4075b5){return function(_0x58117d){if(_0x58117d){return _0x58117d[_0xf756('0x24')]()[_0xf756('0x23')](function(){_0x36d62c[_0xf756('0x19')](0xcc)[_0xf756('0x25')]();});}};}function handleEntityNotFound(_0x22eb27,_0x126dc1){return function(_0x53cdcb){if(!_0x53cdcb){_0x22eb27[_0xf756('0x18')](0x194);}return _0x53cdcb;};}function handleError(_0x1df3ef,_0xb40b97){_0xb40b97=_0xb40b97||0x1f4;return function(_0x2fb858){logger['error'](_0x2fb858[_0xf756('0x26')]);if(_0x2fb858[_0xf756('0x27')]){delete _0x2fb858[_0xf756('0x27')];}_0x1df3ef[_0xf756('0x19')](_0xb40b97)[_0xf756('0x28')](_0x2fb858);};}exports['index']=function(_0x186a10,_0x2ad930){var _0x2da963={},_0x2d84f4={},_0x100e92={'count':0x0,'rows':[]};var _0x4fb308=_['map'](db[_0xf756('0x29')][_0xf756('0x2a')],function(_0x59266e){return{'name':_0x59266e[_0xf756('0x2b')],'type':_0x59266e[_0xf756('0x2c')][_0xf756('0x2d')]};});_0x2d84f4[_0xf756('0x2e')]=_[_0xf756('0x2f')](_0x4fb308,_0xf756('0x27'));_0x2d84f4[_0xf756('0x30')]=_[_0xf756('0x31')](_0x186a10[_0xf756('0x30')]);_0x2d84f4[_0xf756('0x32')]=_[_0xf756('0x33')](_0x2d84f4['model'],_0x2d84f4[_0xf756('0x30')]);_0x2da963['attributes']=_[_0xf756('0x33')](_0x2d84f4['model'],qs[_0xf756('0x34')](_0x186a10[_0xf756('0x30')]['fields']));_0x2da963[_0xf756('0x35')]=_0x2da963[_0xf756('0x35')][_0xf756('0x36')]?_0x2da963[_0xf756('0x35')]:_0x2d84f4[_0xf756('0x2e')];if(!_0x186a10[_0xf756('0x30')][_0xf756('0x37')](_0xf756('0x38'))){_0x2da963[_0xf756('0x1d')]=qs[_0xf756('0x1d')](_0x186a10[_0xf756('0x30')]['limit']);_0x2da963[_0xf756('0x1a')]=qs[_0xf756('0x1a')](_0x186a10[_0xf756('0x30')][_0xf756('0x1a')]);}_0x2da963['order']=qs[_0xf756('0x39')](_0x186a10[_0xf756('0x30')][_0xf756('0x39')]);_0x2da963[_0xf756('0x3a')]=qs[_0xf756('0x32')](_['pick'](_0x186a10[_0xf756('0x30')],_0x2d84f4[_0xf756('0x32')]),_0x4fb308);if(_0x186a10[_0xf756('0x30')][_0xf756('0x3b')]){_0x2da963[_0xf756('0x3a')]=_[_0xf756('0x3c')](_0x2da963[_0xf756('0x3a')],{'$or':_[_0xf756('0x2f')](_0x4fb308,function(_0x119178){if(_0x119178[_0xf756('0x2c')]!==_0xf756('0x3d')){var _0x2cf443={};_0x2cf443[_0x119178[_0xf756('0x27')]]={'$like':'%'+_0x186a10[_0xf756('0x30')][_0xf756('0x3b')]+'%'};return _0x2cf443;}})});}_0x2da963=_['merge']({},_0x2da963,_0x186a10[_0xf756('0x3e')]);var _0x35576c={'where':_0x2da963['where']};return db['ChatTransferReport'][_0xf756('0x1c')](_0x35576c)[_0xf756('0x23')](function(_0x39f2db){_0x100e92[_0xf756('0x1c')]=_0x39f2db;if(_0x186a10[_0xf756('0x30')]['includeAll']){_0x2da963[_0xf756('0x3f')]=[{'all':!![]}];}return db[_0xf756('0x29')][_0xf756('0x40')](_0x2da963);})[_0xf756('0x23')](function(_0x2e3754){_0x100e92['rows']=_0x2e3754;return _0x100e92;})['then'](respondWithFilteredResult(_0x2ad930,_0x2da963))[_0xf756('0x41')](handleError(_0x2ad930,null));};exports['show']=function(_0x1b1a93,_0x1e1efa){var _0x4f0d8a={'raw':!![],'where':{'id':_0x1b1a93[_0xf756('0x42')]['id']}},_0xa3804d={};_0xa3804d[_0xf756('0x2e')]=_[_0xf756('0x31')](db['ChatTransferReport'][_0xf756('0x2a')]);_0xa3804d[_0xf756('0x30')]=_[_0xf756('0x31')](_0x1b1a93['query']);_0xa3804d[_0xf756('0x32')]=_[_0xf756('0x33')](_0xa3804d['model'],_0xa3804d[_0xf756('0x30')]);_0x4f0d8a[_0xf756('0x35')]=_['intersection'](_0xa3804d[_0xf756('0x2e')],qs['fields'](_0x1b1a93['query'][_0xf756('0x34')]));_0x4f0d8a[_0xf756('0x35')]=_0x4f0d8a['attributes'][_0xf756('0x36')]?_0x4f0d8a[_0xf756('0x35')]:_0xa3804d['model'];if(_0x1b1a93['query'][_0xf756('0x43')]){_0x4f0d8a[_0xf756('0x3f')]=[{'all':!![]}];}_0x4f0d8a=_[_0xf756('0x3c')]({},_0x4f0d8a,_0x1b1a93[_0xf756('0x3e')]);return db[_0xf756('0x29')][_0xf756('0x44')](_0x4f0d8a)[_0xf756('0x23')](handleEntityNotFound(_0x1e1efa,null))['then'](respondWithResult(_0x1e1efa,null))['catch'](handleError(_0x1e1efa,null));};exports[_0xf756('0x45')]=function(_0xf70b8,_0x34365a){return db[_0xf756('0x29')][_0xf756('0x45')](_0xf70b8['body'],{})['then'](respondWithResult(_0x34365a,0xc9))[_0xf756('0x41')](handleError(_0x34365a,null));};exports['update']=function(_0x3b543a,_0x5a3ca2){if(_0x3b543a[_0xf756('0x46')]['id']){delete _0x3b543a[_0xf756('0x46')]['id'];}return db[_0xf756('0x29')]['find']({'where':{'id':_0x3b543a[_0xf756('0x42')]['id']}})[_0xf756('0x23')](handleEntityNotFound(_0x5a3ca2,null))[_0xf756('0x23')](saveUpdates(_0x3b543a['body'],null))[_0xf756('0x23')](respondWithResult(_0x5a3ca2,null))[_0xf756('0x41')](handleError(_0x5a3ca2,null));};exports['destroy']=function(_0x48d859,_0x56045b){return db[_0xf756('0x29')]['find']({'where':{'id':_0x48d859[_0xf756('0x42')]['id']}})[_0xf756('0x23')](handleEntityNotFound(_0x56045b,null))[_0xf756('0x23')](removeEntity(_0x56045b,null))[_0xf756('0x41')](handleError(_0x56045b,null));};exports[_0xf756('0x47')]=function(_0x2f5305,_0x1b4512){return db[_0xf756('0x29')][_0xf756('0x47')]()[_0xf756('0x23')](respondWithResult(_0x1b4512,null))[_0xf756('0x41')](handleError(_0x1b4512,null));};
\ No newline at end of file