Built motion from commit (unavailable).|2.5.6
[motion2.git] / server / api / voiceDialReport / voiceDialReport.controller.js
index 6603774..ae2eb98 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x220b=['merge','create','body','find','destroy','describe','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','fieldName','type','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','options','VoiceDialReport','includeAll','rows','show','params','keys','rawAttributes','include'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x220b,0x1b7));var _0xb220=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0x220b[_0x368e09];return _0x14b7df;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb220('0x0'));var rimraf=require(_0xb220('0x1'));var zipdir=require(_0xb220('0x2'));var jsonpatch=require(_0xb220('0x3'));var rp=require(_0xb220('0x4'));var moment=require(_0xb220('0x5'));var BPromise=require(_0xb220('0x6'));var Mustache=require(_0xb220('0x7'));var util=require(_0xb220('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb220('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb220('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb220('0xb'));var toCsv=require(_0xb220('0xc'));var querystring=require(_0xb220('0xd'));var Papa=require(_0xb220('0xe'));var Redis=require('ioredis');var authService=require(_0xb220('0xf'));var qs=require(_0xb220('0x10'));var as=require(_0xb220('0x11'));var hardwareService=require(_0xb220('0x12'));var logger=require(_0xb220('0x13'))(_0xb220('0x14'));var utils=require('../../config/utils');var config=require(_0xb220('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bf077,_0x125cdd){_0x125cdd=_0x125cdd||0xcc;return function(_0x2ebd81){if(_0x2ebd81){return _0x1bf077[_0xb220('0x16')](_0x125cdd);}return _0x1bf077['status'](_0x125cdd)['end']();};}function respondWithResult(_0x184b3b,_0x3ce43b){_0x3ce43b=_0x3ce43b||0xc8;return function(_0x1d3998){if(_0x1d3998){return _0x184b3b[_0xb220('0x17')](_0x3ce43b)[_0xb220('0x18')](_0x1d3998);}};}function respondWithFilteredResult(_0x2effae,_0x1ce434){return function(_0x582cb2){if(_0x582cb2){var _0x16f51c=_0x582cb2[_0xb220('0x19')],_0x1f48c2=_0x1ce434[_0xb220('0x1a')],_0x1386d1=_0x1ce434[_0xb220('0x1a')]+_0x1ce434[_0xb220('0x1b')],_0x286e60;if(_0x1386d1>=_0x16f51c){_0x1386d1=_0x16f51c;_0x286e60=0xc8;}else{_0x286e60=0xce;}_0x2effae[_0xb220('0x17')](_0x286e60);return _0x2effae[_0xb220('0x1c')](_0xb220('0x1d'),_0x1f48c2+'-'+_0x1386d1+'/'+_0x16f51c)[_0xb220('0x18')](_0x582cb2);}return null;};}function patchUpdates(_0x40716e){return function(_0x2c048c){try{jsonpatch['apply'](_0x2c048c,_0x40716e,!![]);}catch(_0x2131f1){return BPromise[_0xb220('0x1e')](_0x2131f1);}return _0x2c048c[_0xb220('0x1f')]();};}function saveUpdates(_0x12d49f,_0x54772e){return function(_0x55813f){if(_0x55813f){return _0x55813f[_0xb220('0x20')](_0x12d49f)[_0xb220('0x21')](function(_0xc338ff){return _0xc338ff;});}return null;};}function removeEntity(_0x40446e,_0x79e178){return function(_0x52e88e){if(_0x52e88e){return _0x52e88e['destroy']()[_0xb220('0x21')](function(){_0x40446e[_0xb220('0x17')](0xcc)[_0xb220('0x22')]();});}};}function handleEntityNotFound(_0x260ff6,_0x2d3def){return function(_0xa01c26){if(!_0xa01c26){_0x260ff6[_0xb220('0x16')](0x194);}return _0xa01c26;};}function handleError(_0x3ebc74,_0x547948){_0x547948=_0x547948||0x1f4;return function(_0xe9cb7f){logger[_0xb220('0x23')](_0xe9cb7f[_0xb220('0x24')]);if(_0xe9cb7f[_0xb220('0x25')]){delete _0xe9cb7f[_0xb220('0x25')];}_0x3ebc74[_0xb220('0x17')](_0x547948)[_0xb220('0x26')](_0xe9cb7f);};}exports[_0xb220('0x27')]=function(_0x1bec4a,_0x461c79){var _0xbd998f={},_0x3a9650={},_0x4df143={'count':0x0,'rows':[]};var _0x1f2c91=_[_0xb220('0x28')](db['VoiceDialReport']['rawAttributes'],function(_0xb02654){return{'name':_0xb02654[_0xb220('0x29')],'type':_0xb02654[_0xb220('0x2a')]['key']};});_0x3a9650[_0xb220('0x2b')]=_[_0xb220('0x28')](_0x1f2c91,_0xb220('0x25'));_0x3a9650['query']=_['keys'](_0x1bec4a['query']);_0x3a9650[_0xb220('0x2c')]=_[_0xb220('0x2d')](_0x3a9650['model'],_0x3a9650[_0xb220('0x2e')]);_0xbd998f['attributes']=_[_0xb220('0x2d')](_0x3a9650[_0xb220('0x2b')],qs[_0xb220('0x2f')](_0x1bec4a[_0xb220('0x2e')][_0xb220('0x2f')]));_0xbd998f[_0xb220('0x30')]=_0xbd998f[_0xb220('0x30')][_0xb220('0x31')]?_0xbd998f[_0xb220('0x30')]:_0x3a9650[_0xb220('0x2b')];if(!_0x1bec4a[_0xb220('0x2e')][_0xb220('0x32')]('nolimit')){_0xbd998f[_0xb220('0x1b')]=qs[_0xb220('0x1b')](_0x1bec4a[_0xb220('0x2e')][_0xb220('0x1b')]);_0xbd998f[_0xb220('0x1a')]=qs[_0xb220('0x1a')](_0x1bec4a[_0xb220('0x2e')][_0xb220('0x1a')]);}_0xbd998f[_0xb220('0x33')]=qs[_0xb220('0x34')](_0x1bec4a[_0xb220('0x2e')][_0xb220('0x34')]);_0xbd998f[_0xb220('0x35')]=qs['filters'](_[_0xb220('0x36')](_0x1bec4a['query'],_0x3a9650[_0xb220('0x2c')]),_0x1f2c91);if(_0x1bec4a[_0xb220('0x2e')][_0xb220('0x37')]){_0xbd998f[_0xb220('0x35')]=_['merge'](_0xbd998f[_0xb220('0x35')],{'$or':_[_0xb220('0x28')](_0x1f2c91,function(_0x9459fd){if(_0x9459fd['type']!=='VIRTUAL'){var _0x546825={};_0x546825[_0x9459fd['name']]={'$like':'%'+_0x1bec4a['query'][_0xb220('0x37')]+'%'};return _0x546825;}})});}_0xbd998f=_['merge']({},_0xbd998f,_0x1bec4a[_0xb220('0x38')]);var _0x4254fb={'where':_0xbd998f[_0xb220('0x35')]};return db[_0xb220('0x39')][_0xb220('0x19')](_0x4254fb)[_0xb220('0x21')](function(_0x265cc5){_0x4df143[_0xb220('0x19')]=_0x265cc5;if(_0x1bec4a[_0xb220('0x2e')][_0xb220('0x3a')]){_0xbd998f['include']=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0xbd998f);})[_0xb220('0x21')](function(_0x26a24c){_0x4df143[_0xb220('0x3b')]=_0x26a24c;return _0x4df143;})[_0xb220('0x21')](respondWithFilteredResult(_0x461c79,_0xbd998f))['catch'](handleError(_0x461c79,null));};exports[_0xb220('0x3c')]=function(_0x57eb0b,_0xb3e317){var _0x455237={'raw':!![],'where':{'id':_0x57eb0b[_0xb220('0x3d')]['id']}},_0x3c88b5={};_0x3c88b5[_0xb220('0x2b')]=_[_0xb220('0x3e')](db[_0xb220('0x39')][_0xb220('0x3f')]);_0x3c88b5[_0xb220('0x2e')]=_[_0xb220('0x3e')](_0x57eb0b[_0xb220('0x2e')]);_0x3c88b5[_0xb220('0x2c')]=_[_0xb220('0x2d')](_0x3c88b5[_0xb220('0x2b')],_0x3c88b5[_0xb220('0x2e')]);_0x455237['attributes']=_['intersection'](_0x3c88b5[_0xb220('0x2b')],qs[_0xb220('0x2f')](_0x57eb0b[_0xb220('0x2e')][_0xb220('0x2f')]));_0x455237[_0xb220('0x30')]=_0x455237[_0xb220('0x30')][_0xb220('0x31')]?_0x455237['attributes']:_0x3c88b5['model'];if(_0x57eb0b['query'][_0xb220('0x3a')]){_0x455237[_0xb220('0x40')]=[{'all':!![]}];}_0x455237=_[_0xb220('0x41')]({},_0x455237,_0x57eb0b['options']);return db[_0xb220('0x39')]['find'](_0x455237)['then'](handleEntityNotFound(_0xb3e317,null))['then'](respondWithResult(_0xb3e317,null))['catch'](handleError(_0xb3e317,null));};exports[_0xb220('0x42')]=function(_0xa89aa5,_0x3fa22e){return db['VoiceDialReport'][_0xb220('0x42')](_0xa89aa5['body'],{})['then'](respondWithResult(_0x3fa22e,0xc9))['catch'](handleError(_0x3fa22e,null));};exports[_0xb220('0x20')]=function(_0x48e737,_0x511887){if(_0x48e737[_0xb220('0x43')]['id']){delete _0x48e737[_0xb220('0x43')]['id'];}return db[_0xb220('0x39')][_0xb220('0x44')]({'where':{'id':_0x48e737['params']['id']}})[_0xb220('0x21')](handleEntityNotFound(_0x511887,null))[_0xb220('0x21')](saveUpdates(_0x48e737[_0xb220('0x43')],null))[_0xb220('0x21')](respondWithResult(_0x511887,null))['catch'](handleError(_0x511887,null));};exports[_0xb220('0x45')]=function(_0x324138,_0x27b327){return db[_0xb220('0x39')]['find']({'where':{'id':_0x324138[_0xb220('0x3d')]['id']}})['then'](handleEntityNotFound(_0x27b327,null))[_0xb220('0x21')](removeEntity(_0x27b327,null))['catch'](handleError(_0x27b327,null));};exports[_0xb220('0x46')]=function(_0x34867d,_0x13ce0e){return db['VoiceDialReport'][_0xb220('0x46')]()['then'](respondWithResult(_0x13ce0e,null))[_0xb220('0x47')](handleError(_0x13ce0e,null));};
\ No newline at end of file
+var _0x508f=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','name','send','VoiceDialReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','include','find','catch','create','update','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x508f,0x162));var _0xf508=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x508f[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0xf508('0x0'));var emlformat=require(_0xf508('0x1'));var rimraf=require(_0xf508('0x2'));var zipdir=require(_0xf508('0x3'));var jsonpatch=require(_0xf508('0x4'));var rp=require(_0xf508('0x5'));var moment=require(_0xf508('0x6'));var BPromise=require(_0xf508('0x7'));var Mustache=require(_0xf508('0x8'));var util=require(_0xf508('0x9'));var path=require(_0xf508('0xa'));var sox=require(_0xf508('0xb'));var csv=require(_0xf508('0xc'));var ejs=require(_0xf508('0xd'));var fs=require('fs');var _=require(_0xf508('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf508('0xc'));var querystring=require('querystring');var Papa=require(_0xf508('0xf'));var Redis=require(_0xf508('0x10'));var authService=require(_0xf508('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf508('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf508('0x13'))(_0xf508('0x14'));var utils=require(_0xf508('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf508('0x16'));var db=require(_0xf508('0x17'))['db'];function respondWithStatusCode(_0x20f5e9,_0x1834bd){_0x1834bd=_0x1834bd||0xcc;return function(_0x300179){if(_0x300179){return _0x20f5e9[_0xf508('0x18')](_0x1834bd);}return _0x20f5e9[_0xf508('0x19')](_0x1834bd)[_0xf508('0x1a')]();};}function respondWithResult(_0x1013e1,_0xbe8cba){_0xbe8cba=_0xbe8cba||0xc8;return function(_0x364106){if(_0x364106){return _0x1013e1[_0xf508('0x19')](_0xbe8cba)[_0xf508('0x1b')](_0x364106);}};}function respondWithFilteredResult(_0x3063a4,_0x5b8625){return function(_0x55f6b8){if(_0x55f6b8){var _0x31bcb2=_0x55f6b8[_0xf508('0x1c')],_0x45e1c9=_0x5b8625[_0xf508('0x1d')],_0x86efbb=_0x5b8625['offset']+_0x5b8625[_0xf508('0x1e')],_0x508c3d;if(_0x86efbb>=_0x31bcb2){_0x86efbb=_0x31bcb2;_0x508c3d=0xc8;}else{_0x508c3d=0xce;}_0x3063a4[_0xf508('0x19')](_0x508c3d);return _0x3063a4[_0xf508('0x1f')](_0xf508('0x20'),_0x45e1c9+'-'+_0x86efbb+'/'+_0x31bcb2)[_0xf508('0x1b')](_0x55f6b8);}return null;};}function patchUpdates(_0x448c71){return function(_0x333ca7){try{jsonpatch[_0xf508('0x21')](_0x333ca7,_0x448c71,!![]);}catch(_0x169bef){return BPromise[_0xf508('0x22')](_0x169bef);}return _0x333ca7['save']();};}function saveUpdates(_0x54943c,_0x5eacc3){return function(_0x1b0143){if(_0x1b0143){return _0x1b0143['update'](_0x54943c)[_0xf508('0x23')](function(_0xa0b9e0){return _0xa0b9e0;});}return null;};}function removeEntity(_0x2848bf,_0x1496d1){return function(_0x386e2e){if(_0x386e2e){return _0x386e2e[_0xf508('0x24')]()[_0xf508('0x23')](function(){_0x2848bf[_0xf508('0x19')](0xcc)[_0xf508('0x1a')]();});}};}function handleEntityNotFound(_0x4e90ad,_0x135b9f){return function(_0x5e9686){if(!_0x5e9686){_0x4e90ad[_0xf508('0x18')](0x194);}return _0x5e9686;};}function handleError(_0x34d2b4,_0x3d5cdc){_0x3d5cdc=_0x3d5cdc||0x1f4;return function(_0x527bc0){logger[_0xf508('0x25')](_0x527bc0['stack']);if(_0x527bc0[_0xf508('0x26')]){delete _0x527bc0[_0xf508('0x26')];}_0x34d2b4[_0xf508('0x19')](_0x3d5cdc)[_0xf508('0x27')](_0x527bc0);};}exports['index']=function(_0x294aa6,_0x5c3762){var _0x170d7c={},_0x540fc2={},_0x53811e={'count':0x0,'rows':[]};var _0x4b1895=_['map'](db[_0xf508('0x28')][_0xf508('0x29')],function(_0x4a72f0){return{'name':_0x4a72f0['fieldName'],'type':_0x4a72f0[_0xf508('0x2a')][_0xf508('0x2b')]};});_0x540fc2[_0xf508('0x2c')]=_[_0xf508('0x2d')](_0x4b1895,_0xf508('0x26'));_0x540fc2[_0xf508('0x2e')]=_[_0xf508('0x2f')](_0x294aa6['query']);_0x540fc2[_0xf508('0x30')]=_[_0xf508('0x31')](_0x540fc2['model'],_0x540fc2[_0xf508('0x2e')]);_0x170d7c[_0xf508('0x32')]=_[_0xf508('0x31')](_0x540fc2['model'],qs[_0xf508('0x33')](_0x294aa6[_0xf508('0x2e')][_0xf508('0x33')]));_0x170d7c[_0xf508('0x32')]=_0x170d7c[_0xf508('0x32')][_0xf508('0x34')]?_0x170d7c[_0xf508('0x32')]:_0x540fc2[_0xf508('0x2c')];if(!_0x294aa6[_0xf508('0x2e')][_0xf508('0x35')]('nolimit')){_0x170d7c[_0xf508('0x1e')]=qs[_0xf508('0x1e')](_0x294aa6[_0xf508('0x2e')][_0xf508('0x1e')]);_0x170d7c[_0xf508('0x1d')]=qs[_0xf508('0x1d')](_0x294aa6[_0xf508('0x2e')][_0xf508('0x1d')]);}_0x170d7c['order']=qs[_0xf508('0x36')](_0x294aa6[_0xf508('0x2e')]['sort']);_0x170d7c[_0xf508('0x37')]=qs[_0xf508('0x30')](_[_0xf508('0x38')](_0x294aa6[_0xf508('0x2e')],_0x540fc2['filters']),_0x4b1895);if(_0x294aa6['query'][_0xf508('0x39')]){_0x170d7c['where']=_[_0xf508('0x3a')](_0x170d7c['where'],{'$or':_[_0xf508('0x2d')](_0x4b1895,function(_0x26d833){if(_0x26d833[_0xf508('0x2a')]!==_0xf508('0x3b')){var _0x324a52={};_0x324a52[_0x26d833[_0xf508('0x26')]]={'$like':'%'+_0x294aa6['query'][_0xf508('0x39')]+'%'};return _0x324a52;}})});}_0x170d7c=_[_0xf508('0x3a')]({},_0x170d7c,_0x294aa6[_0xf508('0x3c')]);var _0x9472a1={'where':_0x170d7c['where']};return db[_0xf508('0x28')][_0xf508('0x1c')](_0x9472a1)[_0xf508('0x23')](function(_0x101f37){_0x53811e[_0xf508('0x1c')]=_0x101f37;if(_0x294aa6[_0xf508('0x2e')][_0xf508('0x3d')]){_0x170d7c['include']=[{'all':!![]}];}return db[_0xf508('0x28')][_0xf508('0x3e')](_0x170d7c);})[_0xf508('0x23')](function(_0x5a9055){_0x53811e[_0xf508('0x3f')]=_0x5a9055;return _0x53811e;})[_0xf508('0x23')](respondWithFilteredResult(_0x5c3762,_0x170d7c))['catch'](handleError(_0x5c3762,null));};exports['show']=function(_0xc87b84,_0x297d9f){var _0x16b6e2={'raw':!![],'where':{'id':_0xc87b84[_0xf508('0x40')]['id']}},_0x5a39be={};_0x5a39be['model']=_[_0xf508('0x2f')](db[_0xf508('0x28')][_0xf508('0x29')]);_0x5a39be[_0xf508('0x2e')]=_[_0xf508('0x2f')](_0xc87b84[_0xf508('0x2e')]);_0x5a39be[_0xf508('0x30')]=_[_0xf508('0x31')](_0x5a39be[_0xf508('0x2c')],_0x5a39be[_0xf508('0x2e')]);_0x16b6e2[_0xf508('0x32')]=_[_0xf508('0x31')](_0x5a39be[_0xf508('0x2c')],qs['fields'](_0xc87b84['query'][_0xf508('0x33')]));_0x16b6e2[_0xf508('0x32')]=_0x16b6e2[_0xf508('0x32')][_0xf508('0x34')]?_0x16b6e2[_0xf508('0x32')]:_0x5a39be['model'];if(_0xc87b84[_0xf508('0x2e')][_0xf508('0x3d')]){_0x16b6e2[_0xf508('0x41')]=[{'all':!![]}];}_0x16b6e2=_[_0xf508('0x3a')]({},_0x16b6e2,_0xc87b84[_0xf508('0x3c')]);return db['VoiceDialReport'][_0xf508('0x42')](_0x16b6e2)[_0xf508('0x23')](handleEntityNotFound(_0x297d9f,null))[_0xf508('0x23')](respondWithResult(_0x297d9f,null))[_0xf508('0x43')](handleError(_0x297d9f,null));};exports[_0xf508('0x44')]=function(_0x275850,_0x4a8b1a){return db[_0xf508('0x28')]['create'](_0x275850['body'],{})[_0xf508('0x23')](respondWithResult(_0x4a8b1a,0xc9))['catch'](handleError(_0x4a8b1a,null));};exports[_0xf508('0x45')]=function(_0x16a74d,_0x5ebdf8){if(_0x16a74d[_0xf508('0x46')]['id']){delete _0x16a74d[_0xf508('0x46')]['id'];}return db[_0xf508('0x28')]['find']({'where':{'id':_0x16a74d['params']['id']}})[_0xf508('0x23')](handleEntityNotFound(_0x5ebdf8,null))[_0xf508('0x23')](saveUpdates(_0x16a74d['body'],null))['then'](respondWithResult(_0x5ebdf8,null))[_0xf508('0x43')](handleError(_0x5ebdf8,null));};exports['destroy']=function(_0x4dbb9f,_0xa4b196){return db[_0xf508('0x28')][_0xf508('0x42')]({'where':{'id':_0x4dbb9f[_0xf508('0x40')]['id']}})[_0xf508('0x23')](handleEntityNotFound(_0xa4b196,null))['then'](removeEntity(_0xa4b196,null))[_0xf508('0x43')](handleError(_0xa4b196,null));};exports[_0xf508('0x47')]=function(_0x5f50e3,_0x1c39d3){return db[_0xf508('0x28')][_0xf508('0x47')]()['then'](respondWithResult(_0x1c39d3,null))['catch'](handleError(_0x1c39d3,null));};
\ No newline at end of file