Built motion from commit (unavailable).|2.5.27
[motion2.git] / server / api / voiceDialReport / voiceDialReport.controller.js
index 8983dd1..71dcbe5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x213f=['VoiceDialReport','intersection','length','create','body','destroy','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','then','end','rawAttributes','type','key','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','count','includeAll','include','catch','show','params'];(function(_0x2a4fe2,_0x3ec53a){var _0x225c4a=function(_0x1eccfa){while(--_0x1eccfa){_0x2a4fe2['push'](_0x2a4fe2['shift']());}};_0x225c4a(++_0x3ec53a);}(_0x213f,0x1c4));var _0xf213=function(_0xd49003,_0x2eedba){_0xd49003=_0xd49003-0x0;var _0x2a92a1=_0x213f[_0xd49003];return _0x2a92a1;};'use strict';var emlformat=require(_0xf213('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf213('0x1'));var jsonpatch=require(_0xf213('0x2'));var rp=require(_0xf213('0x3'));var moment=require(_0xf213('0x4'));var BPromise=require(_0xf213('0x5'));var Mustache=require(_0xf213('0x6'));var util=require(_0xf213('0x7'));var path=require(_0xf213('0x8'));var sox=require(_0xf213('0x9'));var csv=require(_0xf213('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf213('0xb'));var _=require(_0xf213('0xc'));var squel=require(_0xf213('0xd'));var crypto=require(_0xf213('0xe'));var jsforce=require(_0xf213('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf213('0x10'));var Papa=require(_0xf213('0x11'));var Redis=require(_0xf213('0x12'));var authService=require(_0xf213('0x13'));var qs=require(_0xf213('0x14'));var as=require(_0xf213('0x15'));var hardwareService=require(_0xf213('0x16'));var logger=require(_0xf213('0x17'))(_0xf213('0x18'));var utils=require(_0xf213('0x19'));var config=require(_0xf213('0x1a'));var licenseUtil=require(_0xf213('0x1b'));var db=require(_0xf213('0x1c'))['db'];function respondWithStatusCode(_0x58d94d,_0x136f83){_0x136f83=_0x136f83||0xcc;return function(_0x5b2df3){if(_0x5b2df3){return _0x58d94d[_0xf213('0x1d')](_0x136f83);}return _0x58d94d[_0xf213('0x1e')](_0x136f83)['end']();};}function respondWithResult(_0x2df484,_0x440028){_0x440028=_0x440028||0xc8;return function(_0x1351f5){if(_0x1351f5){return _0x2df484[_0xf213('0x1e')](_0x440028)[_0xf213('0x1f')](_0x1351f5);}};}function respondWithFilteredResult(_0x277d9b,_0x52c563){return function(_0x2f5b54){if(_0x2f5b54){var _0x4c20d0=_0x2f5b54['count'],_0x2d2600=_0x52c563['offset'],_0x14ff57=_0x52c563[_0xf213('0x20')]+_0x52c563[_0xf213('0x21')],_0x3339bb;if(_0x14ff57>=_0x4c20d0){_0x14ff57=_0x4c20d0;_0x3339bb=0xc8;}else{_0x3339bb=0xce;}_0x277d9b['status'](_0x3339bb);return _0x277d9b[_0xf213('0x22')](_0xf213('0x23'),_0x2d2600+'-'+_0x14ff57+'/'+_0x4c20d0)[_0xf213('0x1f')](_0x2f5b54);}return null;};}function patchUpdates(_0x1fe7d9){return function(_0x23f853){try{jsonpatch[_0xf213('0x24')](_0x23f853,_0x1fe7d9,!![]);}catch(_0x4215af){return BPromise[_0xf213('0x25')](_0x4215af);}return _0x23f853['save']();};}function saveUpdates(_0x25d6a7,_0x2d0c2e){return function(_0x16287d){if(_0x16287d){return _0x16287d[_0xf213('0x26')](_0x25d6a7)['then'](function(_0x437c38){return _0x437c38;});}return null;};}function removeEntity(_0x3d637b,_0x2a6f1a){return function(_0xb8884c){if(_0xb8884c){return _0xb8884c['destroy']()[_0xf213('0x27')](function(){_0x3d637b[_0xf213('0x1e')](0xcc)[_0xf213('0x28')]();});}};}function handleEntityNotFound(_0x4f6b1a,_0x14d9d3){return function(_0x536fec){if(!_0x536fec){_0x4f6b1a['sendStatus'](0x194);}return _0x536fec;};}function handleError(_0x2ae664,_0x154ade){_0x154ade=_0x154ade||0x1f4;return function(_0x39a7b2){logger['error'](_0x39a7b2['stack']);if(_0x39a7b2['name']){delete _0x39a7b2['name'];}_0x2ae664[_0xf213('0x1e')](_0x154ade)['send'](_0x39a7b2);};}exports['index']=function(_0x56de70,_0x38ee2b){var _0x1a1b27={},_0x303b8f={},_0x2df04b={'count':0x0,'rows':[]};var _0x1dda22=_['map'](db['VoiceDialReport'][_0xf213('0x29')],function(_0x11562f){return{'name':_0x11562f['fieldName'],'type':_0x11562f[_0xf213('0x2a')][_0xf213('0x2b')]};});_0x303b8f[_0xf213('0x2c')]=_['map'](_0x1dda22,'name');_0x303b8f['query']=_[_0xf213('0x2d')](_0x56de70[_0xf213('0x2e')]);_0x303b8f[_0xf213('0x2f')]=_['intersection'](_0x303b8f[_0xf213('0x2c')],_0x303b8f[_0xf213('0x2e')]);_0x1a1b27[_0xf213('0x30')]=_['intersection'](_0x303b8f[_0xf213('0x2c')],qs[_0xf213('0x31')](_0x56de70[_0xf213('0x2e')][_0xf213('0x31')]));_0x1a1b27[_0xf213('0x30')]=_0x1a1b27['attributes']['length']?_0x1a1b27[_0xf213('0x30')]:_0x303b8f[_0xf213('0x2c')];if(!_0x56de70['query'][_0xf213('0x32')](_0xf213('0x33'))){_0x1a1b27['limit']=qs['limit'](_0x56de70[_0xf213('0x2e')][_0xf213('0x21')]);_0x1a1b27[_0xf213('0x20')]=qs[_0xf213('0x20')](_0x56de70[_0xf213('0x2e')][_0xf213('0x20')]);}_0x1a1b27[_0xf213('0x34')]=qs[_0xf213('0x35')](_0x56de70[_0xf213('0x2e')]['sort']);_0x1a1b27[_0xf213('0x36')]=qs['filters'](_['pick'](_0x56de70[_0xf213('0x2e')],_0x303b8f[_0xf213('0x2f')]),_0x1dda22);if(_0x56de70[_0xf213('0x2e')][_0xf213('0x37')]){_0x1a1b27[_0xf213('0x36')]=_[_0xf213('0x38')](_0x1a1b27[_0xf213('0x36')],{'$or':_['map'](_0x1dda22,function(_0x1c674f){if(_0x1c674f[_0xf213('0x2a')]!==_0xf213('0x39')){var _0x30d9ca={};_0x30d9ca[_0x1c674f[_0xf213('0x3a')]]={'$like':'%'+_0x56de70[_0xf213('0x2e')][_0xf213('0x37')]+'%'};return _0x30d9ca;}})});}_0x1a1b27=_[_0xf213('0x38')]({},_0x1a1b27,_0x56de70[_0xf213('0x3b')]);var _0x10ad15={'where':_0x1a1b27[_0xf213('0x36')]};return db['VoiceDialReport']['count'](_0x10ad15)[_0xf213('0x27')](function(_0xb62cfa){_0x2df04b[_0xf213('0x3c')]=_0xb62cfa;if(_0x56de70['query'][_0xf213('0x3d')]){_0x1a1b27[_0xf213('0x3e')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x1a1b27);})[_0xf213('0x27')](function(_0x4bf15e){_0x2df04b['rows']=_0x4bf15e;return _0x2df04b;})[_0xf213('0x27')](respondWithFilteredResult(_0x38ee2b,_0x1a1b27))[_0xf213('0x3f')](handleError(_0x38ee2b,null));};exports[_0xf213('0x40')]=function(_0x5888e6,_0x5b510c){var _0x5e301d={'raw':!![],'where':{'id':_0x5888e6[_0xf213('0x41')]['id']}},_0x4b7b75={};_0x4b7b75[_0xf213('0x2c')]=_[_0xf213('0x2d')](db[_0xf213('0x42')][_0xf213('0x29')]);_0x4b7b75['query']=_[_0xf213('0x2d')](_0x5888e6['query']);_0x4b7b75[_0xf213('0x2f')]=_[_0xf213('0x43')](_0x4b7b75[_0xf213('0x2c')],_0x4b7b75[_0xf213('0x2e')]);_0x5e301d[_0xf213('0x30')]=_[_0xf213('0x43')](_0x4b7b75[_0xf213('0x2c')],qs[_0xf213('0x31')](_0x5888e6[_0xf213('0x2e')]['fields']));_0x5e301d['attributes']=_0x5e301d[_0xf213('0x30')][_0xf213('0x44')]?_0x5e301d['attributes']:_0x4b7b75[_0xf213('0x2c')];if(_0x5888e6['query'][_0xf213('0x3d')]){_0x5e301d['include']=[{'all':!![]}];}_0x5e301d=_[_0xf213('0x38')]({},_0x5e301d,_0x5888e6['options']);return db[_0xf213('0x42')]['find'](_0x5e301d)[_0xf213('0x27')](handleEntityNotFound(_0x5b510c,null))[_0xf213('0x27')](respondWithResult(_0x5b510c,null))['catch'](handleError(_0x5b510c,null));};exports[_0xf213('0x45')]=function(_0xc7fb75,_0x5e453f){return db[_0xf213('0x42')][_0xf213('0x45')](_0xc7fb75[_0xf213('0x46')],{})[_0xf213('0x27')](respondWithResult(_0x5e453f,0xc9))['catch'](handleError(_0x5e453f,null));};exports['update']=function(_0x23b0a1,_0x1fee66){if(_0x23b0a1[_0xf213('0x46')]['id']){delete _0x23b0a1['body']['id'];}return db[_0xf213('0x42')]['find']({'where':{'id':_0x23b0a1['params']['id']}})['then'](handleEntityNotFound(_0x1fee66,null))['then'](saveUpdates(_0x23b0a1[_0xf213('0x46')],null))[_0xf213('0x27')](respondWithResult(_0x1fee66,null))[_0xf213('0x3f')](handleError(_0x1fee66,null));};exports[_0xf213('0x47')]=function(_0xa28cc0,_0xedbcb3){return db[_0xf213('0x42')][_0xf213('0x48')]({'where':{'id':_0xa28cc0['params']['id']}})[_0xf213('0x27')](handleEntityNotFound(_0xedbcb3,null))['then'](removeEntity(_0xedbcb3,null))[_0xf213('0x3f')](handleError(_0xedbcb3,null));};exports['describe']=function(_0x2bb1f1,_0x383d3c){return db[_0xf213('0x42')][_0xf213('0x49')]()[_0xf213('0x27')](respondWithResult(_0x383d3c,null))[_0xf213('0x3f')](handleError(_0x383d3c,null));};
\ No newline at end of file
+var _0x9040=['show','params','keys','find','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','json','offset','limit','status','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','include','rows','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9040,0x1c3));var _0x0904=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9040[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x0904('0x0'));var rimraf=require(_0x0904('0x1'));var zipdir=require(_0x0904('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0904('0x3'));var moment=require(_0x0904('0x4'));var BPromise=require(_0x0904('0x5'));var Mustache=require(_0x0904('0x6'));var util=require(_0x0904('0x7'));var path=require(_0x0904('0x8'));var sox=require('sox');var csv=require(_0x0904('0x9'));var ejs=require(_0x0904('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0904('0xb'));var squel=require('squel');var crypto=require(_0x0904('0xc'));var jsforce=require(_0x0904('0xd'));var deskjs=require(_0x0904('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0904('0xf'));var Papa=require('papaparse');var Redis=require(_0x0904('0x10'));var authService=require(_0x0904('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0904('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0904('0x13'))(_0x0904('0x14'));var utils=require(_0x0904('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0904('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15d1f2,_0x561812){_0x561812=_0x561812||0xcc;return function(_0x362115){if(_0x362115){return _0x15d1f2['sendStatus'](_0x561812);}return _0x15d1f2['status'](_0x561812)['end']();};}function respondWithResult(_0x1d914b,_0x477666){_0x477666=_0x477666||0xc8;return function(_0x5006a2){if(_0x5006a2){return _0x1d914b['status'](_0x477666)[_0x0904('0x17')](_0x5006a2);}};}function respondWithFilteredResult(_0x224fb3,_0x85d6d){return function(_0x5dfc9b){if(_0x5dfc9b){var _0x5b6af0=_0x5dfc9b['count'],_0x4ddfab=_0x85d6d[_0x0904('0x18')],_0x39d713=_0x85d6d['offset']+_0x85d6d[_0x0904('0x19')],_0x26c01f;if(_0x39d713>=_0x5b6af0){_0x39d713=_0x5b6af0;_0x26c01f=0xc8;}else{_0x26c01f=0xce;}_0x224fb3[_0x0904('0x1a')](_0x26c01f);return _0x224fb3['set'](_0x0904('0x1b'),_0x4ddfab+'-'+_0x39d713+'/'+_0x5b6af0)[_0x0904('0x17')](_0x5dfc9b);}return null;};}function patchUpdates(_0x481f5e){return function(_0x2140e6){try{jsonpatch[_0x0904('0x1c')](_0x2140e6,_0x481f5e,!![]);}catch(_0x294677){return BPromise[_0x0904('0x1d')](_0x294677);}return _0x2140e6[_0x0904('0x1e')]();};}function saveUpdates(_0x33fa04,_0x5d1bba){return function(_0x4ca504){if(_0x4ca504){return _0x4ca504[_0x0904('0x1f')](_0x33fa04)[_0x0904('0x20')](function(_0x3865c6){return _0x3865c6;});}return null;};}function removeEntity(_0x402afb,_0xbdad73){return function(_0x1bf8eb){if(_0x1bf8eb){return _0x1bf8eb['destroy']()[_0x0904('0x20')](function(){_0x402afb[_0x0904('0x1a')](0xcc)[_0x0904('0x21')]();});}};}function handleEntityNotFound(_0xdf8fd1,_0x1d213f){return function(_0x3f967c){if(!_0x3f967c){_0xdf8fd1[_0x0904('0x22')](0x194);}return _0x3f967c;};}function handleError(_0x189b04,_0x1b7a00){_0x1b7a00=_0x1b7a00||0x1f4;return function(_0x419ec7){logger[_0x0904('0x23')](_0x419ec7[_0x0904('0x24')]);if(_0x419ec7['name']){delete _0x419ec7[_0x0904('0x25')];}_0x189b04[_0x0904('0x1a')](_0x1b7a00)[_0x0904('0x26')](_0x419ec7);};}exports[_0x0904('0x27')]=function(_0x5034da,_0x36ca8b){var _0x3ef998={},_0x4ef497={},_0x31164d={'count':0x0,'rows':[]};var _0x4bebc8=_[_0x0904('0x28')](db[_0x0904('0x29')][_0x0904('0x2a')],function(_0xd5efc0){return{'name':_0xd5efc0[_0x0904('0x2b')],'type':_0xd5efc0[_0x0904('0x2c')][_0x0904('0x2d')]};});_0x4ef497[_0x0904('0x2e')]=_[_0x0904('0x28')](_0x4bebc8,_0x0904('0x25'));_0x4ef497['query']=_['keys'](_0x5034da['query']);_0x4ef497[_0x0904('0x2f')]=_[_0x0904('0x30')](_0x4ef497[_0x0904('0x2e')],_0x4ef497[_0x0904('0x31')]);_0x3ef998[_0x0904('0x32')]=_['intersection'](_0x4ef497['model'],qs['fields'](_0x5034da['query'][_0x0904('0x33')]));_0x3ef998['attributes']=_0x3ef998[_0x0904('0x32')][_0x0904('0x34')]?_0x3ef998[_0x0904('0x32')]:_0x4ef497[_0x0904('0x2e')];if(!_0x5034da[_0x0904('0x31')][_0x0904('0x35')](_0x0904('0x36'))){_0x3ef998[_0x0904('0x19')]=qs[_0x0904('0x19')](_0x5034da[_0x0904('0x31')][_0x0904('0x19')]);_0x3ef998[_0x0904('0x18')]=qs[_0x0904('0x18')](_0x5034da['query'][_0x0904('0x18')]);}_0x3ef998[_0x0904('0x37')]=qs[_0x0904('0x38')](_0x5034da[_0x0904('0x31')][_0x0904('0x38')]);_0x3ef998['where']=qs['filters'](_[_0x0904('0x39')](_0x5034da[_0x0904('0x31')],_0x4ef497[_0x0904('0x2f')]),_0x4bebc8);if(_0x5034da[_0x0904('0x31')][_0x0904('0x3a')]){_0x3ef998[_0x0904('0x3b')]=_[_0x0904('0x3c')](_0x3ef998[_0x0904('0x3b')],{'$or':_['map'](_0x4bebc8,function(_0xb922c7){if(_0xb922c7[_0x0904('0x2c')]!==_0x0904('0x3d')){var _0x3e79b8={};_0x3e79b8[_0xb922c7[_0x0904('0x25')]]={'$like':'%'+_0x5034da[_0x0904('0x31')][_0x0904('0x3a')]+'%'};return _0x3e79b8;}})});}_0x3ef998=_[_0x0904('0x3c')]({},_0x3ef998,_0x5034da[_0x0904('0x3e')]);var _0xf989c9={'where':_0x3ef998[_0x0904('0x3b')]};return db[_0x0904('0x29')][_0x0904('0x3f')](_0xf989c9)[_0x0904('0x20')](function(_0x48cd51){_0x31164d[_0x0904('0x3f')]=_0x48cd51;if(_0x5034da['query']['includeAll']){_0x3ef998[_0x0904('0x40')]=[{'all':!![]}];}return db[_0x0904('0x29')]['findAll'](_0x3ef998);})[_0x0904('0x20')](function(_0x43edba){_0x31164d[_0x0904('0x41')]=_0x43edba;return _0x31164d;})[_0x0904('0x20')](respondWithFilteredResult(_0x36ca8b,_0x3ef998))[_0x0904('0x42')](handleError(_0x36ca8b,null));};exports[_0x0904('0x43')]=function(_0x49e601,_0x188736){var _0x541eda={'raw':!![],'where':{'id':_0x49e601[_0x0904('0x44')]['id']}},_0x3e0a88={};_0x3e0a88[_0x0904('0x2e')]=_[_0x0904('0x45')](db[_0x0904('0x29')][_0x0904('0x2a')]);_0x3e0a88['query']=_[_0x0904('0x45')](_0x49e601['query']);_0x3e0a88[_0x0904('0x2f')]=_[_0x0904('0x30')](_0x3e0a88['model'],_0x3e0a88[_0x0904('0x31')]);_0x541eda['attributes']=_[_0x0904('0x30')](_0x3e0a88[_0x0904('0x2e')],qs[_0x0904('0x33')](_0x49e601[_0x0904('0x31')]['fields']));_0x541eda[_0x0904('0x32')]=_0x541eda[_0x0904('0x32')][_0x0904('0x34')]?_0x541eda[_0x0904('0x32')]:_0x3e0a88['model'];if(_0x49e601[_0x0904('0x31')]['includeAll']){_0x541eda[_0x0904('0x40')]=[{'all':!![]}];}_0x541eda=_[_0x0904('0x3c')]({},_0x541eda,_0x49e601[_0x0904('0x3e')]);return db[_0x0904('0x29')][_0x0904('0x46')](_0x541eda)['then'](handleEntityNotFound(_0x188736,null))[_0x0904('0x20')](respondWithResult(_0x188736,null))['catch'](handleError(_0x188736,null));};exports['create']=function(_0x5596f3,_0x15cb8c){return db['VoiceDialReport']['create'](_0x5596f3['body'],{})[_0x0904('0x20')](respondWithResult(_0x15cb8c,0xc9))[_0x0904('0x42')](handleError(_0x15cb8c,null));};exports[_0x0904('0x1f')]=function(_0x34bc44,_0x25b42a){if(_0x34bc44[_0x0904('0x47')]['id']){delete _0x34bc44['body']['id'];}return db[_0x0904('0x29')][_0x0904('0x46')]({'where':{'id':_0x34bc44[_0x0904('0x44')]['id']}})['then'](handleEntityNotFound(_0x25b42a,null))[_0x0904('0x20')](saveUpdates(_0x34bc44[_0x0904('0x47')],null))[_0x0904('0x20')](respondWithResult(_0x25b42a,null))[_0x0904('0x42')](handleError(_0x25b42a,null));};exports[_0x0904('0x48')]=function(_0x2a9e8b,_0xc607af){return db[_0x0904('0x29')][_0x0904('0x46')]({'where':{'id':_0x2a9e8b['params']['id']}})[_0x0904('0x20')](handleEntityNotFound(_0xc607af,null))[_0x0904('0x20')](removeEntity(_0xc607af,null))[_0x0904('0x42')](handleError(_0xc607af,null));};exports[_0x0904('0x49')]=function(_0x1a8ce0,_0x45afb7){return db[_0x0904('0x29')][_0x0904('0x49')]()[_0x0904('0x20')](respondWithResult(_0x45afb7,null))['catch'](handleError(_0x45afb7,null));};
\ No newline at end of file