Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / voiceDialReport / voiceDialReport.controller.js
index b15afbd..260ee62 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x72fb=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','reject','save','then','sendStatus','error','stack','name','send','index','map','VoiceDialReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','catch','show','params','rawAttributes','find','create','body','update','destroy','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js'];(function(_0xf9d540,_0x5555e0){var _0x2d1040=function(_0x158481){while(--_0x158481){_0xf9d540['push'](_0xf9d540['shift']());}};_0x2d1040(++_0x5555e0);}(_0x72fb,0x86));var _0xb72f=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0x72fb[_0x506172];return _0x2723c0;};'use strict';var pdf=require(_0xb72f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb72f('0x1'));var jsonpatch=require(_0xb72f('0x2'));var rp=require(_0xb72f('0x3'));var moment=require(_0xb72f('0x4'));var BPromise=require(_0xb72f('0x5'));var Mustache=require(_0xb72f('0x6'));var util=require(_0xb72f('0x7'));var path=require(_0xb72f('0x8'));var sox=require(_0xb72f('0x9'));var csv=require(_0xb72f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb72f('0xb'));var crypto=require('crypto');var jsforce=require(_0xb72f('0xc'));var deskjs=require(_0xb72f('0xd'));var toCsv=require(_0xb72f('0xa'));var querystring=require(_0xb72f('0xe'));var Papa=require(_0xb72f('0xf'));var Redis=require(_0xb72f('0x10'));var authService=require(_0xb72f('0x11'));var qs=require(_0xb72f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb72f('0x13'));var logger=require(_0xb72f('0x14'))(_0xb72f('0x15'));var utils=require(_0xb72f('0x16'));var config=require(_0xb72f('0x17'));var db=require(_0xb72f('0x18'))['db'];function respondWithStatusCode(_0x2ea4ca,_0x33e695){_0x33e695=_0x33e695||0xcc;return function(_0x3737dc){if(_0x3737dc){return _0x2ea4ca['sendStatus'](_0x33e695);}return _0x2ea4ca[_0xb72f('0x19')](_0x33e695)[_0xb72f('0x1a')]();};}function respondWithResult(_0x481fda,_0x346609){_0x346609=_0x346609||0xc8;return function(_0xccc665){if(_0xccc665){return _0x481fda['status'](_0x346609)[_0xb72f('0x1b')](_0xccc665);}};}function respondWithFilteredResult(_0x190e5b,_0x1055c0){return function(_0x37df35){if(_0x37df35){var _0x3faffe=_0x37df35[_0xb72f('0x1c')],_0x19825b=_0x1055c0[_0xb72f('0x1d')],_0x299b39=_0x1055c0[_0xb72f('0x1d')]+_0x1055c0[_0xb72f('0x1e')],_0x383a61;if(_0x299b39>=_0x3faffe){_0x299b39=_0x3faffe;_0x383a61=0xc8;}else{_0x383a61=0xce;}_0x190e5b['status'](_0x383a61);return _0x190e5b[_0xb72f('0x1f')]('Content-Range',_0x19825b+'-'+_0x299b39+'/'+_0x3faffe)[_0xb72f('0x1b')](_0x37df35);}return null;};}function patchUpdates(_0x45e39d){return function(_0x13b548){try{jsonpatch['apply'](_0x13b548,_0x45e39d,!![]);}catch(_0x362e5a){return BPromise[_0xb72f('0x20')](_0x362e5a);}return _0x13b548[_0xb72f('0x21')]();};}function saveUpdates(_0x410b02,_0x9a5420){return function(_0x460f48){if(_0x460f48){return _0x460f48['update'](_0x410b02)[_0xb72f('0x22')](function(_0x287401){return _0x287401;});}return null;};}function removeEntity(_0x169aad,_0x534044){return function(_0x56334a){if(_0x56334a){return _0x56334a['destroy']()[_0xb72f('0x22')](function(){_0x169aad[_0xb72f('0x19')](0xcc)[_0xb72f('0x1a')]();});}};}function handleEntityNotFound(_0x17dfe8,_0x5c8af7){return function(_0x50fb69){if(!_0x50fb69){_0x17dfe8[_0xb72f('0x23')](0x194);}return _0x50fb69;};}function handleError(_0x31201c,_0x5e77a3){_0x5e77a3=_0x5e77a3||0x1f4;return function(_0x28209c){logger[_0xb72f('0x24')](_0x28209c[_0xb72f('0x25')]);if(_0x28209c['name']){delete _0x28209c[_0xb72f('0x26')];}_0x31201c[_0xb72f('0x19')](_0x5e77a3)[_0xb72f('0x27')](_0x28209c);};}exports[_0xb72f('0x28')]=function(_0x4081ab,_0x266561){var _0x457980={},_0x341418={},_0x1b948c={'count':0x0,'rows':[]};var _0x4e0c82=_[_0xb72f('0x29')](db[_0xb72f('0x2a')]['rawAttributes'],function(_0x144726){return{'name':_0x144726[_0xb72f('0x2b')],'type':_0x144726[_0xb72f('0x2c')][_0xb72f('0x2d')]};});_0x341418[_0xb72f('0x2e')]=_[_0xb72f('0x29')](_0x4e0c82,'name');_0x341418[_0xb72f('0x2f')]=_[_0xb72f('0x30')](_0x4081ab['query']);_0x341418['filters']=_[_0xb72f('0x31')](_0x341418[_0xb72f('0x2e')],_0x341418[_0xb72f('0x2f')]);_0x457980[_0xb72f('0x32')]=_[_0xb72f('0x31')](_0x341418[_0xb72f('0x2e')],qs[_0xb72f('0x33')](_0x4081ab['query'][_0xb72f('0x33')]));_0x457980[_0xb72f('0x32')]=_0x457980['attributes'][_0xb72f('0x34')]?_0x457980[_0xb72f('0x32')]:_0x341418[_0xb72f('0x2e')];if(!_0x4081ab[_0xb72f('0x2f')][_0xb72f('0x35')](_0xb72f('0x36'))){_0x457980[_0xb72f('0x1e')]=qs[_0xb72f('0x1e')](_0x4081ab[_0xb72f('0x2f')][_0xb72f('0x1e')]);_0x457980[_0xb72f('0x1d')]=qs['offset'](_0x4081ab[_0xb72f('0x2f')][_0xb72f('0x1d')]);}_0x457980[_0xb72f('0x37')]=qs[_0xb72f('0x38')](_0x4081ab[_0xb72f('0x2f')][_0xb72f('0x38')]);_0x457980[_0xb72f('0x39')]=qs[_0xb72f('0x3a')](_['pick'](_0x4081ab[_0xb72f('0x2f')],_0x341418[_0xb72f('0x3a')]));if(_0x4081ab[_0xb72f('0x2f')][_0xb72f('0x3b')]){_0x457980['where']=_[_0xb72f('0x3c')](_0x457980[_0xb72f('0x39')],{'$or':_[_0xb72f('0x29')](_0x4e0c82,function(_0x129567){if(_0x129567['type']!=='VIRTUAL'){var _0x124375={};_0x124375[_0x129567[_0xb72f('0x26')]]={'$like':'%'+_0x4081ab[_0xb72f('0x2f')][_0xb72f('0x3b')]+'%'};return _0x124375;}})});}_0x457980=_[_0xb72f('0x3c')]({},_0x457980,_0x4081ab[_0xb72f('0x3d')]);var _0x35ee1a={'where':_0x457980[_0xb72f('0x39')]};return db[_0xb72f('0x2a')][_0xb72f('0x1c')](_0x35ee1a)[_0xb72f('0x22')](function(_0x40db3){_0x1b948c[_0xb72f('0x1c')]=_0x40db3;if(_0x4081ab[_0xb72f('0x2f')][_0xb72f('0x3e')]){_0x457980[_0xb72f('0x3f')]=[{'all':!![]}];}return db[_0xb72f('0x2a')]['findAll'](_0x457980);})['then'](function(_0x32e3d7){_0x1b948c['rows']=_0x32e3d7;return _0x1b948c;})[_0xb72f('0x22')](respondWithFilteredResult(_0x266561,_0x457980))[_0xb72f('0x40')](handleError(_0x266561,null));};exports[_0xb72f('0x41')]=function(_0x217501,_0x15ea68){var _0x2fd8d8={'raw':!![],'where':{'id':_0x217501[_0xb72f('0x42')]['id']}},_0x3ccdb0={};_0x3ccdb0[_0xb72f('0x2e')]=_['keys'](db[_0xb72f('0x2a')][_0xb72f('0x43')]);_0x3ccdb0[_0xb72f('0x2f')]=_[_0xb72f('0x30')](_0x217501[_0xb72f('0x2f')]);_0x3ccdb0['filters']=_[_0xb72f('0x31')](_0x3ccdb0[_0xb72f('0x2e')],_0x3ccdb0['query']);_0x2fd8d8[_0xb72f('0x32')]=_[_0xb72f('0x31')](_0x3ccdb0[_0xb72f('0x2e')],qs['fields'](_0x217501[_0xb72f('0x2f')]['fields']));_0x2fd8d8['attributes']=_0x2fd8d8[_0xb72f('0x32')][_0xb72f('0x34')]?_0x2fd8d8[_0xb72f('0x32')]:_0x3ccdb0['model'];if(_0x217501[_0xb72f('0x2f')][_0xb72f('0x3e')]){_0x2fd8d8[_0xb72f('0x3f')]=[{'all':!![]}];}_0x2fd8d8=_[_0xb72f('0x3c')]({},_0x2fd8d8,_0x217501[_0xb72f('0x3d')]);return db[_0xb72f('0x2a')][_0xb72f('0x44')](_0x2fd8d8)[_0xb72f('0x22')](handleEntityNotFound(_0x15ea68,null))['then'](respondWithResult(_0x15ea68,null))[_0xb72f('0x40')](handleError(_0x15ea68,null));};exports[_0xb72f('0x45')]=function(_0x5c5bd1,_0x32d46c){return db['VoiceDialReport']['create'](_0x5c5bd1[_0xb72f('0x46')],{})[_0xb72f('0x22')](respondWithResult(_0x32d46c,0xc9))[_0xb72f('0x40')](handleError(_0x32d46c,null));};exports[_0xb72f('0x47')]=function(_0x12d31e,_0x2e38ca){if(_0x12d31e[_0xb72f('0x46')]['id']){delete _0x12d31e[_0xb72f('0x46')]['id'];}return db[_0xb72f('0x2a')][_0xb72f('0x44')]({'where':{'id':_0x12d31e['params']['id']}})[_0xb72f('0x22')](handleEntityNotFound(_0x2e38ca,null))['then'](saveUpdates(_0x12d31e['body'],null))['then'](respondWithResult(_0x2e38ca,null))['catch'](handleError(_0x2e38ca,null));};exports[_0xb72f('0x48')]=function(_0xd1a59d,_0x152f38){return db[_0xb72f('0x2a')][_0xb72f('0x44')]({'where':{'id':_0xd1a59d['params']['id']}})[_0xb72f('0x22')](handleEntityNotFound(_0x152f38,null))['then'](removeEntity(_0x152f38,null))['catch'](handleError(_0x152f38,null));};exports['describe']=function(_0x4458ea,_0x172f7a){return db[_0xb72f('0x2a')][_0xb72f('0x49')]()[_0xb72f('0x22')](respondWithResult(_0x172f7a,null))[_0xb72f('0x40')](handleError(_0x172f7a,null));};
\ No newline at end of file
+var _0x7110=['map','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','VoiceDialReport','findAll','rows','catch','show','params','keys','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index'];(function(_0x152ca2,_0x5abd1b){var _0x58fbd2=function(_0x128b08){while(--_0x128b08){_0x152ca2['push'](_0x152ca2['shift']());}};_0x58fbd2(++_0x5abd1b);}(_0x7110,0x104));var _0x0711=function(_0x2bcb3a,_0x533554){_0x2bcb3a=_0x2bcb3a-0x0;var _0x51688a=_0x7110[_0x2bcb3a];return _0x51688a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0711('0x0'));var jsonpatch=require(_0x0711('0x1'));var rp=require(_0x0711('0x2'));var moment=require(_0x0711('0x3'));var BPromise=require(_0x0711('0x4'));var Mustache=require(_0x0711('0x5'));var util=require(_0x0711('0x6'));var path=require(_0x0711('0x7'));var sox=require('sox');var csv=require(_0x0711('0x8'));var ejs=require(_0x0711('0x9'));var fs=require('fs');var fs_extra=require(_0x0711('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0711('0xb'));var jsforce=require(_0x0711('0xc'));var deskjs=require(_0x0711('0xd'));var toCsv=require(_0x0711('0x8'));var querystring=require(_0x0711('0xe'));var Papa=require(_0x0711('0xf'));var Redis=require(_0x0711('0x10'));var authService=require(_0x0711('0x11'));var qs=require(_0x0711('0x12'));var as=require(_0x0711('0x13'));var hardwareService=require(_0x0711('0x14'));var logger=require(_0x0711('0x15'))(_0x0711('0x16'));var utils=require(_0x0711('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0711('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8fea0a,_0x20a585){_0x20a585=_0x20a585||0xcc;return function(_0x2b8c81){if(_0x2b8c81){return _0x8fea0a[_0x0711('0x19')](_0x20a585);}return _0x8fea0a[_0x0711('0x1a')](_0x20a585)[_0x0711('0x1b')]();};}function respondWithResult(_0x1c97b4,_0x39c808){_0x39c808=_0x39c808||0xc8;return function(_0x25a75a){if(_0x25a75a){return _0x1c97b4[_0x0711('0x1a')](_0x39c808)[_0x0711('0x1c')](_0x25a75a);}};}function respondWithFilteredResult(_0x1271b2,_0x66cb3d){return function(_0x33d98d){if(_0x33d98d){var _0x514dc8=typeof _0x66cb3d['offset']===_0x0711('0x1d')&&typeof _0x66cb3d[_0x0711('0x1e')]===_0x0711('0x1d');var _0x34e678=_0x33d98d[_0x0711('0x1f')];var _0x389649=_0x514dc8?0x0:_0x66cb3d[_0x0711('0x20')];var _0x14c320=_0x514dc8?_0x33d98d[_0x0711('0x1f')]:_0x66cb3d[_0x0711('0x20')]+_0x66cb3d[_0x0711('0x1e')];var _0x40102d;if(_0x14c320>=_0x34e678){_0x14c320=_0x34e678;_0x40102d=0xc8;}else{_0x40102d=0xce;}_0x1271b2[_0x0711('0x1a')](_0x40102d);return _0x1271b2[_0x0711('0x21')](_0x0711('0x22'),_0x389649+'-'+_0x14c320+'/'+_0x34e678)[_0x0711('0x1c')](_0x33d98d);}return null;};}function patchUpdates(_0x1c98d3){return function(_0x3fc6b1){try{jsonpatch[_0x0711('0x23')](_0x3fc6b1,_0x1c98d3,!![]);}catch(_0x32e0d0){return BPromise[_0x0711('0x24')](_0x32e0d0);}return _0x3fc6b1['save']();};}function saveUpdates(_0xac7828,_0x236e39){return function(_0x11d492){if(_0x11d492){return _0x11d492[_0x0711('0x25')](_0xac7828)[_0x0711('0x26')](function(_0x2baf9b){return _0x2baf9b;});}return null;};}function removeEntity(_0x3afb40,_0x46e986){return function(_0x212a1f){if(_0x212a1f){return _0x212a1f[_0x0711('0x27')]()[_0x0711('0x26')](function(){_0x3afb40[_0x0711('0x1a')](0xcc)[_0x0711('0x1b')]();});}};}function handleEntityNotFound(_0x3c6fdb,_0x3950bb){return function(_0xa791d0){if(!_0xa791d0){_0x3c6fdb[_0x0711('0x19')](0x194);}return _0xa791d0;};}function handleError(_0x4412b0,_0x385a53){_0x385a53=_0x385a53||0x1f4;return function(_0x372341){logger[_0x0711('0x28')](_0x372341[_0x0711('0x29')]);if(_0x372341['name']){delete _0x372341[_0x0711('0x2a')];}_0x4412b0['status'](_0x385a53)['send'](_0x372341);};}exports[_0x0711('0x2b')]=function(_0x2b6a1d,_0x39c323){var _0x49e71b={},_0x12937e={},_0x5898f9={'count':0x0,'rows':[]};var _0x5dd43d=_[_0x0711('0x2c')](db['VoiceDialReport'][_0x0711('0x2d')],function(_0x123168){return{'name':_0x123168[_0x0711('0x2e')],'type':_0x123168['type']['key']};});_0x12937e['model']=_[_0x0711('0x2c')](_0x5dd43d,_0x0711('0x2a'));_0x12937e[_0x0711('0x2f')]=_['keys'](_0x2b6a1d[_0x0711('0x2f')]);_0x12937e[_0x0711('0x30')]=_[_0x0711('0x31')](_0x12937e[_0x0711('0x32')],_0x12937e['query']);_0x49e71b[_0x0711('0x33')]=_[_0x0711('0x31')](_0x12937e[_0x0711('0x32')],qs[_0x0711('0x34')](_0x2b6a1d[_0x0711('0x2f')][_0x0711('0x34')]));_0x49e71b[_0x0711('0x33')]=_0x49e71b[_0x0711('0x33')][_0x0711('0x35')]?_0x49e71b[_0x0711('0x33')]:_0x12937e[_0x0711('0x32')];if(!_0x2b6a1d[_0x0711('0x2f')]['hasOwnProperty'](_0x0711('0x36'))){_0x49e71b[_0x0711('0x1e')]=qs[_0x0711('0x1e')](_0x2b6a1d[_0x0711('0x2f')][_0x0711('0x1e')]);_0x49e71b[_0x0711('0x20')]=qs[_0x0711('0x20')](_0x2b6a1d[_0x0711('0x2f')]['offset']);}_0x49e71b[_0x0711('0x37')]=qs['sort'](_0x2b6a1d['query'][_0x0711('0x38')]);_0x49e71b['where']=qs[_0x0711('0x30')](_['pick'](_0x2b6a1d[_0x0711('0x2f')],_0x12937e['filters']),_0x5dd43d);if(_0x2b6a1d[_0x0711('0x2f')][_0x0711('0x39')]){_0x49e71b[_0x0711('0x3a')]=_[_0x0711('0x3b')](_0x49e71b[_0x0711('0x3a')],{'$or':_[_0x0711('0x2c')](_0x5dd43d,function(_0x1860d8){if(_0x1860d8[_0x0711('0x3c')]!==_0x0711('0x3d')){var _0x2aedf2={};_0x2aedf2[_0x1860d8['name']]={'$like':'%'+_0x2b6a1d[_0x0711('0x2f')]['filter']+'%'};return _0x2aedf2;}})});}_0x49e71b=_[_0x0711('0x3b')]({},_0x49e71b,_0x2b6a1d[_0x0711('0x3e')]);var _0x4a9624={'where':_0x49e71b[_0x0711('0x3a')]};return db['VoiceDialReport'][_0x0711('0x1f')](_0x4a9624)[_0x0711('0x26')](function(_0x3031e0){_0x5898f9['count']=_0x3031e0;if(_0x2b6a1d['query'][_0x0711('0x3f')]){_0x49e71b[_0x0711('0x40')]=[{'all':!![]}];}return db[_0x0711('0x41')][_0x0711('0x42')](_0x49e71b);})[_0x0711('0x26')](function(_0x47a1ec){_0x5898f9[_0x0711('0x43')]=_0x47a1ec;return _0x5898f9;})[_0x0711('0x26')](respondWithFilteredResult(_0x39c323,_0x49e71b))[_0x0711('0x44')](handleError(_0x39c323,null));};exports[_0x0711('0x45')]=function(_0x459186,_0x4bf483){var _0x460eaa={'raw':!![],'where':{'id':_0x459186[_0x0711('0x46')]['id']}},_0x25d1da={};_0x25d1da['model']=_[_0x0711('0x47')](db[_0x0711('0x41')][_0x0711('0x2d')]);_0x25d1da[_0x0711('0x2f')]=_[_0x0711('0x47')](_0x459186[_0x0711('0x2f')]);_0x25d1da[_0x0711('0x30')]=_['intersection'](_0x25d1da[_0x0711('0x32')],_0x25d1da[_0x0711('0x2f')]);_0x460eaa[_0x0711('0x33')]=_[_0x0711('0x31')](_0x25d1da[_0x0711('0x32')],qs['fields'](_0x459186[_0x0711('0x2f')][_0x0711('0x34')]));_0x460eaa['attributes']=_0x460eaa['attributes'][_0x0711('0x35')]?_0x460eaa[_0x0711('0x33')]:_0x25d1da[_0x0711('0x32')];if(_0x459186[_0x0711('0x2f')][_0x0711('0x3f')]){_0x460eaa[_0x0711('0x40')]=[{'all':!![]}];}_0x460eaa=_[_0x0711('0x3b')]({},_0x460eaa,_0x459186['options']);return db['VoiceDialReport'][_0x0711('0x48')](_0x460eaa)['then'](handleEntityNotFound(_0x4bf483,null))[_0x0711('0x26')](respondWithResult(_0x4bf483,null))[_0x0711('0x44')](handleError(_0x4bf483,null));};exports[_0x0711('0x49')]=function(_0x22926e,_0x1d07c1){return db['VoiceDialReport'][_0x0711('0x49')](_0x22926e[_0x0711('0x4a')],{})['then'](respondWithResult(_0x1d07c1,0xc9))[_0x0711('0x44')](handleError(_0x1d07c1,null));};exports['update']=function(_0x32e9e2,_0x4ac483){if(_0x32e9e2[_0x0711('0x4a')]['id']){delete _0x32e9e2['body']['id'];}return db[_0x0711('0x41')][_0x0711('0x48')]({'where':{'id':_0x32e9e2['params']['id']}})[_0x0711('0x26')](handleEntityNotFound(_0x4ac483,null))['then'](saveUpdates(_0x32e9e2[_0x0711('0x4a')],null))[_0x0711('0x26')](respondWithResult(_0x4ac483,null))['catch'](handleError(_0x4ac483,null));};exports[_0x0711('0x27')]=function(_0x4052b8,_0x392efe){return db[_0x0711('0x41')]['find']({'where':{'id':_0x4052b8[_0x0711('0x46')]['id']}})[_0x0711('0x26')](handleEntityNotFound(_0x392efe,null))['then'](removeEntity(_0x392efe,null))['catch'](handleError(_0x392efe,null));};exports[_0x0711('0x4b')]=function(_0x570615,_0x4363ca){return db[_0x0711('0x41')][_0x0711('0x4b')]()['then'](respondWithResult(_0x4363ca,null))[_0x0711('0x44')](handleError(_0x4363ca,null));};
\ No newline at end of file