Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / voiceDialReport / voiceDialReport.controller.js
index ae2eb98..9b9e5c7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-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
+var _0x3714=['send','index','map','VoiceDialReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','include','findAll','catch','show','rawAttributes','length','includeAll','options','find','create','body','params','describe','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name'];(function(_0x23437d,_0x33d2bf){var _0x3317eb=function(_0x1b2378){while(--_0x1b2378){_0x23437d['push'](_0x23437d['shift']());}};_0x3317eb(++_0x33d2bf);}(_0x3714,0xbb));var _0x4371=function(_0x5d93fd,_0xe12f29){_0x5d93fd=_0x5d93fd-0x0;var _0x358960=_0x3714[_0x5d93fd];return _0x358960;};'use strict';var emlformat=require(_0x4371('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4371('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4371('0x2'));var moment=require(_0x4371('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4371('0x4'));var util=require(_0x4371('0x5'));var path=require(_0x4371('0x6'));var sox=require('sox');var csv=require(_0x4371('0x7'));var ejs=require(_0x4371('0x8'));var fs=require('fs');var fs_extra=require(_0x4371('0x9'));var _=require('lodash');var squel=require(_0x4371('0xa'));var crypto=require(_0x4371('0xb'));var jsforce=require(_0x4371('0xc'));var deskjs=require(_0x4371('0xd'));var toCsv=require(_0x4371('0x7'));var querystring=require(_0x4371('0xe'));var Papa=require('papaparse');var Redis=require(_0x4371('0xf'));var authService=require(_0x4371('0x10'));var qs=require(_0x4371('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4371('0x12'))(_0x4371('0x13'));var utils=require('../../config/utils');var config=require(_0x4371('0x14'));var licenseUtil=require(_0x4371('0x15'));var db=require(_0x4371('0x16'))['db'];function respondWithStatusCode(_0x3b1504,_0x91cbcd){_0x91cbcd=_0x91cbcd||0xcc;return function(_0x5cc89f){if(_0x5cc89f){return _0x3b1504[_0x4371('0x17')](_0x91cbcd);}return _0x3b1504['status'](_0x91cbcd)['end']();};}function respondWithResult(_0x2f5059,_0x26ad81){_0x26ad81=_0x26ad81||0xc8;return function(_0xc4e69d){if(_0xc4e69d){return _0x2f5059[_0x4371('0x18')](_0x26ad81)[_0x4371('0x19')](_0xc4e69d);}};}function respondWithFilteredResult(_0x25bd58,_0x401277){return function(_0x392964){if(_0x392964){var _0x1f382c=typeof _0x401277[_0x4371('0x1a')]===_0x4371('0x1b')&&typeof _0x401277[_0x4371('0x1c')]===_0x4371('0x1b');var _0x6a2297=_0x392964['count'];var _0x4fef8d=_0x1f382c?0x0:_0x401277[_0x4371('0x1a')];var _0x54f10a=_0x1f382c?_0x392964[_0x4371('0x1d')]:_0x401277[_0x4371('0x1a')]+_0x401277['limit'];var _0x45b7a7;if(_0x54f10a>=_0x6a2297){_0x54f10a=_0x6a2297;_0x45b7a7=0xc8;}else{_0x45b7a7=0xce;}_0x25bd58[_0x4371('0x18')](_0x45b7a7);return _0x25bd58[_0x4371('0x1e')](_0x4371('0x1f'),_0x4fef8d+'-'+_0x54f10a+'/'+_0x6a2297)[_0x4371('0x19')](_0x392964);}return null;};}function patchUpdates(_0x442513){return function(_0x3469fb){try{jsonpatch[_0x4371('0x20')](_0x3469fb,_0x442513,!![]);}catch(_0x5611f6){return BPromise[_0x4371('0x21')](_0x5611f6);}return _0x3469fb['save']();};}function saveUpdates(_0x2e6164,_0x51bb45){return function(_0x8281a3){if(_0x8281a3){return _0x8281a3[_0x4371('0x22')](_0x2e6164)[_0x4371('0x23')](function(_0x46a4ac){return _0x46a4ac;});}return null;};}function removeEntity(_0x5df158,_0x1c709a){return function(_0x43c001){if(_0x43c001){return _0x43c001[_0x4371('0x24')]()[_0x4371('0x23')](function(){_0x5df158['status'](0xcc)[_0x4371('0x25')]();});}};}function handleEntityNotFound(_0x5f192c,_0x1aa805){return function(_0x3929f0){if(!_0x3929f0){_0x5f192c['sendStatus'](0x194);}return _0x3929f0;};}function handleError(_0x6a107b,_0x1aa295){_0x1aa295=_0x1aa295||0x1f4;return function(_0x4f3ece){logger[_0x4371('0x26')](_0x4f3ece[_0x4371('0x27')]);if(_0x4f3ece[_0x4371('0x28')]){delete _0x4f3ece[_0x4371('0x28')];}_0x6a107b[_0x4371('0x18')](_0x1aa295)[_0x4371('0x29')](_0x4f3ece);};}exports[_0x4371('0x2a')]=function(_0x57cf5b,_0x21f481){var _0x4c9cbf={},_0x4b4b2f={},_0x471498={'count':0x0,'rows':[]};var _0x38546d=_[_0x4371('0x2b')](db[_0x4371('0x2c')]['rawAttributes'],function(_0x1972a7){return{'name':_0x1972a7[_0x4371('0x2d')],'type':_0x1972a7[_0x4371('0x2e')][_0x4371('0x2f')]};});_0x4b4b2f[_0x4371('0x30')]=_[_0x4371('0x2b')](_0x38546d,_0x4371('0x28'));_0x4b4b2f[_0x4371('0x31')]=_[_0x4371('0x32')](_0x57cf5b[_0x4371('0x31')]);_0x4b4b2f[_0x4371('0x33')]=_[_0x4371('0x34')](_0x4b4b2f[_0x4371('0x30')],_0x4b4b2f['query']);_0x4c9cbf['attributes']=_['intersection'](_0x4b4b2f[_0x4371('0x30')],qs[_0x4371('0x35')](_0x57cf5b['query']['fields']));_0x4c9cbf[_0x4371('0x36')]=_0x4c9cbf['attributes']['length']?_0x4c9cbf[_0x4371('0x36')]:_0x4b4b2f[_0x4371('0x30')];if(!_0x57cf5b[_0x4371('0x31')][_0x4371('0x37')](_0x4371('0x38'))){_0x4c9cbf[_0x4371('0x1c')]=qs[_0x4371('0x1c')](_0x57cf5b[_0x4371('0x31')][_0x4371('0x1c')]);_0x4c9cbf[_0x4371('0x1a')]=qs[_0x4371('0x1a')](_0x57cf5b[_0x4371('0x31')][_0x4371('0x1a')]);}_0x4c9cbf[_0x4371('0x39')]=qs[_0x4371('0x3a')](_0x57cf5b['query']['sort']);_0x4c9cbf['where']=qs[_0x4371('0x33')](_[_0x4371('0x3b')](_0x57cf5b['query'],_0x4b4b2f[_0x4371('0x33')]),_0x38546d);if(_0x57cf5b[_0x4371('0x31')]['filter']){_0x4c9cbf[_0x4371('0x3c')]=_[_0x4371('0x3d')](_0x4c9cbf['where'],{'$or':_[_0x4371('0x2b')](_0x38546d,function(_0x586594){if(_0x586594[_0x4371('0x2e')]!==_0x4371('0x3e')){var _0x18140d={};_0x18140d[_0x586594[_0x4371('0x28')]]={'$like':'%'+_0x57cf5b['query']['filter']+'%'};return _0x18140d;}})});}_0x4c9cbf=_['merge']({},_0x4c9cbf,_0x57cf5b['options']);var _0x51aea4={'where':_0x4c9cbf[_0x4371('0x3c')]};return db['VoiceDialReport'][_0x4371('0x1d')](_0x51aea4)[_0x4371('0x23')](function(_0x3fa1f1){_0x471498[_0x4371('0x1d')]=_0x3fa1f1;if(_0x57cf5b[_0x4371('0x31')]['includeAll']){_0x4c9cbf[_0x4371('0x3f')]=[{'all':!![]}];}return db[_0x4371('0x2c')][_0x4371('0x40')](_0x4c9cbf);})[_0x4371('0x23')](function(_0x3f266c){_0x471498['rows']=_0x3f266c;return _0x471498;})[_0x4371('0x23')](respondWithFilteredResult(_0x21f481,_0x4c9cbf))[_0x4371('0x41')](handleError(_0x21f481,null));};exports[_0x4371('0x42')]=function(_0x1adddc,_0x474ea9){var _0x3cacf6={'raw':!![],'where':{'id':_0x1adddc['params']['id']}},_0x1db13f={};_0x1db13f[_0x4371('0x30')]=_[_0x4371('0x32')](db[_0x4371('0x2c')][_0x4371('0x43')]);_0x1db13f['query']=_[_0x4371('0x32')](_0x1adddc[_0x4371('0x31')]);_0x1db13f['filters']=_[_0x4371('0x34')](_0x1db13f[_0x4371('0x30')],_0x1db13f[_0x4371('0x31')]);_0x3cacf6['attributes']=_[_0x4371('0x34')](_0x1db13f[_0x4371('0x30')],qs['fields'](_0x1adddc[_0x4371('0x31')]['fields']));_0x3cacf6['attributes']=_0x3cacf6[_0x4371('0x36')][_0x4371('0x44')]?_0x3cacf6[_0x4371('0x36')]:_0x1db13f[_0x4371('0x30')];if(_0x1adddc['query'][_0x4371('0x45')]){_0x3cacf6[_0x4371('0x3f')]=[{'all':!![]}];}_0x3cacf6=_[_0x4371('0x3d')]({},_0x3cacf6,_0x1adddc[_0x4371('0x46')]);return db['VoiceDialReport'][_0x4371('0x47')](_0x3cacf6)[_0x4371('0x23')](handleEntityNotFound(_0x474ea9,null))[_0x4371('0x23')](respondWithResult(_0x474ea9,null))[_0x4371('0x41')](handleError(_0x474ea9,null));};exports[_0x4371('0x48')]=function(_0x332c21,_0x2dbb9c){return db['VoiceDialReport'][_0x4371('0x48')](_0x332c21['body'],{})[_0x4371('0x23')](respondWithResult(_0x2dbb9c,0xc9))[_0x4371('0x41')](handleError(_0x2dbb9c,null));};exports[_0x4371('0x22')]=function(_0x4e46d5,_0x576809){if(_0x4e46d5[_0x4371('0x49')]['id']){delete _0x4e46d5[_0x4371('0x49')]['id'];}return db[_0x4371('0x2c')][_0x4371('0x47')]({'where':{'id':_0x4e46d5[_0x4371('0x4a')]['id']}})['then'](handleEntityNotFound(_0x576809,null))[_0x4371('0x23')](saveUpdates(_0x4e46d5['body'],null))[_0x4371('0x23')](respondWithResult(_0x576809,null))[_0x4371('0x41')](handleError(_0x576809,null));};exports['destroy']=function(_0x1b3023,_0x492fa3){return db[_0x4371('0x2c')][_0x4371('0x47')]({'where':{'id':_0x1b3023[_0x4371('0x4a')]['id']}})[_0x4371('0x23')](handleEntityNotFound(_0x492fa3,null))[_0x4371('0x23')](removeEntity(_0x492fa3,null))['catch'](handleError(_0x492fa3,null));};exports['describe']=function(_0x53eed2,_0x3a2bd2){return db[_0x4371('0x2c')][_0x4371('0x4b')]()[_0x4371('0x23')](respondWithResult(_0x3a2bd2,null))[_0x4371('0x41')](handleError(_0x3a2bd2,null));};
\ No newline at end of file