Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / openchannelTransferReport / openchannelTransferReport.controller.js
index 9f19219..04a7bc9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2f67=['fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','set','json','save','destroy','then','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes'];(function(_0x1e2447,_0x5fea89){var _0x306f03=function(_0x11ac2c){while(--_0x11ac2c){_0x1e2447['push'](_0x1e2447['shift']());}};_0x306f03(++_0x5fea89);}(_0x2f67,0x9f));var _0x72f6=function(_0x2ef663,_0x3baaa8){_0x2ef663=_0x2ef663-0x0;var _0x290093=_0x2f67[_0x2ef663];return _0x290093;};'use strict';var pdf=require(_0x72f6('0x0'));var emlformat=require(_0x72f6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x72f6('0x2'));var jsonpatch=require(_0x72f6('0x3'));var rp=require(_0x72f6('0x4'));var moment=require(_0x72f6('0x5'));var BPromise=require(_0x72f6('0x6'));var Mustache=require(_0x72f6('0x7'));var util=require(_0x72f6('0x8'));var path=require('path');var sox=require(_0x72f6('0x9'));var csv=require(_0x72f6('0xa'));var ejs=require(_0x72f6('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x72f6('0xc'));var crypto=require(_0x72f6('0xd'));var jsforce=require(_0x72f6('0xe'));var deskjs=require(_0x72f6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x72f6('0x10'));var Papa=require(_0x72f6('0x11'));var Redis=require(_0x72f6('0x12'));var authService=require(_0x72f6('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72f6('0x14'));var logger=require('../../config/logger')(_0x72f6('0x15'));var utils=require(_0x72f6('0x16'));var config=require(_0x72f6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cc0f3,_0x1bdd3d){_0x1bdd3d=_0x1bdd3d||0xcc;return function(_0x5afa8f){if(_0x5afa8f){return _0x3cc0f3[_0x72f6('0x18')](_0x1bdd3d);}return _0x3cc0f3['status'](_0x1bdd3d)[_0x72f6('0x19')]();};}function respondWithResult(_0x382e9d,_0xcbd50){_0xcbd50=_0xcbd50||0xc8;return function(_0x3ef3b4){if(_0x3ef3b4){return _0x382e9d[_0x72f6('0x1a')](_0xcbd50)['json'](_0x3ef3b4);}};}function respondWithFilteredResult(_0x4ccf4f,_0x217818){return function(_0x36eb77){if(_0x36eb77){var _0x4c6887=_0x36eb77['count'],_0x51f424=_0x217818[_0x72f6('0x1b')],_0x545339=_0x217818['offset']+_0x217818['limit'],_0x143566;if(_0x545339>=_0x4c6887){_0x545339=_0x4c6887;_0x143566=0xc8;}else{_0x143566=0xce;}_0x4ccf4f[_0x72f6('0x1a')](_0x143566);return _0x4ccf4f[_0x72f6('0x1c')]('Content-Range',_0x51f424+'-'+_0x545339+'/'+_0x4c6887)[_0x72f6('0x1d')](_0x36eb77);}return null;};}function patchUpdates(_0x51651f){return function(_0x63fd64){try{jsonpatch['apply'](_0x63fd64,_0x51651f,!![]);}catch(_0xa63218){return BPromise['reject'](_0xa63218);}return _0x63fd64[_0x72f6('0x1e')]();};}function saveUpdates(_0x549f28,_0x1c427c){return function(_0x593716){if(_0x593716){return _0x593716['update'](_0x549f28)['then'](function(_0x5c2aa7){return _0x5c2aa7;});}return null;};}function removeEntity(_0x51b0c7,_0x50c89a){return function(_0xb75894){if(_0xb75894){return _0xb75894[_0x72f6('0x1f')]()[_0x72f6('0x20')](function(){_0x51b0c7[_0x72f6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cb8a4,_0x57a02d){return function(_0x7c4024){if(!_0x7c4024){_0x1cb8a4[_0x72f6('0x18')](0x194);}return _0x7c4024;};}function handleError(_0x4a87f1,_0xa08864){_0xa08864=_0xa08864||0x1f4;return function(_0x583804){logger[_0x72f6('0x21')](_0x583804[_0x72f6('0x22')]);if(_0x583804[_0x72f6('0x23')]){delete _0x583804[_0x72f6('0x23')];}_0x4a87f1[_0x72f6('0x1a')](_0xa08864)['send'](_0x583804);};}exports[_0x72f6('0x24')]=function(_0x45e3bb,_0x55b87a){var _0x32efea={},_0x14829d={},_0x197fb9={'count':0x0,'rows':[]};var _0x52da2a=_[_0x72f6('0x25')](db[_0x72f6('0x26')][_0x72f6('0x27')],function(_0x4da2ff){return{'name':_0x4da2ff[_0x72f6('0x28')],'type':_0x4da2ff['type'][_0x72f6('0x29')]};});_0x14829d['model']=_[_0x72f6('0x25')](_0x52da2a,_0x72f6('0x23'));_0x14829d['query']=_[_0x72f6('0x2a')](_0x45e3bb[_0x72f6('0x2b')]);_0x14829d[_0x72f6('0x2c')]=_[_0x72f6('0x2d')](_0x14829d[_0x72f6('0x2e')],_0x14829d[_0x72f6('0x2b')]);_0x32efea[_0x72f6('0x2f')]=_[_0x72f6('0x2d')](_0x14829d['model'],qs[_0x72f6('0x30')](_0x45e3bb[_0x72f6('0x2b')][_0x72f6('0x30')]));_0x32efea[_0x72f6('0x2f')]=_0x32efea[_0x72f6('0x2f')]['length']?_0x32efea[_0x72f6('0x2f')]:_0x14829d['model'];if(!_0x45e3bb['query'][_0x72f6('0x31')]('nolimit')){_0x32efea[_0x72f6('0x32')]=qs['limit'](_0x45e3bb[_0x72f6('0x2b')][_0x72f6('0x32')]);_0x32efea['offset']=qs[_0x72f6('0x1b')](_0x45e3bb[_0x72f6('0x2b')][_0x72f6('0x1b')]);}_0x32efea[_0x72f6('0x33')]=qs[_0x72f6('0x34')](_0x45e3bb['query'][_0x72f6('0x34')]);_0x32efea[_0x72f6('0x35')]=qs['filters'](_[_0x72f6('0x36')](_0x45e3bb[_0x72f6('0x2b')],_0x14829d['filters']));if(_0x45e3bb['query'][_0x72f6('0x37')]){_0x32efea[_0x72f6('0x35')]=_[_0x72f6('0x38')](_0x32efea['where'],{'$or':_['map'](_0x52da2a,function(_0x18be61){if(_0x18be61['type']!==_0x72f6('0x39')){var _0x437450={};_0x437450[_0x18be61[_0x72f6('0x23')]]={'$like':'%'+_0x45e3bb[_0x72f6('0x2b')][_0x72f6('0x37')]+'%'};return _0x437450;}})});}_0x32efea=_[_0x72f6('0x38')]({},_0x32efea,_0x45e3bb[_0x72f6('0x3a')]);var _0x4f32a7={'where':_0x32efea['where']};return db['OpenchannelTransferReport'][_0x72f6('0x3b')](_0x4f32a7)[_0x72f6('0x20')](function(_0x4fce86){_0x197fb9[_0x72f6('0x3b')]=_0x4fce86;if(_0x45e3bb[_0x72f6('0x2b')][_0x72f6('0x3c')]){_0x32efea[_0x72f6('0x3d')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x72f6('0x3e')](_0x32efea);})['then'](function(_0x2d6259){_0x197fb9['rows']=_0x2d6259;return _0x197fb9;})[_0x72f6('0x20')](respondWithFilteredResult(_0x55b87a,_0x32efea))[_0x72f6('0x3f')](handleError(_0x55b87a,null));};exports['show']=function(_0x45f658,_0x4e4d3a){var _0x95cd9c={'raw':!![],'where':{'id':_0x45f658['params']['id']}},_0x34dfcf={};_0x34dfcf[_0x72f6('0x2e')]=_[_0x72f6('0x2a')](db[_0x72f6('0x26')][_0x72f6('0x27')]);_0x34dfcf[_0x72f6('0x2b')]=_['keys'](_0x45f658[_0x72f6('0x2b')]);_0x34dfcf['filters']=_['intersection'](_0x34dfcf[_0x72f6('0x2e')],_0x34dfcf['query']);_0x95cd9c[_0x72f6('0x2f')]=_['intersection'](_0x34dfcf[_0x72f6('0x2e')],qs['fields'](_0x45f658[_0x72f6('0x2b')][_0x72f6('0x30')]));_0x95cd9c[_0x72f6('0x2f')]=_0x95cd9c[_0x72f6('0x2f')]['length']?_0x95cd9c['attributes']:_0x34dfcf[_0x72f6('0x2e')];if(_0x45f658[_0x72f6('0x2b')][_0x72f6('0x3c')]){_0x95cd9c[_0x72f6('0x3d')]=[{'all':!![]}];}_0x95cd9c=_['merge']({},_0x95cd9c,_0x45f658[_0x72f6('0x3a')]);return db['OpenchannelTransferReport'][_0x72f6('0x40')](_0x95cd9c)[_0x72f6('0x20')](handleEntityNotFound(_0x4e4d3a,null))[_0x72f6('0x20')](respondWithResult(_0x4e4d3a,null))[_0x72f6('0x3f')](handleError(_0x4e4d3a,null));};exports[_0x72f6('0x41')]=function(_0x6c17d8,_0x4aa624){return db[_0x72f6('0x26')][_0x72f6('0x41')](_0x6c17d8[_0x72f6('0x42')],{})['then'](respondWithResult(_0x4aa624,0xc9))['catch'](handleError(_0x4aa624,null));};exports['update']=function(_0x5d157b,_0x4179fd){if(_0x5d157b[_0x72f6('0x42')]['id']){delete _0x5d157b[_0x72f6('0x42')]['id'];}return db[_0x72f6('0x26')]['find']({'where':{'id':_0x5d157b['params']['id']}})[_0x72f6('0x20')](handleEntityNotFound(_0x4179fd,null))[_0x72f6('0x20')](saveUpdates(_0x5d157b['body'],null))[_0x72f6('0x20')](respondWithResult(_0x4179fd,null))[_0x72f6('0x3f')](handleError(_0x4179fd,null));};exports[_0x72f6('0x1f')]=function(_0x5b1d83,_0x3ab522){return db['OpenchannelTransferReport'][_0x72f6('0x40')]({'where':{'id':_0x5b1d83[_0x72f6('0x43')]['id']}})[_0x72f6('0x20')](handleEntityNotFound(_0x3ab522,null))['then'](removeEntity(_0x3ab522,null))[_0x72f6('0x3f')](handleError(_0x3ab522,null));};exports[_0x72f6('0x44')]=function(_0x285ebc,_0x5da755){return db['OpenchannelTransferReport'][_0x72f6('0x44')]()['then'](respondWithResult(_0x5da755,null))['catch'](handleError(_0x5da755,null));};
\ No newline at end of file
+var _0x864f=['path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','end','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','length','order','sort','where','pick','merge','filter','options','includeAll','rows','show','params','keys','fields','include','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util'];(function(_0x2e9a06,_0x3d0b26){var _0x4a3e10=function(_0x4f8100){while(--_0x4f8100){_0x2e9a06['push'](_0x2e9a06['shift']());}};_0x4a3e10(++_0x3d0b26);}(_0x864f,0xd4));var _0xf864=function(_0x2d5915,_0x1aec02){_0x2d5915=_0x2d5915-0x0;var _0x3772b6=_0x864f[_0x2d5915];return _0x3772b6;};'use strict';var emlformat=require(_0xf864('0x0'));var rimraf=require(_0xf864('0x1'));var zipdir=require(_0xf864('0x2'));var jsonpatch=require(_0xf864('0x3'));var rp=require('request-promise');var moment=require(_0xf864('0x4'));var BPromise=require(_0xf864('0x5'));var Mustache=require('mustache');var util=require(_0xf864('0x6'));var path=require(_0xf864('0x7'));var sox=require(_0xf864('0x8'));var csv=require(_0xf864('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf864('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf864('0xb'));var jsforce=require(_0xf864('0xc'));var deskjs=require(_0xf864('0xd'));var toCsv=require(_0xf864('0x9'));var querystring=require(_0xf864('0xe'));var Papa=require('papaparse');var Redis=require(_0xf864('0xf'));var authService=require(_0xf864('0x10'));var qs=require(_0xf864('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf864('0x12'));var logger=require(_0xf864('0x13'))('api');var utils=require(_0xf864('0x14'));var config=require(_0xf864('0x15'));var licenseUtil=require(_0xf864('0x16'));var db=require(_0xf864('0x17'))['db'];function respondWithStatusCode(_0x95e132,_0x65163b){_0x65163b=_0x65163b||0xcc;return function(_0x568551){if(_0x568551){return _0x95e132[_0xf864('0x18')](_0x65163b);}return _0x95e132[_0xf864('0x19')](_0x65163b)['end']();};}function respondWithResult(_0x4c7140,_0x230dcc){_0x230dcc=_0x230dcc||0xc8;return function(_0x2ae283){if(_0x2ae283){return _0x4c7140[_0xf864('0x19')](_0x230dcc)[_0xf864('0x1a')](_0x2ae283);}};}function respondWithFilteredResult(_0x3923dc,_0x1db9e8){return function(_0x1150b3){if(_0x1150b3){var _0x2c5ec7=typeof _0x1db9e8[_0xf864('0x1b')]===_0xf864('0x1c')&&typeof _0x1db9e8[_0xf864('0x1d')]===_0xf864('0x1c');var _0x508361=_0x1150b3[_0xf864('0x1e')];var _0x1c1955=_0x2c5ec7?0x0:_0x1db9e8[_0xf864('0x1b')];var _0x24fb19=_0x2c5ec7?_0x1150b3[_0xf864('0x1e')]:_0x1db9e8[_0xf864('0x1b')]+_0x1db9e8[_0xf864('0x1d')];var _0x37b076;if(_0x24fb19>=_0x508361){_0x24fb19=_0x508361;_0x37b076=0xc8;}else{_0x37b076=0xce;}_0x3923dc[_0xf864('0x19')](_0x37b076);return _0x3923dc[_0xf864('0x1f')](_0xf864('0x20'),_0x1c1955+'-'+_0x24fb19+'/'+_0x508361)[_0xf864('0x1a')](_0x1150b3);}return null;};}function patchUpdates(_0x53c361){return function(_0x4ff75b){try{jsonpatch['apply'](_0x4ff75b,_0x53c361,!![]);}catch(_0x5a6c9a){return BPromise['reject'](_0x5a6c9a);}return _0x4ff75b[_0xf864('0x21')]();};}function saveUpdates(_0x5163f4,_0x583d80){return function(_0x35f5c5){if(_0x35f5c5){return _0x35f5c5[_0xf864('0x22')](_0x5163f4)['then'](function(_0x5500c4){return _0x5500c4;});}return null;};}function removeEntity(_0x2e972b,_0x1df2ad){return function(_0x3ef33d){if(_0x3ef33d){return _0x3ef33d['destroy']()[_0xf864('0x23')](function(){_0x2e972b[_0xf864('0x19')](0xcc)[_0xf864('0x24')]();});}};}function handleEntityNotFound(_0xc5ec46,_0x38a274){return function(_0x4f0864){if(!_0x4f0864){_0xc5ec46['sendStatus'](0x194);}return _0x4f0864;};}function handleError(_0x2ecb8d,_0x5a7501){_0x5a7501=_0x5a7501||0x1f4;return function(_0x7d75e0){logger[_0xf864('0x25')](_0x7d75e0[_0xf864('0x26')]);if(_0x7d75e0[_0xf864('0x27')]){delete _0x7d75e0[_0xf864('0x27')];}_0x2ecb8d[_0xf864('0x19')](_0x5a7501)[_0xf864('0x28')](_0x7d75e0);};}exports[_0xf864('0x29')]=function(_0x82b790,_0x251230){var _0x52e507={},_0x251cc6={},_0x315888={'count':0x0,'rows':[]};var _0x19d00f=_[_0xf864('0x2a')](db[_0xf864('0x2b')][_0xf864('0x2c')],function(_0x2e2984){return{'name':_0x2e2984[_0xf864('0x2d')],'type':_0x2e2984[_0xf864('0x2e')][_0xf864('0x2f')]};});_0x251cc6[_0xf864('0x30')]=_[_0xf864('0x2a')](_0x19d00f,'name');_0x251cc6['query']=_['keys'](_0x82b790['query']);_0x251cc6[_0xf864('0x31')]=_[_0xf864('0x32')](_0x251cc6[_0xf864('0x30')],_0x251cc6[_0xf864('0x33')]);_0x52e507['attributes']=_[_0xf864('0x32')](_0x251cc6[_0xf864('0x30')],qs['fields'](_0x82b790['query']['fields']));_0x52e507[_0xf864('0x34')]=_0x52e507[_0xf864('0x34')][_0xf864('0x35')]?_0x52e507[_0xf864('0x34')]:_0x251cc6['model'];if(!_0x82b790[_0xf864('0x33')]['hasOwnProperty']('nolimit')){_0x52e507[_0xf864('0x1d')]=qs['limit'](_0x82b790[_0xf864('0x33')][_0xf864('0x1d')]);_0x52e507['offset']=qs[_0xf864('0x1b')](_0x82b790[_0xf864('0x33')][_0xf864('0x1b')]);}_0x52e507[_0xf864('0x36')]=qs[_0xf864('0x37')](_0x82b790[_0xf864('0x33')]['sort']);_0x52e507[_0xf864('0x38')]=qs[_0xf864('0x31')](_[_0xf864('0x39')](_0x82b790[_0xf864('0x33')],_0x251cc6['filters']),_0x19d00f);if(_0x82b790['query']['filter']){_0x52e507[_0xf864('0x38')]=_[_0xf864('0x3a')](_0x52e507[_0xf864('0x38')],{'$or':_['map'](_0x19d00f,function(_0x4e9e3e){if(_0x4e9e3e[_0xf864('0x2e')]!=='VIRTUAL'){var _0x405ee2={};_0x405ee2[_0x4e9e3e[_0xf864('0x27')]]={'$like':'%'+_0x82b790['query'][_0xf864('0x3b')]+'%'};return _0x405ee2;}})});}_0x52e507=_['merge']({},_0x52e507,_0x82b790[_0xf864('0x3c')]);var _0x352152={'where':_0x52e507['where']};return db[_0xf864('0x2b')][_0xf864('0x1e')](_0x352152)[_0xf864('0x23')](function(_0x4b9e1b){_0x315888[_0xf864('0x1e')]=_0x4b9e1b;if(_0x82b790[_0xf864('0x33')][_0xf864('0x3d')]){_0x52e507['include']=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x52e507);})['then'](function(_0x4ad9e6){_0x315888[_0xf864('0x3e')]=_0x4ad9e6;return _0x315888;})[_0xf864('0x23')](respondWithFilteredResult(_0x251230,_0x52e507))['catch'](handleError(_0x251230,null));};exports[_0xf864('0x3f')]=function(_0x37215e,_0x44cbfc){var _0x2af4ad={'raw':!![],'where':{'id':_0x37215e[_0xf864('0x40')]['id']}},_0x529a62={};_0x529a62[_0xf864('0x30')]=_[_0xf864('0x41')](db[_0xf864('0x2b')][_0xf864('0x2c')]);_0x529a62[_0xf864('0x33')]=_[_0xf864('0x41')](_0x37215e[_0xf864('0x33')]);_0x529a62[_0xf864('0x31')]=_['intersection'](_0x529a62['model'],_0x529a62[_0xf864('0x33')]);_0x2af4ad['attributes']=_[_0xf864('0x32')](_0x529a62['model'],qs[_0xf864('0x42')](_0x37215e[_0xf864('0x33')][_0xf864('0x42')]));_0x2af4ad[_0xf864('0x34')]=_0x2af4ad[_0xf864('0x34')][_0xf864('0x35')]?_0x2af4ad[_0xf864('0x34')]:_0x529a62[_0xf864('0x30')];if(_0x37215e[_0xf864('0x33')][_0xf864('0x3d')]){_0x2af4ad[_0xf864('0x43')]=[{'all':!![]}];}_0x2af4ad=_[_0xf864('0x3a')]({},_0x2af4ad,_0x37215e[_0xf864('0x3c')]);return db[_0xf864('0x2b')][_0xf864('0x44')](_0x2af4ad)[_0xf864('0x23')](handleEntityNotFound(_0x44cbfc,null))['then'](respondWithResult(_0x44cbfc,null))['catch'](handleError(_0x44cbfc,null));};exports[_0xf864('0x45')]=function(_0x5f4c80,_0x4ccba6){return db['OpenchannelTransferReport']['create'](_0x5f4c80[_0xf864('0x46')],{})[_0xf864('0x23')](respondWithResult(_0x4ccba6,0xc9))['catch'](handleError(_0x4ccba6,null));};exports[_0xf864('0x22')]=function(_0x330c1a,_0x1c84c6){if(_0x330c1a[_0xf864('0x46')]['id']){delete _0x330c1a[_0xf864('0x46')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x330c1a[_0xf864('0x40')]['id']}})[_0xf864('0x23')](handleEntityNotFound(_0x1c84c6,null))['then'](saveUpdates(_0x330c1a[_0xf864('0x46')],null))['then'](respondWithResult(_0x1c84c6,null))[_0xf864('0x47')](handleError(_0x1c84c6,null));};exports['destroy']=function(_0x83acc8,_0x2717b0){return db['OpenchannelTransferReport'][_0xf864('0x44')]({'where':{'id':_0x83acc8[_0xf864('0x40')]['id']}})[_0xf864('0x23')](handleEntityNotFound(_0x2717b0,null))[_0xf864('0x23')](removeEntity(_0x2717b0,null))[_0xf864('0x47')](handleError(_0x2717b0,null));};exports[_0xf864('0x48')]=function(_0x138e0f,_0x3e11e2){return db['OpenchannelTransferReport'][_0xf864('0x48')]()[_0xf864('0x23')](respondWithResult(_0x3e11e2,null))['catch'](handleError(_0x3e11e2,null));};
\ No newline at end of file