Built motion from commit a679711e.|2.6.15
[motion2.git] / server / api / smsTransferReport / smsTransferReport.controller.js
index 380c282..0ece1fb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8905=['limit','sort','where','filters','pick','filter','VIRTUAL','merge','options','then','findAll','rows','catch','params','keys','fields','includeAll','include','find','create','body','destroy','describe','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','count','offset','Content-Range','json','apply','reject','save','sendStatus','error','name','send','map','SmsTransferReport','rawAttributes','key','model','query','intersection','attributes','length','hasOwnProperty'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x8905,0x12b));var _0x5890=function(_0x1623f4,_0x3c72b7){_0x1623f4=_0x1623f4-0x0;var _0x3ede44=_0x8905[_0x1623f4];return _0x3ede44;};'use strict';var pdf=require(_0x5890('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5890('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5890('0x2'));var moment=require(_0x5890('0x3'));var BPromise=require(_0x5890('0x4'));var Mustache=require(_0x5890('0x5'));var util=require(_0x5890('0x6'));var path=require(_0x5890('0x7'));var sox=require('sox');var csv=require(_0x5890('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5890('0x9'));var squel=require(_0x5890('0xa'));var crypto=require(_0x5890('0xb'));var jsforce=require(_0x5890('0xc'));var deskjs=require(_0x5890('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5890('0xe'));var Redis=require(_0x5890('0xf'));var authService=require(_0x5890('0x10'));var qs=require(_0x5890('0x11'));var as=require(_0x5890('0x12'));var hardwareService=require(_0x5890('0x13'));var logger=require(_0x5890('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x5890('0x15'));var db=require(_0x5890('0x16'))['db'];function respondWithStatusCode(_0x42a66f,_0x677d93){_0x677d93=_0x677d93||0xcc;return function(_0x57ed10){if(_0x57ed10){return _0x42a66f['sendStatus'](_0x677d93);}return _0x42a66f[_0x5890('0x17')](_0x677d93)[_0x5890('0x18')]();};}function respondWithResult(_0x48a110,_0x5f3bcf){_0x5f3bcf=_0x5f3bcf||0xc8;return function(_0x45dd1a){if(_0x45dd1a){return _0x48a110[_0x5890('0x17')](_0x5f3bcf)['json'](_0x45dd1a);}};}function respondWithFilteredResult(_0x3ae108,_0x1c6514){return function(_0x398a90){if(_0x398a90){var _0x486c02=_0x398a90[_0x5890('0x19')],_0x1a36ba=_0x1c6514['offset'],_0x49a196=_0x1c6514[_0x5890('0x1a')]+_0x1c6514['limit'],_0x301526;if(_0x49a196>=_0x486c02){_0x49a196=_0x486c02;_0x301526=0xc8;}else{_0x301526=0xce;}_0x3ae108['status'](_0x301526);return _0x3ae108['set'](_0x5890('0x1b'),_0x1a36ba+'-'+_0x49a196+'/'+_0x486c02)[_0x5890('0x1c')](_0x398a90);}return null;};}function patchUpdates(_0x23031d){return function(_0x122c3b){try{jsonpatch[_0x5890('0x1d')](_0x122c3b,_0x23031d,!![]);}catch(_0x4f704a){return BPromise[_0x5890('0x1e')](_0x4f704a);}return _0x122c3b[_0x5890('0x1f')]();};}function saveUpdates(_0x1f30b5,_0x4a5e33){return function(_0xe7f8e9){if(_0xe7f8e9){return _0xe7f8e9['update'](_0x1f30b5)['then'](function(_0x4801f9){return _0x4801f9;});}return null;};}function removeEntity(_0x5e52d3,_0x1c740f){return function(_0x2d4230){if(_0x2d4230){return _0x2d4230['destroy']()['then'](function(){_0x5e52d3['status'](0xcc)[_0x5890('0x18')]();});}};}function handleEntityNotFound(_0x2efe0a,_0x3fc3df){return function(_0x3da828){if(!_0x3da828){_0x2efe0a[_0x5890('0x20')](0x194);}return _0x3da828;};}function handleError(_0x2dd2a6,_0x3d438b){_0x3d438b=_0x3d438b||0x1f4;return function(_0x13d64c){logger[_0x5890('0x21')](_0x13d64c['stack']);if(_0x13d64c[_0x5890('0x22')]){delete _0x13d64c[_0x5890('0x22')];}_0x2dd2a6[_0x5890('0x17')](_0x3d438b)[_0x5890('0x23')](_0x13d64c);};}exports['index']=function(_0x203531,_0x3b8ea8){var _0x27aecc={},_0x31b840={},_0x2918c7={'count':0x0,'rows':[]};var _0x1ebe87=_[_0x5890('0x24')](db[_0x5890('0x25')][_0x5890('0x26')],function(_0x2430f8){return{'name':_0x2430f8['fieldName'],'type':_0x2430f8['type'][_0x5890('0x27')]};});_0x31b840[_0x5890('0x28')]=_[_0x5890('0x24')](_0x1ebe87,'name');_0x31b840[_0x5890('0x29')]=_['keys'](_0x203531[_0x5890('0x29')]);_0x31b840['filters']=_[_0x5890('0x2a')](_0x31b840[_0x5890('0x28')],_0x31b840[_0x5890('0x29')]);_0x27aecc[_0x5890('0x2b')]=_[_0x5890('0x2a')](_0x31b840[_0x5890('0x28')],qs['fields'](_0x203531[_0x5890('0x29')]['fields']));_0x27aecc['attributes']=_0x27aecc[_0x5890('0x2b')][_0x5890('0x2c')]?_0x27aecc[_0x5890('0x2b')]:_0x31b840[_0x5890('0x28')];if(!_0x203531[_0x5890('0x29')][_0x5890('0x2d')]('nolimit')){_0x27aecc['limit']=qs[_0x5890('0x2e')](_0x203531[_0x5890('0x29')]['limit']);_0x27aecc[_0x5890('0x1a')]=qs[_0x5890('0x1a')](_0x203531[_0x5890('0x29')][_0x5890('0x1a')]);}_0x27aecc['order']=qs[_0x5890('0x2f')](_0x203531[_0x5890('0x29')]['sort']);_0x27aecc[_0x5890('0x30')]=qs[_0x5890('0x31')](_[_0x5890('0x32')](_0x203531[_0x5890('0x29')],_0x31b840[_0x5890('0x31')]));if(_0x203531[_0x5890('0x29')][_0x5890('0x33')]){_0x27aecc['where']=_['merge'](_0x27aecc[_0x5890('0x30')],{'$or':_[_0x5890('0x24')](_0x1ebe87,function(_0x47fa35){if(_0x47fa35['type']!==_0x5890('0x34')){var _0x382df7={};_0x382df7[_0x47fa35[_0x5890('0x22')]]={'$like':'%'+_0x203531[_0x5890('0x29')][_0x5890('0x33')]+'%'};return _0x382df7;}})});}_0x27aecc=_[_0x5890('0x35')]({},_0x27aecc,_0x203531[_0x5890('0x36')]);var _0x4760c7={'where':_0x27aecc[_0x5890('0x30')]};return db['SmsTransferReport'][_0x5890('0x19')](_0x4760c7)[_0x5890('0x37')](function(_0x267ca7){_0x2918c7[_0x5890('0x19')]=_0x267ca7;if(_0x203531[_0x5890('0x29')]['includeAll']){_0x27aecc['include']=[{'all':!![]}];}return db[_0x5890('0x25')][_0x5890('0x38')](_0x27aecc);})['then'](function(_0x58cde1){_0x2918c7[_0x5890('0x39')]=_0x58cde1;return _0x2918c7;})[_0x5890('0x37')](respondWithFilteredResult(_0x3b8ea8,_0x27aecc))[_0x5890('0x3a')](handleError(_0x3b8ea8,null));};exports['show']=function(_0x2e2bb6,_0x4404ca){var _0x1af0c1={'raw':!![],'where':{'id':_0x2e2bb6[_0x5890('0x3b')]['id']}},_0x9707d8={};_0x9707d8[_0x5890('0x28')]=_[_0x5890('0x3c')](db['SmsTransferReport'][_0x5890('0x26')]);_0x9707d8[_0x5890('0x29')]=_['keys'](_0x2e2bb6[_0x5890('0x29')]);_0x9707d8[_0x5890('0x31')]=_[_0x5890('0x2a')](_0x9707d8[_0x5890('0x28')],_0x9707d8[_0x5890('0x29')]);_0x1af0c1['attributes']=_['intersection'](_0x9707d8[_0x5890('0x28')],qs[_0x5890('0x3d')](_0x2e2bb6['query'][_0x5890('0x3d')]));_0x1af0c1['attributes']=_0x1af0c1[_0x5890('0x2b')][_0x5890('0x2c')]?_0x1af0c1[_0x5890('0x2b')]:_0x9707d8['model'];if(_0x2e2bb6[_0x5890('0x29')][_0x5890('0x3e')]){_0x1af0c1[_0x5890('0x3f')]=[{'all':!![]}];}_0x1af0c1=_[_0x5890('0x35')]({},_0x1af0c1,_0x2e2bb6[_0x5890('0x36')]);return db[_0x5890('0x25')][_0x5890('0x40')](_0x1af0c1)['then'](handleEntityNotFound(_0x4404ca,null))[_0x5890('0x37')](respondWithResult(_0x4404ca,null))[_0x5890('0x3a')](handleError(_0x4404ca,null));};exports[_0x5890('0x41')]=function(_0xfacbba,_0x4b55e3){return db[_0x5890('0x25')][_0x5890('0x41')](_0xfacbba['body'],{})[_0x5890('0x37')](respondWithResult(_0x4b55e3,0xc9))[_0x5890('0x3a')](handleError(_0x4b55e3,null));};exports['update']=function(_0x3e7f82,_0x48296d){if(_0x3e7f82[_0x5890('0x42')]['id']){delete _0x3e7f82[_0x5890('0x42')]['id'];}return db['SmsTransferReport'][_0x5890('0x40')]({'where':{'id':_0x3e7f82[_0x5890('0x3b')]['id']}})[_0x5890('0x37')](handleEntityNotFound(_0x48296d,null))[_0x5890('0x37')](saveUpdates(_0x3e7f82[_0x5890('0x42')],null))['then'](respondWithResult(_0x48296d,null))['catch'](handleError(_0x48296d,null));};exports[_0x5890('0x43')]=function(_0x245b4c,_0x5e6a8d){return db['SmsTransferReport']['find']({'where':{'id':_0x245b4c[_0x5890('0x3b')]['id']}})[_0x5890('0x37')](handleEntityNotFound(_0x5e6a8d,null))[_0x5890('0x37')](removeEntity(_0x5e6a8d,null))[_0x5890('0x3a')](handleError(_0x5e6a8d,null));};exports[_0x5890('0x44')]=function(_0x914c29,_0x47aa06){return db[_0x5890('0x25')]['describe']()[_0x5890('0x37')](respondWithResult(_0x47aa06,null))[_0x5890('0x3a')](handleError(_0x47aa06,null));};
\ No newline at end of file
+var _0x47f3=['then','destroy','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','keys','filters','query','attributes','intersection','model','fields','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x47f3,0x14b));var _0x347f=function(_0x43eaeb,_0x419a9d){_0x43eaeb=_0x43eaeb-0x0;var _0x13f774=_0x47f3[_0x43eaeb];return _0x13f774;};'use strict';var emlformat=require(_0x347f('0x0'));var rimraf=require(_0x347f('0x1'));var zipdir=require(_0x347f('0x2'));var jsonpatch=require(_0x347f('0x3'));var rp=require('request-promise');var moment=require(_0x347f('0x4'));var BPromise=require(_0x347f('0x5'));var Mustache=require(_0x347f('0x6'));var util=require(_0x347f('0x7'));var path=require(_0x347f('0x8'));var sox=require(_0x347f('0x9'));var csv=require(_0x347f('0xa'));var ejs=require(_0x347f('0xb'));var fs=require('fs');var fs_extra=require(_0x347f('0xc'));var _=require('lodash');var squel=require(_0x347f('0xd'));var crypto=require('crypto');var jsforce=require(_0x347f('0xe'));var deskjs=require(_0x347f('0xf'));var toCsv=require(_0x347f('0xa'));var querystring=require(_0x347f('0x10'));var Papa=require(_0x347f('0x11'));var Redis=require(_0x347f('0x12'));var authService=require(_0x347f('0x13'));var qs=require(_0x347f('0x14'));var as=require(_0x347f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x347f('0x16'))(_0x347f('0x17'));var utils=require(_0x347f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x347f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53db0d,_0xbb03cb){_0xbb03cb=_0xbb03cb||0xcc;return function(_0x142849){if(_0x142849){return _0x53db0d['sendStatus'](_0xbb03cb);}return _0x53db0d[_0x347f('0x1a')](_0xbb03cb)[_0x347f('0x1b')]();};}function respondWithResult(_0x9df003,_0x4160af){_0x4160af=_0x4160af||0xc8;return function(_0x5067bd){if(_0x5067bd){return _0x9df003['status'](_0x4160af)[_0x347f('0x1c')](_0x5067bd);}};}function respondWithFilteredResult(_0x3eae70,_0x200701){return function(_0x4ca35a){if(_0x4ca35a){var _0x4101b0=typeof _0x200701[_0x347f('0x1d')]===_0x347f('0x1e')&&typeof _0x200701[_0x347f('0x1f')]===_0x347f('0x1e');var _0x124d7e=_0x4ca35a[_0x347f('0x20')];var _0x577884=_0x4101b0?0x0:_0x200701[_0x347f('0x1d')];var _0x52101c=_0x4101b0?_0x4ca35a[_0x347f('0x20')]:_0x200701['offset']+_0x200701['limit'];var _0x3cfb26;if(_0x52101c>=_0x124d7e){_0x52101c=_0x124d7e;_0x3cfb26=0xc8;}else{_0x3cfb26=0xce;}_0x3eae70[_0x347f('0x1a')](_0x3cfb26);return _0x3eae70[_0x347f('0x21')](_0x347f('0x22'),_0x577884+'-'+_0x52101c+'/'+_0x124d7e)['json'](_0x4ca35a);}return null;};}function patchUpdates(_0x5a732c){return function(_0x3787e1){try{jsonpatch[_0x347f('0x23')](_0x3787e1,_0x5a732c,!![]);}catch(_0x5c5cf9){return BPromise[_0x347f('0x24')](_0x5c5cf9);}return _0x3787e1[_0x347f('0x25')]();};}function saveUpdates(_0x1283d5,_0x52d60b){return function(_0x181417){if(_0x181417){return _0x181417[_0x347f('0x26')](_0x1283d5)[_0x347f('0x27')](function(_0x2a4d03){return _0x2a4d03;});}return null;};}function removeEntity(_0x4fae1c,_0x4e93ae){return function(_0x33ac5b){if(_0x33ac5b){return _0x33ac5b[_0x347f('0x28')]()[_0x347f('0x27')](function(){_0x4fae1c[_0x347f('0x1a')](0xcc)[_0x347f('0x1b')]();});}};}function handleEntityNotFound(_0x327f6b,_0x353233){return function(_0x1b4e05){if(!_0x1b4e05){_0x327f6b['sendStatus'](0x194);}return _0x1b4e05;};}function handleError(_0x1b80a8,_0x1061d1){_0x1061d1=_0x1061d1||0x1f4;return function(_0x30247c){logger['error'](_0x30247c[_0x347f('0x29')]);if(_0x30247c[_0x347f('0x2a')]){delete _0x30247c['name'];}_0x1b80a8[_0x347f('0x1a')](_0x1061d1)[_0x347f('0x2b')](_0x30247c);};}exports['index']=function(_0x1072ea,_0x470d22){var _0xcadb11={},_0x434f5f={},_0x21c737={'count':0x0,'rows':[]};var _0x44e3b9=_[_0x347f('0x2c')](db[_0x347f('0x2d')][_0x347f('0x2e')],function(_0x5ee06b){return{'name':_0x5ee06b[_0x347f('0x2f')],'type':_0x5ee06b[_0x347f('0x30')]['key']};});_0x434f5f['model']=_[_0x347f('0x2c')](_0x44e3b9,_0x347f('0x2a'));_0x434f5f['query']=_[_0x347f('0x31')](_0x1072ea['query']);_0x434f5f[_0x347f('0x32')]=_['intersection'](_0x434f5f['model'],_0x434f5f[_0x347f('0x33')]);_0xcadb11[_0x347f('0x34')]=_[_0x347f('0x35')](_0x434f5f[_0x347f('0x36')],qs[_0x347f('0x37')](_0x1072ea[_0x347f('0x33')][_0x347f('0x37')]));_0xcadb11[_0x347f('0x34')]=_0xcadb11[_0x347f('0x34')]['length']?_0xcadb11[_0x347f('0x34')]:_0x434f5f[_0x347f('0x36')];if(!_0x1072ea[_0x347f('0x33')]['hasOwnProperty']('nolimit')){_0xcadb11[_0x347f('0x1f')]=qs[_0x347f('0x1f')](_0x1072ea[_0x347f('0x33')][_0x347f('0x1f')]);_0xcadb11[_0x347f('0x1d')]=qs[_0x347f('0x1d')](_0x1072ea['query'][_0x347f('0x1d')]);}_0xcadb11['order']=qs[_0x347f('0x38')](_0x1072ea[_0x347f('0x33')][_0x347f('0x38')]);_0xcadb11[_0x347f('0x39')]=qs['filters'](_[_0x347f('0x3a')](_0x1072ea[_0x347f('0x33')],_0x434f5f[_0x347f('0x32')]),_0x44e3b9);if(_0x1072ea[_0x347f('0x33')]['filter']){_0xcadb11[_0x347f('0x39')]=_[_0x347f('0x3b')](_0xcadb11[_0x347f('0x39')],{'$or':_[_0x347f('0x2c')](_0x44e3b9,function(_0x1dbd53){if(_0x1dbd53[_0x347f('0x30')]!==_0x347f('0x3c')){var _0x2f6c3f={};_0x2f6c3f[_0x1dbd53[_0x347f('0x2a')]]={'$like':'%'+_0x1072ea[_0x347f('0x33')]['filter']+'%'};return _0x2f6c3f;}})});}_0xcadb11=_[_0x347f('0x3b')]({},_0xcadb11,_0x1072ea[_0x347f('0x3d')]);var _0xcfc5b3={'where':_0xcadb11[_0x347f('0x39')]};return db['SmsTransferReport'][_0x347f('0x20')](_0xcfc5b3)[_0x347f('0x27')](function(_0x15b1b1){_0x21c737['count']=_0x15b1b1;if(_0x1072ea[_0x347f('0x33')][_0x347f('0x3e')]){_0xcadb11[_0x347f('0x3f')]=[{'all':!![]}];}return db[_0x347f('0x2d')][_0x347f('0x40')](_0xcadb11);})[_0x347f('0x27')](function(_0x53ac0e){_0x21c737[_0x347f('0x41')]=_0x53ac0e;return _0x21c737;})[_0x347f('0x27')](respondWithFilteredResult(_0x470d22,_0xcadb11))[_0x347f('0x42')](handleError(_0x470d22,null));};exports[_0x347f('0x43')]=function(_0x506b37,_0xbfc84b){var _0x5594f6={'raw':!![],'where':{'id':_0x506b37[_0x347f('0x44')]['id']}},_0x422c7c={};_0x422c7c['model']=_[_0x347f('0x31')](db[_0x347f('0x2d')][_0x347f('0x2e')]);_0x422c7c[_0x347f('0x33')]=_[_0x347f('0x31')](_0x506b37[_0x347f('0x33')]);_0x422c7c[_0x347f('0x32')]=_[_0x347f('0x35')](_0x422c7c[_0x347f('0x36')],_0x422c7c[_0x347f('0x33')]);_0x5594f6['attributes']=_[_0x347f('0x35')](_0x422c7c[_0x347f('0x36')],qs[_0x347f('0x37')](_0x506b37['query']['fields']));_0x5594f6[_0x347f('0x34')]=_0x5594f6[_0x347f('0x34')][_0x347f('0x45')]?_0x5594f6[_0x347f('0x34')]:_0x422c7c[_0x347f('0x36')];if(_0x506b37[_0x347f('0x33')][_0x347f('0x3e')]){_0x5594f6[_0x347f('0x3f')]=[{'all':!![]}];}_0x5594f6=_['merge']({},_0x5594f6,_0x506b37[_0x347f('0x3d')]);return db[_0x347f('0x2d')]['find'](_0x5594f6)[_0x347f('0x27')](handleEntityNotFound(_0xbfc84b,null))[_0x347f('0x27')](respondWithResult(_0xbfc84b,null))[_0x347f('0x42')](handleError(_0xbfc84b,null));};exports['create']=function(_0x4d9e4a,_0x44e597){return db[_0x347f('0x2d')][_0x347f('0x46')](_0x4d9e4a[_0x347f('0x47')],{})[_0x347f('0x27')](respondWithResult(_0x44e597,0xc9))[_0x347f('0x42')](handleError(_0x44e597,null));};exports[_0x347f('0x26')]=function(_0x46b03b,_0x14e132){if(_0x46b03b[_0x347f('0x47')]['id']){delete _0x46b03b[_0x347f('0x47')]['id'];}return db[_0x347f('0x2d')][_0x347f('0x48')]({'where':{'id':_0x46b03b[_0x347f('0x44')]['id']}})['then'](handleEntityNotFound(_0x14e132,null))[_0x347f('0x27')](saveUpdates(_0x46b03b[_0x347f('0x47')],null))[_0x347f('0x27')](respondWithResult(_0x14e132,null))[_0x347f('0x42')](handleError(_0x14e132,null));};exports[_0x347f('0x28')]=function(_0x1bce59,_0x175f53){return db['SmsTransferReport'][_0x347f('0x48')]({'where':{'id':_0x1bce59['params']['id']}})[_0x347f('0x27')](handleEntityNotFound(_0x175f53,null))[_0x347f('0x27')](removeEntity(_0x175f53,null))[_0x347f('0x42')](handleError(_0x175f53,null));};exports['describe']=function(_0x282d9a,_0x127739){return db[_0x347f('0x2d')][_0x347f('0x49')]()[_0x347f('0x27')](respondWithResult(_0x127739,null))['catch'](handleError(_0x127739,null));};
\ No newline at end of file