Built motion from commit b5996064.|2.6.21
[motion2.git] / server / api / smsTransferReport / smsTransferReport.controller.js
index 029e48b..3d972ff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcac2=['catch','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','apply','reject','save','update','destroy','error','stack','name','send','index','SmsTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','options','count','includeAll','include','findAll','then','rows','show','find'];(function(_0x21c76e,_0x657e32){var _0x1c28c7=function(_0x1053ed){while(--_0x1053ed){_0x21c76e['push'](_0x21c76e['shift']());}};_0x1c28c7(++_0x657e32);}(_0xcac2,0x1e8));var _0x2cac=function(_0x4925b6,_0x32a770){_0x4925b6=_0x4925b6-0x0;var _0x5195ea=_0xcac2[_0x4925b6];return _0x5195ea;};'use strict';var emlformat=require(_0x2cac('0x0'));var rimraf=require(_0x2cac('0x1'));var zipdir=require(_0x2cac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cac('0x3'));var moment=require(_0x2cac('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2cac('0x5'));var csv=require(_0x2cac('0x6'));var ejs=require(_0x2cac('0x7'));var fs=require('fs');var fs_extra=require(_0x2cac('0x8'));var _=require(_0x2cac('0x9'));var squel=require(_0x2cac('0xa'));var crypto=require(_0x2cac('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2cac('0x6'));var querystring=require('querystring');var Papa=require(_0x2cac('0xc'));var Redis=require(_0x2cac('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2cac('0xe'));var hardwareService=require(_0x2cac('0xf'));var logger=require('../../config/logger')(_0x2cac('0x10'));var utils=require('../../config/utils');var config=require(_0x2cac('0x11'));var licenseUtil=require(_0x2cac('0x12'));var db=require(_0x2cac('0x13'))['db'];function respondWithStatusCode(_0x1ccf7b,_0x2b5975){_0x2b5975=_0x2b5975||0xcc;return function(_0x58aad7){if(_0x58aad7){return _0x1ccf7b[_0x2cac('0x14')](_0x2b5975);}return _0x1ccf7b[_0x2cac('0x15')](_0x2b5975)['end']();};}function respondWithResult(_0x440617,_0x302d91){_0x302d91=_0x302d91||0xc8;return function(_0x3c1b1f){if(_0x3c1b1f){return _0x440617['status'](_0x302d91)[_0x2cac('0x16')](_0x3c1b1f);}};}function respondWithFilteredResult(_0x354ab7,_0x3d846b){return function(_0x5e731b){if(_0x5e731b){var _0x46db00=_0x5e731b['count'],_0x3e7e90=_0x3d846b[_0x2cac('0x17')],_0xe4041f=_0x3d846b[_0x2cac('0x17')]+_0x3d846b[_0x2cac('0x18')],_0x4d4646;if(_0xe4041f>=_0x46db00){_0xe4041f=_0x46db00;_0x4d4646=0xc8;}else{_0x4d4646=0xce;}_0x354ab7[_0x2cac('0x15')](_0x4d4646);return _0x354ab7[_0x2cac('0x19')]('Content-Range',_0x3e7e90+'-'+_0xe4041f+'/'+_0x46db00)[_0x2cac('0x16')](_0x5e731b);}return null;};}function patchUpdates(_0x2764c7){return function(_0x397e70){try{jsonpatch[_0x2cac('0x1a')](_0x397e70,_0x2764c7,!![]);}catch(_0xccf89b){return BPromise[_0x2cac('0x1b')](_0xccf89b);}return _0x397e70[_0x2cac('0x1c')]();};}function saveUpdates(_0xd04add,_0x5871af){return function(_0x3830e3){if(_0x3830e3){return _0x3830e3[_0x2cac('0x1d')](_0xd04add)['then'](function(_0x4f0168){return _0x4f0168;});}return null;};}function removeEntity(_0x35d99b,_0x53f335){return function(_0xbdb16b){if(_0xbdb16b){return _0xbdb16b[_0x2cac('0x1e')]()['then'](function(){_0x35d99b[_0x2cac('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43b372,_0x4267cc){return function(_0x37ac60){if(!_0x37ac60){_0x43b372[_0x2cac('0x14')](0x194);}return _0x37ac60;};}function handleError(_0x547154,_0x1de4c8){_0x1de4c8=_0x1de4c8||0x1f4;return function(_0x1de22c){logger[_0x2cac('0x1f')](_0x1de22c[_0x2cac('0x20')]);if(_0x1de22c[_0x2cac('0x21')]){delete _0x1de22c[_0x2cac('0x21')];}_0x547154['status'](_0x1de4c8)[_0x2cac('0x22')](_0x1de22c);};}exports[_0x2cac('0x23')]=function(_0x523e2b,_0x1f189a){var _0x4b6ad1={},_0x24966b={},_0x387e56={'count':0x0,'rows':[]};var _0x5d70a7=_['map'](db[_0x2cac('0x24')][_0x2cac('0x25')],function(_0x246cef){return{'name':_0x246cef['fieldName'],'type':_0x246cef[_0x2cac('0x26')][_0x2cac('0x27')]};});_0x24966b[_0x2cac('0x28')]=_['map'](_0x5d70a7,_0x2cac('0x21'));_0x24966b[_0x2cac('0x29')]=_[_0x2cac('0x2a')](_0x523e2b[_0x2cac('0x29')]);_0x24966b[_0x2cac('0x2b')]=_[_0x2cac('0x2c')](_0x24966b[_0x2cac('0x28')],_0x24966b['query']);_0x4b6ad1[_0x2cac('0x2d')]=_[_0x2cac('0x2c')](_0x24966b[_0x2cac('0x28')],qs['fields'](_0x523e2b[_0x2cac('0x29')][_0x2cac('0x2e')]));_0x4b6ad1[_0x2cac('0x2d')]=_0x4b6ad1[_0x2cac('0x2d')][_0x2cac('0x2f')]?_0x4b6ad1[_0x2cac('0x2d')]:_0x24966b[_0x2cac('0x28')];if(!_0x523e2b[_0x2cac('0x29')][_0x2cac('0x30')]('nolimit')){_0x4b6ad1['limit']=qs['limit'](_0x523e2b[_0x2cac('0x29')][_0x2cac('0x18')]);_0x4b6ad1['offset']=qs['offset'](_0x523e2b['query']['offset']);}_0x4b6ad1['order']=qs[_0x2cac('0x31')](_0x523e2b['query'][_0x2cac('0x31')]);_0x4b6ad1[_0x2cac('0x32')]=qs[_0x2cac('0x2b')](_[_0x2cac('0x33')](_0x523e2b[_0x2cac('0x29')],_0x24966b[_0x2cac('0x2b')]),_0x5d70a7);if(_0x523e2b[_0x2cac('0x29')][_0x2cac('0x34')]){_0x4b6ad1[_0x2cac('0x32')]=_[_0x2cac('0x35')](_0x4b6ad1['where'],{'$or':_[_0x2cac('0x36')](_0x5d70a7,function(_0x27a48d){if(_0x27a48d['type']!=='VIRTUAL'){var _0x41de45={};_0x41de45[_0x27a48d[_0x2cac('0x21')]]={'$like':'%'+_0x523e2b[_0x2cac('0x29')][_0x2cac('0x34')]+'%'};return _0x41de45;}})});}_0x4b6ad1=_[_0x2cac('0x35')]({},_0x4b6ad1,_0x523e2b[_0x2cac('0x37')]);var _0xf67ef0={'where':_0x4b6ad1[_0x2cac('0x32')]};return db[_0x2cac('0x24')][_0x2cac('0x38')](_0xf67ef0)['then'](function(_0x565744){_0x387e56[_0x2cac('0x38')]=_0x565744;if(_0x523e2b[_0x2cac('0x29')][_0x2cac('0x39')]){_0x4b6ad1[_0x2cac('0x3a')]=[{'all':!![]}];}return db[_0x2cac('0x24')][_0x2cac('0x3b')](_0x4b6ad1);})[_0x2cac('0x3c')](function(_0x1546b5){_0x387e56[_0x2cac('0x3d')]=_0x1546b5;return _0x387e56;})[_0x2cac('0x3c')](respondWithFilteredResult(_0x1f189a,_0x4b6ad1))['catch'](handleError(_0x1f189a,null));};exports[_0x2cac('0x3e')]=function(_0x378aba,_0x25c9f9){var _0x185178={'raw':!![],'where':{'id':_0x378aba['params']['id']}},_0x226a28={};_0x226a28[_0x2cac('0x28')]=_[_0x2cac('0x2a')](db['SmsTransferReport'][_0x2cac('0x25')]);_0x226a28[_0x2cac('0x29')]=_[_0x2cac('0x2a')](_0x378aba[_0x2cac('0x29')]);_0x226a28[_0x2cac('0x2b')]=_[_0x2cac('0x2c')](_0x226a28['model'],_0x226a28[_0x2cac('0x29')]);_0x185178[_0x2cac('0x2d')]=_['intersection'](_0x226a28[_0x2cac('0x28')],qs[_0x2cac('0x2e')](_0x378aba[_0x2cac('0x29')]['fields']));_0x185178[_0x2cac('0x2d')]=_0x185178['attributes']['length']?_0x185178['attributes']:_0x226a28[_0x2cac('0x28')];if(_0x378aba[_0x2cac('0x29')]['includeAll']){_0x185178['include']=[{'all':!![]}];}_0x185178=_[_0x2cac('0x35')]({},_0x185178,_0x378aba[_0x2cac('0x37')]);return db[_0x2cac('0x24')][_0x2cac('0x3f')](_0x185178)[_0x2cac('0x3c')](handleEntityNotFound(_0x25c9f9,null))['then'](respondWithResult(_0x25c9f9,null))[_0x2cac('0x40')](handleError(_0x25c9f9,null));};exports[_0x2cac('0x41')]=function(_0x232e7b,_0x16896d){return db['SmsTransferReport'][_0x2cac('0x41')](_0x232e7b[_0x2cac('0x42')],{})[_0x2cac('0x3c')](respondWithResult(_0x16896d,0xc9))[_0x2cac('0x40')](handleError(_0x16896d,null));};exports[_0x2cac('0x1d')]=function(_0x4a1651,_0x1da471){if(_0x4a1651['body']['id']){delete _0x4a1651[_0x2cac('0x42')]['id'];}return db[_0x2cac('0x24')][_0x2cac('0x3f')]({'where':{'id':_0x4a1651[_0x2cac('0x43')]['id']}})[_0x2cac('0x3c')](handleEntityNotFound(_0x1da471,null))[_0x2cac('0x3c')](saveUpdates(_0x4a1651[_0x2cac('0x42')],null))[_0x2cac('0x3c')](respondWithResult(_0x1da471,null))[_0x2cac('0x40')](handleError(_0x1da471,null));};exports[_0x2cac('0x1e')]=function(_0x2c7d9c,_0x3a2124){return db[_0x2cac('0x24')][_0x2cac('0x3f')]({'where':{'id':_0x2c7d9c[_0x2cac('0x43')]['id']}})[_0x2cac('0x3c')](handleEntityNotFound(_0x3a2124,null))[_0x2cac('0x3c')](removeEntity(_0x3a2124,null))[_0x2cac('0x40')](handleError(_0x3a2124,null));};exports[_0x2cac('0x44')]=function(_0x5d8638,_0x2a90a6){return db[_0x2cac('0x24')][_0x2cac('0x44')]()['then'](respondWithResult(_0x2a90a6,null))['catch'](handleError(_0x2a90a6,null));};
\ No newline at end of file
+var _0x30f3=['key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','merge','where','VIRTUAL','filter','options','then','SmsTransferReport','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','index','map','rawAttributes','type'];(function(_0x2d53ce,_0x33c348){var _0x322a86=function(_0x40b2a5){while(--_0x40b2a5){_0x2d53ce['push'](_0x2d53ce['shift']());}};_0x322a86(++_0x33c348);}(_0x30f3,0x1e0));var _0x330f=function(_0x3cafb8,_0x32860e){_0x3cafb8=_0x3cafb8-0x0;var _0x4b7f85=_0x30f3[_0x3cafb8];return _0x4b7f85;};'use strict';var emlformat=require(_0x330f('0x0'));var rimraf=require(_0x330f('0x1'));var zipdir=require(_0x330f('0x2'));var jsonpatch=require(_0x330f('0x3'));var rp=require('request-promise');var moment=require(_0x330f('0x4'));var BPromise=require(_0x330f('0x5'));var Mustache=require(_0x330f('0x6'));var util=require(_0x330f('0x7'));var path=require('path');var sox=require(_0x330f('0x8'));var csv=require(_0x330f('0x9'));var ejs=require(_0x330f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x330f('0xb'));var squel=require(_0x330f('0xc'));var crypto=require(_0x330f('0xd'));var jsforce=require(_0x330f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x330f('0x9'));var querystring=require(_0x330f('0xf'));var Papa=require(_0x330f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x330f('0x11'));var hardwareService=require(_0x330f('0x12'));var logger=require(_0x330f('0x13'))(_0x330f('0x14'));var utils=require(_0x330f('0x15'));var config=require(_0x330f('0x16'));var licenseUtil=require(_0x330f('0x17'));var db=require(_0x330f('0x18'))['db'];function respondWithStatusCode(_0x9717ed,_0x476f13){_0x476f13=_0x476f13||0xcc;return function(_0x14bfb8){if(_0x14bfb8){return _0x9717ed[_0x330f('0x19')](_0x476f13);}return _0x9717ed[_0x330f('0x1a')](_0x476f13)['end']();};}function respondWithResult(_0x42d615,_0x5461c0){_0x5461c0=_0x5461c0||0xc8;return function(_0x4756be){if(_0x4756be){return _0x42d615[_0x330f('0x1a')](_0x5461c0)['json'](_0x4756be);}};}function respondWithFilteredResult(_0x45d252,_0x193f86){return function(_0xfc4e4b){if(_0xfc4e4b){var _0x42e080=typeof _0x193f86[_0x330f('0x1b')]==='undefined'&&typeof _0x193f86[_0x330f('0x1c')]===_0x330f('0x1d');var _0x2136fd=_0xfc4e4b[_0x330f('0x1e')];var _0x44a8bf=_0x42e080?0x0:_0x193f86['offset'];var _0x7281dc=_0x42e080?_0xfc4e4b[_0x330f('0x1e')]:_0x193f86[_0x330f('0x1b')]+_0x193f86['limit'];var _0x1d7995;if(_0x7281dc>=_0x2136fd){_0x7281dc=_0x2136fd;_0x1d7995=0xc8;}else{_0x1d7995=0xce;}_0x45d252['status'](_0x1d7995);return _0x45d252[_0x330f('0x1f')](_0x330f('0x20'),_0x44a8bf+'-'+_0x7281dc+'/'+_0x2136fd)['json'](_0xfc4e4b);}return null;};}function patchUpdates(_0x1182b5){return function(_0x42c4c8){try{jsonpatch[_0x330f('0x21')](_0x42c4c8,_0x1182b5,!![]);}catch(_0x9d669a){return BPromise[_0x330f('0x22')](_0x9d669a);}return _0x42c4c8[_0x330f('0x23')]();};}function saveUpdates(_0x60595,_0x143856){return function(_0x5e907e){if(_0x5e907e){return _0x5e907e['update'](_0x60595)['then'](function(_0x4714c1){return _0x4714c1;});}return null;};}function removeEntity(_0xfc3d65,_0x3a147f){return function(_0x541d96){if(_0x541d96){return _0x541d96[_0x330f('0x24')]()['then'](function(){_0xfc3d65[_0x330f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f1b45,_0x3257fc){return function(_0x25f67f){if(!_0x25f67f){_0x1f1b45[_0x330f('0x19')](0x194);}return _0x25f67f;};}function handleError(_0x59d082,_0x216be8){_0x216be8=_0x216be8||0x1f4;return function(_0x1e1e24){logger[_0x330f('0x25')](_0x1e1e24[_0x330f('0x26')]);if(_0x1e1e24[_0x330f('0x27')]){delete _0x1e1e24[_0x330f('0x27')];}_0x59d082[_0x330f('0x1a')](_0x216be8)[_0x330f('0x28')](_0x1e1e24);};}exports[_0x330f('0x29')]=function(_0x164ba1,_0x134205){var _0xb474e8={},_0x17944f={},_0x59db4a={'count':0x0,'rows':[]};var _0x42183c=_[_0x330f('0x2a')](db['SmsTransferReport'][_0x330f('0x2b')],function(_0x2126c3){return{'name':_0x2126c3['fieldName'],'type':_0x2126c3[_0x330f('0x2c')][_0x330f('0x2d')]};});_0x17944f[_0x330f('0x2e')]=_['map'](_0x42183c,_0x330f('0x27'));_0x17944f['query']=_[_0x330f('0x2f')](_0x164ba1[_0x330f('0x30')]);_0x17944f[_0x330f('0x31')]=_[_0x330f('0x32')](_0x17944f[_0x330f('0x2e')],_0x17944f[_0x330f('0x30')]);_0xb474e8[_0x330f('0x33')]=_[_0x330f('0x32')](_0x17944f[_0x330f('0x2e')],qs[_0x330f('0x34')](_0x164ba1['query'][_0x330f('0x34')]));_0xb474e8[_0x330f('0x33')]=_0xb474e8[_0x330f('0x33')][_0x330f('0x35')]?_0xb474e8['attributes']:_0x17944f[_0x330f('0x2e')];if(!_0x164ba1[_0x330f('0x30')][_0x330f('0x36')]('nolimit')){_0xb474e8[_0x330f('0x1c')]=qs[_0x330f('0x1c')](_0x164ba1[_0x330f('0x30')][_0x330f('0x1c')]);_0xb474e8[_0x330f('0x1b')]=qs[_0x330f('0x1b')](_0x164ba1[_0x330f('0x30')][_0x330f('0x1b')]);}_0xb474e8[_0x330f('0x37')]=qs[_0x330f('0x38')](_0x164ba1['query']['sort']);_0xb474e8['where']=qs[_0x330f('0x31')](_['pick'](_0x164ba1[_0x330f('0x30')],_0x17944f[_0x330f('0x31')]),_0x42183c);if(_0x164ba1[_0x330f('0x30')]['filter']){_0xb474e8['where']=_[_0x330f('0x39')](_0xb474e8[_0x330f('0x3a')],{'$or':_[_0x330f('0x2a')](_0x42183c,function(_0x4fc6e3){if(_0x4fc6e3['type']!==_0x330f('0x3b')){var _0xfac51f={};_0xfac51f[_0x4fc6e3[_0x330f('0x27')]]={'$like':'%'+_0x164ba1[_0x330f('0x30')][_0x330f('0x3c')]+'%'};return _0xfac51f;}})});}_0xb474e8=_['merge']({},_0xb474e8,_0x164ba1[_0x330f('0x3d')]);var _0x2e63c6={'where':_0xb474e8['where']};return db['SmsTransferReport'][_0x330f('0x1e')](_0x2e63c6)[_0x330f('0x3e')](function(_0x2a2b0a){_0x59db4a[_0x330f('0x1e')]=_0x2a2b0a;if(_0x164ba1[_0x330f('0x30')]['includeAll']){_0xb474e8['include']=[{'all':!![]}];}return db[_0x330f('0x3f')][_0x330f('0x40')](_0xb474e8);})['then'](function(_0x52a8f0){_0x59db4a[_0x330f('0x41')]=_0x52a8f0;return _0x59db4a;})[_0x330f('0x3e')](respondWithFilteredResult(_0x134205,_0xb474e8))[_0x330f('0x42')](handleError(_0x134205,null));};exports[_0x330f('0x43')]=function(_0x15bbfe,_0x2bacb3){var _0x337fff={'raw':!![],'where':{'id':_0x15bbfe[_0x330f('0x44')]['id']}},_0x56e277={};_0x56e277[_0x330f('0x2e')]=_[_0x330f('0x2f')](db[_0x330f('0x3f')][_0x330f('0x2b')]);_0x56e277['query']=_[_0x330f('0x2f')](_0x15bbfe[_0x330f('0x30')]);_0x56e277[_0x330f('0x31')]=_[_0x330f('0x32')](_0x56e277['model'],_0x56e277['query']);_0x337fff[_0x330f('0x33')]=_[_0x330f('0x32')](_0x56e277['model'],qs[_0x330f('0x34')](_0x15bbfe[_0x330f('0x30')][_0x330f('0x34')]));_0x337fff['attributes']=_0x337fff['attributes'][_0x330f('0x35')]?_0x337fff[_0x330f('0x33')]:_0x56e277[_0x330f('0x2e')];if(_0x15bbfe[_0x330f('0x30')]['includeAll']){_0x337fff[_0x330f('0x45')]=[{'all':!![]}];}_0x337fff=_['merge']({},_0x337fff,_0x15bbfe['options']);return db['SmsTransferReport'][_0x330f('0x46')](_0x337fff)[_0x330f('0x3e')](handleEntityNotFound(_0x2bacb3,null))[_0x330f('0x3e')](respondWithResult(_0x2bacb3,null))['catch'](handleError(_0x2bacb3,null));};exports[_0x330f('0x47')]=function(_0x4ced47,_0x2921b2){return db[_0x330f('0x3f')][_0x330f('0x47')](_0x4ced47[_0x330f('0x48')],{})[_0x330f('0x3e')](respondWithResult(_0x2921b2,0xc9))[_0x330f('0x42')](handleError(_0x2921b2,null));};exports[_0x330f('0x49')]=function(_0x4c29e6,_0x148327){if(_0x4c29e6[_0x330f('0x48')]['id']){delete _0x4c29e6[_0x330f('0x48')]['id'];}return db[_0x330f('0x3f')][_0x330f('0x46')]({'where':{'id':_0x4c29e6[_0x330f('0x44')]['id']}})[_0x330f('0x3e')](handleEntityNotFound(_0x148327,null))[_0x330f('0x3e')](saveUpdates(_0x4c29e6['body'],null))[_0x330f('0x3e')](respondWithResult(_0x148327,null))['catch'](handleError(_0x148327,null));};exports['destroy']=function(_0xe2d07b,_0x3e0741){return db['SmsTransferReport']['find']({'where':{'id':_0xe2d07b[_0x330f('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e0741,null))[_0x330f('0x3e')](removeEntity(_0x3e0741,null))[_0x330f('0x42')](handleError(_0x3e0741,null));};exports[_0x330f('0x4a')]=function(_0x28c290,_0x216b84){return db[_0x330f('0x3f')][_0x330f('0x4a')]()[_0x330f('0x3e')](respondWithResult(_0x216b84,null))[_0x330f('0x42')](handleError(_0x216b84,null));};
\ No newline at end of file