Built motion from commit (unavailable).|2.4.21
[motion2.git] / server / api / voiceTransferReport / voiceTransferReport.controller.js
index f85bd04..8b527ea 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4fc2=['../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','keys','filters','intersection','query','fields','length','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','attributes','includeAll','create','update','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x201d5c,_0xed7d2b){var _0x112e91=function(_0x25ae39){while(--_0x25ae39){_0x201d5c['push'](_0x201d5c['shift']());}};_0x112e91(++_0xed7d2b);}(_0x4fc2,0x111));var _0x24fc=function(_0x21aafd,_0x1f0fa6){_0x21aafd=_0x21aafd-0x0;var _0x9f2800=_0x4fc2[_0x21aafd];return _0x9f2800;};'use strict';var pdf=require(_0x24fc('0x0'));var emlformat=require(_0x24fc('0x1'));var rimraf=require(_0x24fc('0x2'));var zipdir=require(_0x24fc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24fc('0x4'));var moment=require(_0x24fc('0x5'));var BPromise=require(_0x24fc('0x6'));var Mustache=require('mustache');var util=require(_0x24fc('0x7'));var path=require(_0x24fc('0x8'));var sox=require('sox');var csv=require(_0x24fc('0x9'));var ejs=require(_0x24fc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0x9'));var querystring=require(_0x24fc('0xf'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x10'));var authService=require(_0x24fc('0x11'));var qs=require(_0x24fc('0x12'));var as=require(_0x24fc('0x13'));var hardwareService=require(_0x24fc('0x14'));var logger=require(_0x24fc('0x15'))(_0x24fc('0x16'));var utils=require(_0x24fc('0x17'));var config=require('../../config/environment');var db=require(_0x24fc('0x18'))['db'];function respondWithStatusCode(_0x1cde5d,_0x5cc65e){_0x5cc65e=_0x5cc65e||0xcc;return function(_0x306873){if(_0x306873){return _0x1cde5d[_0x24fc('0x19')](_0x5cc65e);}return _0x1cde5d[_0x24fc('0x1a')](_0x5cc65e)[_0x24fc('0x1b')]();};}function respondWithResult(_0x30f19b,_0x326276){_0x326276=_0x326276||0xc8;return function(_0x537b5c){if(_0x537b5c){return _0x30f19b[_0x24fc('0x1a')](_0x326276)[_0x24fc('0x1c')](_0x537b5c);}};}function respondWithFilteredResult(_0x2ffed3,_0x42cbe8){return function(_0x4acd36){if(_0x4acd36){var _0x2ac989=_0x4acd36[_0x24fc('0x1d')],_0x588543=_0x42cbe8[_0x24fc('0x1e')],_0x4af098=_0x42cbe8[_0x24fc('0x1e')]+_0x42cbe8['limit'],_0x3385c7;if(_0x4af098>=_0x2ac989){_0x4af098=_0x2ac989;_0x3385c7=0xc8;}else{_0x3385c7=0xce;}_0x2ffed3[_0x24fc('0x1a')](_0x3385c7);return _0x2ffed3[_0x24fc('0x1f')](_0x24fc('0x20'),_0x588543+'-'+_0x4af098+'/'+_0x2ac989)[_0x24fc('0x1c')](_0x4acd36);}return null;};}function patchUpdates(_0x4c5a43){return function(_0x5eabee){try{jsonpatch[_0x24fc('0x21')](_0x5eabee,_0x4c5a43,!![]);}catch(_0x304881){return BPromise['reject'](_0x304881);}return _0x5eabee[_0x24fc('0x22')]();};}function saveUpdates(_0x36a771,_0xbf1d6b){return function(_0x2d0e3d){if(_0x2d0e3d){return _0x2d0e3d['update'](_0x36a771)[_0x24fc('0x23')](function(_0x545939){return _0x545939;});}return null;};}function removeEntity(_0x339b50,_0x591c8f){return function(_0x3ed464){if(_0x3ed464){return _0x3ed464[_0x24fc('0x24')]()[_0x24fc('0x23')](function(){_0x339b50['status'](0xcc)[_0x24fc('0x1b')]();});}};}function handleEntityNotFound(_0x552035,_0x35a9c7){return function(_0x2bb93a){if(!_0x2bb93a){_0x552035[_0x24fc('0x19')](0x194);}return _0x2bb93a;};}function handleError(_0x34b5b2,_0x3296fc){_0x3296fc=_0x3296fc||0x1f4;return function(_0x262e11){logger[_0x24fc('0x25')](_0x262e11[_0x24fc('0x26')]);if(_0x262e11[_0x24fc('0x27')]){delete _0x262e11[_0x24fc('0x27')];}_0x34b5b2['status'](_0x3296fc)[_0x24fc('0x28')](_0x262e11);};}exports[_0x24fc('0x29')]=function(_0x3ee302,_0x5bb4c8){var _0xf2f77d={},_0x3d1ec8={},_0x35f9f9={'count':0x0,'rows':[]};var _0x290f84=_[_0x24fc('0x2a')](db[_0x24fc('0x2b')]['rawAttributes'],function(_0x240ae7){return{'name':_0x240ae7[_0x24fc('0x2c')],'type':_0x240ae7[_0x24fc('0x2d')][_0x24fc('0x2e')]};});_0x3d1ec8[_0x24fc('0x2f')]=_['map'](_0x290f84,'name');_0x3d1ec8['query']=_[_0x24fc('0x30')](_0x3ee302['query']);_0x3d1ec8[_0x24fc('0x31')]=_[_0x24fc('0x32')](_0x3d1ec8[_0x24fc('0x2f')],_0x3d1ec8[_0x24fc('0x33')]);_0xf2f77d['attributes']=_[_0x24fc('0x32')](_0x3d1ec8[_0x24fc('0x2f')],qs['fields'](_0x3ee302[_0x24fc('0x33')][_0x24fc('0x34')]));_0xf2f77d['attributes']=_0xf2f77d['attributes'][_0x24fc('0x35')]?_0xf2f77d['attributes']:_0x3d1ec8[_0x24fc('0x2f')];if(!_0x3ee302[_0x24fc('0x33')]['hasOwnProperty'](_0x24fc('0x36'))){_0xf2f77d[_0x24fc('0x37')]=qs[_0x24fc('0x37')](_0x3ee302[_0x24fc('0x33')][_0x24fc('0x37')]);_0xf2f77d[_0x24fc('0x1e')]=qs[_0x24fc('0x1e')](_0x3ee302[_0x24fc('0x33')][_0x24fc('0x1e')]);}_0xf2f77d['order']=qs[_0x24fc('0x38')](_0x3ee302[_0x24fc('0x33')][_0x24fc('0x38')]);_0xf2f77d[_0x24fc('0x39')]=qs[_0x24fc('0x31')](_['pick'](_0x3ee302['query'],_0x3d1ec8[_0x24fc('0x31')]));if(_0x3ee302['query'][_0x24fc('0x3a')]){_0xf2f77d[_0x24fc('0x39')]=_[_0x24fc('0x3b')](_0xf2f77d[_0x24fc('0x39')],{'$or':_['map'](_0x290f84,function(_0x610638){if(_0x610638['type']!==_0x24fc('0x3c')){var _0x3b8fb6={};_0x3b8fb6[_0x610638[_0x24fc('0x27')]]={'$like':'%'+_0x3ee302[_0x24fc('0x33')][_0x24fc('0x3a')]+'%'};return _0x3b8fb6;}})});}_0xf2f77d=_['merge']({},_0xf2f77d,_0x3ee302[_0x24fc('0x3d')]);var _0x3f40cd={'where':_0xf2f77d[_0x24fc('0x39')]};return db[_0x24fc('0x2b')]['count'](_0x3f40cd)[_0x24fc('0x23')](function(_0x2f0bd9){_0x35f9f9['count']=_0x2f0bd9;if(_0x3ee302[_0x24fc('0x33')]['includeAll']){_0xf2f77d[_0x24fc('0x3e')]=[{'all':!![]}];}return db[_0x24fc('0x2b')][_0x24fc('0x3f')](_0xf2f77d);})[_0x24fc('0x23')](function(_0x431189){_0x35f9f9[_0x24fc('0x40')]=_0x431189;return _0x35f9f9;})[_0x24fc('0x23')](respondWithFilteredResult(_0x5bb4c8,_0xf2f77d))[_0x24fc('0x41')](handleError(_0x5bb4c8,null));};exports['show']=function(_0x1721ea,_0x43fb6d){var _0x32f72c={'raw':!![],'where':{'id':_0x1721ea[_0x24fc('0x42')]['id']}},_0x4fee9f={};_0x4fee9f[_0x24fc('0x2f')]=_['keys'](db[_0x24fc('0x2b')][_0x24fc('0x43')]);_0x4fee9f[_0x24fc('0x33')]=_['keys'](_0x1721ea[_0x24fc('0x33')]);_0x4fee9f[_0x24fc('0x31')]=_['intersection'](_0x4fee9f[_0x24fc('0x2f')],_0x4fee9f[_0x24fc('0x33')]);_0x32f72c[_0x24fc('0x44')]=_[_0x24fc('0x32')](_0x4fee9f['model'],qs[_0x24fc('0x34')](_0x1721ea[_0x24fc('0x33')][_0x24fc('0x34')]));_0x32f72c[_0x24fc('0x44')]=_0x32f72c[_0x24fc('0x44')]['length']?_0x32f72c[_0x24fc('0x44')]:_0x4fee9f[_0x24fc('0x2f')];if(_0x1721ea[_0x24fc('0x33')][_0x24fc('0x45')]){_0x32f72c['include']=[{'all':!![]}];}_0x32f72c=_[_0x24fc('0x3b')]({},_0x32f72c,_0x1721ea[_0x24fc('0x3d')]);return db['VoiceTransferReport']['find'](_0x32f72c)[_0x24fc('0x23')](handleEntityNotFound(_0x43fb6d,null))['then'](respondWithResult(_0x43fb6d,null))['catch'](handleError(_0x43fb6d,null));};exports[_0x24fc('0x46')]=function(_0x5879c2,_0x281194){return db[_0x24fc('0x2b')][_0x24fc('0x46')](_0x5879c2['body'],{})[_0x24fc('0x23')](respondWithResult(_0x281194,0xc9))[_0x24fc('0x41')](handleError(_0x281194,null));};exports[_0x24fc('0x47')]=function(_0x1ad8d6,_0x39873d){if(_0x1ad8d6[_0x24fc('0x48')]['id']){delete _0x1ad8d6[_0x24fc('0x48')]['id'];}return db[_0x24fc('0x2b')]['find']({'where':{'id':_0x1ad8d6['params']['id']}})[_0x24fc('0x23')](handleEntityNotFound(_0x39873d,null))[_0x24fc('0x23')](saveUpdates(_0x1ad8d6[_0x24fc('0x48')],null))['then'](respondWithResult(_0x39873d,null))['catch'](handleError(_0x39873d,null));};exports[_0x24fc('0x24')]=function(_0x213439,_0x179a60){return db[_0x24fc('0x2b')][_0x24fc('0x49')]({'where':{'id':_0x213439[_0x24fc('0x42')]['id']}})[_0x24fc('0x23')](handleEntityNotFound(_0x179a60,null))[_0x24fc('0x23')](removeEntity(_0x179a60,null))[_0x24fc('0x41')](handleError(_0x179a60,null));};
\ No newline at end of file
+var _0x91a7=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','show','params','keys','includeAll','catch','create','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields'];(function(_0x52a60e,_0x345976){var _0x1c471a=function(_0xe9a3b6){while(--_0xe9a3b6){_0x52a60e['push'](_0x52a60e['shift']());}};_0x1c471a(++_0x345976);}(_0x91a7,0xe7));var _0x791a=function(_0x1b3b96,_0x5c0378){_0x1b3b96=_0x1b3b96-0x0;var _0x50f162=_0x91a7[_0x1b3b96];return _0x50f162;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x791a('0x0'));var rimraf=require(_0x791a('0x1'));var zipdir=require(_0x791a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x791a('0x3'));var moment=require('moment');var BPromise=require(_0x791a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x791a('0x5'));var sox=require(_0x791a('0x6'));var csv=require('to-csv');var ejs=require(_0x791a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0xb'));var querystring=require(_0x791a('0xc'));var Papa=require(_0x791a('0xd'));var Redis=require(_0x791a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xf'));var as=require(_0x791a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x11'))(_0x791a('0x12'));var utils=require(_0x791a('0x13'));var config=require(_0x791a('0x14'));var db=require(_0x791a('0x15'))['db'];function respondWithStatusCode(_0x3fc10a,_0x53dc41){_0x53dc41=_0x53dc41||0xcc;return function(_0x5daecd){if(_0x5daecd){return _0x3fc10a[_0x791a('0x16')](_0x53dc41);}return _0x3fc10a[_0x791a('0x17')](_0x53dc41)['end']();};}function respondWithResult(_0x346c44,_0x3a2ec6){_0x3a2ec6=_0x3a2ec6||0xc8;return function(_0x5d5b11){if(_0x5d5b11){return _0x346c44[_0x791a('0x17')](_0x3a2ec6)[_0x791a('0x18')](_0x5d5b11);}};}function respondWithFilteredResult(_0x2ef5c5,_0x5cdf2){return function(_0x55e845){if(_0x55e845){var _0x2ce2e0=_0x55e845['count'],_0x575d11=_0x5cdf2[_0x791a('0x19')],_0x43dea6=_0x5cdf2['offset']+_0x5cdf2[_0x791a('0x1a')],_0x355155;if(_0x43dea6>=_0x2ce2e0){_0x43dea6=_0x2ce2e0;_0x355155=0xc8;}else{_0x355155=0xce;}_0x2ef5c5['status'](_0x355155);return _0x2ef5c5['set']('Content-Range',_0x575d11+'-'+_0x43dea6+'/'+_0x2ce2e0)[_0x791a('0x18')](_0x55e845);}return null;};}function patchUpdates(_0x52fa43){return function(_0x4cf613){try{jsonpatch[_0x791a('0x1b')](_0x4cf613,_0x52fa43,!![]);}catch(_0x5a702e){return BPromise[_0x791a('0x1c')](_0x5a702e);}return _0x4cf613[_0x791a('0x1d')]();};}function saveUpdates(_0x5f3cec,_0x189c0d){return function(_0xcb5e66){if(_0xcb5e66){return _0xcb5e66[_0x791a('0x1e')](_0x5f3cec)[_0x791a('0x1f')](function(_0x530e32){return _0x530e32;});}return null;};}function removeEntity(_0x448085,_0x2054c6){return function(_0x25bae5){if(_0x25bae5){return _0x25bae5[_0x791a('0x20')]()[_0x791a('0x1f')](function(){_0x448085[_0x791a('0x17')](0xcc)[_0x791a('0x21')]();});}};}function handleEntityNotFound(_0x45a67d,_0x323c6a){return function(_0xe8e452){if(!_0xe8e452){_0x45a67d[_0x791a('0x16')](0x194);}return _0xe8e452;};}function handleError(_0x5e03a3,_0x1102c9){_0x1102c9=_0x1102c9||0x1f4;return function(_0x2728a0){logger[_0x791a('0x22')](_0x2728a0[_0x791a('0x23')]);if(_0x2728a0['name']){delete _0x2728a0[_0x791a('0x24')];}_0x5e03a3[_0x791a('0x17')](_0x1102c9)['send'](_0x2728a0);};}exports[_0x791a('0x25')]=function(_0x1785f5,_0x16dbaf){var _0x4c1626={},_0x29194d={},_0x2b3327={'count':0x0,'rows':[]};var _0x2b0784=_[_0x791a('0x26')](db[_0x791a('0x27')][_0x791a('0x28')],function(_0x628816){return{'name':_0x628816[_0x791a('0x29')],'type':_0x628816['type'][_0x791a('0x2a')]};});_0x29194d[_0x791a('0x2b')]=_[_0x791a('0x26')](_0x2b0784,'name');_0x29194d[_0x791a('0x2c')]=_['keys'](_0x1785f5[_0x791a('0x2c')]);_0x29194d[_0x791a('0x2d')]=_[_0x791a('0x2e')](_0x29194d[_0x791a('0x2b')],_0x29194d[_0x791a('0x2c')]);_0x4c1626[_0x791a('0x2f')]=_[_0x791a('0x2e')](_0x29194d['model'],qs[_0x791a('0x30')](_0x1785f5[_0x791a('0x2c')][_0x791a('0x30')]));_0x4c1626[_0x791a('0x2f')]=_0x4c1626[_0x791a('0x2f')]['length']?_0x4c1626[_0x791a('0x2f')]:_0x29194d[_0x791a('0x2b')];if(!_0x1785f5[_0x791a('0x2c')][_0x791a('0x31')](_0x791a('0x32'))){_0x4c1626['limit']=qs[_0x791a('0x1a')](_0x1785f5[_0x791a('0x2c')][_0x791a('0x1a')]);_0x4c1626[_0x791a('0x19')]=qs[_0x791a('0x19')](_0x1785f5['query'][_0x791a('0x19')]);}_0x4c1626['order']=qs[_0x791a('0x33')](_0x1785f5['query']['sort']);_0x4c1626[_0x791a('0x34')]=qs[_0x791a('0x2d')](_[_0x791a('0x35')](_0x1785f5[_0x791a('0x2c')],_0x29194d[_0x791a('0x2d')]));if(_0x1785f5[_0x791a('0x2c')][_0x791a('0x36')]){_0x4c1626['where']=_[_0x791a('0x37')](_0x4c1626['where'],{'$or':_[_0x791a('0x26')](_0x2b0784,function(_0x496005){if(_0x496005[_0x791a('0x38')]!==_0x791a('0x39')){var _0x4ead60={};_0x4ead60[_0x496005[_0x791a('0x24')]]={'$like':'%'+_0x1785f5[_0x791a('0x2c')]['filter']+'%'};return _0x4ead60;}})});}_0x4c1626=_[_0x791a('0x37')]({},_0x4c1626,_0x1785f5[_0x791a('0x3a')]);var _0x2861d6={'where':_0x4c1626[_0x791a('0x34')]};return db[_0x791a('0x27')][_0x791a('0x3b')](_0x2861d6)[_0x791a('0x1f')](function(_0xf223d8){_0x2b3327[_0x791a('0x3b')]=_0xf223d8;if(_0x1785f5[_0x791a('0x2c')]['includeAll']){_0x4c1626[_0x791a('0x3c')]=[{'all':!![]}];}return db[_0x791a('0x27')][_0x791a('0x3d')](_0x4c1626);})['then'](function(_0xf4e2fa){_0x2b3327['rows']=_0xf4e2fa;return _0x2b3327;})['then'](respondWithFilteredResult(_0x16dbaf,_0x4c1626))['catch'](handleError(_0x16dbaf,null));};exports[_0x791a('0x3e')]=function(_0xb88abf,_0x49b0d8){var _0x415c44={'raw':!![],'where':{'id':_0xb88abf[_0x791a('0x3f')]['id']}},_0x2d1692={};_0x2d1692[_0x791a('0x2b')]=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x2d1692[_0x791a('0x2c')]=_[_0x791a('0x40')](_0xb88abf['query']);_0x2d1692[_0x791a('0x2d')]=_[_0x791a('0x2e')](_0x2d1692[_0x791a('0x2b')],_0x2d1692[_0x791a('0x2c')]);_0x415c44['attributes']=_[_0x791a('0x2e')](_0x2d1692['model'],qs[_0x791a('0x30')](_0xb88abf[_0x791a('0x2c')][_0x791a('0x30')]));_0x415c44[_0x791a('0x2f')]=_0x415c44[_0x791a('0x2f')]['length']?_0x415c44[_0x791a('0x2f')]:_0x2d1692[_0x791a('0x2b')];if(_0xb88abf[_0x791a('0x2c')][_0x791a('0x41')]){_0x415c44[_0x791a('0x3c')]=[{'all':!![]}];}_0x415c44=_['merge']({},_0x415c44,_0xb88abf[_0x791a('0x3a')]);return db[_0x791a('0x27')]['find'](_0x415c44)['then'](handleEntityNotFound(_0x49b0d8,null))[_0x791a('0x1f')](respondWithResult(_0x49b0d8,null))[_0x791a('0x42')](handleError(_0x49b0d8,null));};exports[_0x791a('0x43')]=function(_0x5877f4,_0x5d1343){return db[_0x791a('0x27')][_0x791a('0x43')](_0x5877f4['body'],{})[_0x791a('0x1f')](respondWithResult(_0x5d1343,0xc9))[_0x791a('0x42')](handleError(_0x5d1343,null));};exports[_0x791a('0x1e')]=function(_0x549980,_0x5a30a6){if(_0x549980[_0x791a('0x44')]['id']){delete _0x549980[_0x791a('0x44')]['id'];}return db[_0x791a('0x27')][_0x791a('0x45')]({'where':{'id':_0x549980['params']['id']}})[_0x791a('0x1f')](handleEntityNotFound(_0x5a30a6,null))[_0x791a('0x1f')](saveUpdates(_0x549980[_0x791a('0x44')],null))[_0x791a('0x1f')](respondWithResult(_0x5a30a6,null))['catch'](handleError(_0x5a30a6,null));};exports[_0x791a('0x20')]=function(_0x19654d,_0xe0696b){return db[_0x791a('0x27')][_0x791a('0x45')]({'where':{'id':_0x19654d[_0x791a('0x3f')]['id']}})[_0x791a('0x1f')](handleEntityNotFound(_0xe0696b,null))['then'](removeEntity(_0xe0696b,null))[_0x791a('0x42')](handleError(_0xe0696b,null));};
\ No newline at end of file