Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / voiceQueuesLog / voiceQueuesLog.controller.js
index 27e9e8f..31b2878 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcc0c=['length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','include','findAll','rows','catch','show','create','body','find','params','destroy','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','name','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x1e6ad7,_0x270738){var _0x1f2e43=function(_0x4b08c3){while(--_0x4b08c3){_0x1e6ad7['push'](_0x1e6ad7['shift']());}};_0x1f2e43(++_0x270738);}(_0xcc0c,0xa8));var _0xccc0=function(_0x5489c4,_0x1e7a17){_0x5489c4=_0x5489c4-0x0;var _0x2c4624=_0xcc0c[_0x5489c4];return _0x2c4624;};'use strict';var pdf=require(_0xccc0('0x0'));var emlformat=require(_0xccc0('0x1'));var rimraf=require(_0xccc0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xccc0('0x3'));var moment=require(_0xccc0('0x4'));var BPromise=require(_0xccc0('0x5'));var Mustache=require(_0xccc0('0x6'));var util=require('util');var path=require(_0xccc0('0x7'));var sox=require('sox');var csv=require(_0xccc0('0x8'));var ejs=require(_0xccc0('0x9'));var fs=require('fs');var _=require(_0xccc0('0xa'));var squel=require(_0xccc0('0xb'));var crypto=require(_0xccc0('0xc'));var jsforce=require(_0xccc0('0xd'));var deskjs=require(_0xccc0('0xe'));var toCsv=require('to-csv');var querystring=require(_0xccc0('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xccc0('0x10'));var qs=require(_0xccc0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xccc0('0x12'))(_0xccc0('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xccc0('0x14'));var db=require(_0xccc0('0x15'))['db'];function respondWithStatusCode(_0x1efefa,_0x2c867a){_0x2c867a=_0x2c867a||0xcc;return function(_0x2517e5){if(_0x2517e5){return _0x1efefa['sendStatus'](_0x2c867a);}return _0x1efefa[_0xccc0('0x16')](_0x2c867a)['end']();};}function respondWithResult(_0x5324fb,_0x17f478){_0x17f478=_0x17f478||0xc8;return function(_0x1ed0cc){if(_0x1ed0cc){return _0x5324fb[_0xccc0('0x16')](_0x17f478)[_0xccc0('0x17')](_0x1ed0cc);}};}function respondWithFilteredResult(_0x5246b8,_0x460d66){return function(_0x588c01){if(_0x588c01){var _0x580676=_0x588c01['count'],_0x2f5283=_0x460d66[_0xccc0('0x18')],_0x28c99d=_0x460d66[_0xccc0('0x18')]+_0x460d66[_0xccc0('0x19')],_0x2b2e16;if(_0x28c99d>=_0x580676){_0x28c99d=_0x580676;_0x2b2e16=0xc8;}else{_0x2b2e16=0xce;}_0x5246b8[_0xccc0('0x16')](_0x2b2e16);return _0x5246b8[_0xccc0('0x1a')](_0xccc0('0x1b'),_0x2f5283+'-'+_0x28c99d+'/'+_0x580676)[_0xccc0('0x17')](_0x588c01);}return null;};}function patchUpdates(_0x5d76ff){return function(_0x1aca42){try{jsonpatch[_0xccc0('0x1c')](_0x1aca42,_0x5d76ff,!![]);}catch(_0x4a0c18){return BPromise[_0xccc0('0x1d')](_0x4a0c18);}return _0x1aca42[_0xccc0('0x1e')]();};}function saveUpdates(_0x4776e4,_0x43c42d){return function(_0x2c32af){if(_0x2c32af){return _0x2c32af[_0xccc0('0x1f')](_0x4776e4)[_0xccc0('0x20')](function(_0x25dfce){return _0x25dfce;});}return null;};}function removeEntity(_0xd54374,_0x31235e){return function(_0x17c332){if(_0x17c332){return _0x17c332['destroy']()[_0xccc0('0x20')](function(){_0xd54374['status'](0xcc)[_0xccc0('0x21')]();});}};}function handleEntityNotFound(_0x3b92c2,_0x47a6bf){return function(_0x2c0b19){if(!_0x2c0b19){_0x3b92c2[_0xccc0('0x22')](0x194);}return _0x2c0b19;};}function handleError(_0x1a0664,_0x1a53be){_0x1a53be=_0x1a53be||0x1f4;return function(_0x2d0951){logger['error'](_0x2d0951[_0xccc0('0x23')]);if(_0x2d0951[_0xccc0('0x24')]){delete _0x2d0951[_0xccc0('0x24')];}_0x1a0664[_0xccc0('0x16')](_0x1a53be)['send'](_0x2d0951);};}exports[_0xccc0('0x25')]=function(_0x38943e,_0x2d3ae6){var _0x164488={},_0x53cca5={},_0x3aa2c8={'count':0x0,'rows':[]};var _0x331df1=_[_0xccc0('0x26')](db[_0xccc0('0x27')][_0xccc0('0x28')],function(_0x19065e){return{'name':_0x19065e[_0xccc0('0x29')],'type':_0x19065e[_0xccc0('0x2a')][_0xccc0('0x2b')]};});_0x53cca5[_0xccc0('0x2c')]=_[_0xccc0('0x26')](_0x331df1,'name');_0x53cca5[_0xccc0('0x2d')]=_[_0xccc0('0x2e')](_0x38943e[_0xccc0('0x2d')]);_0x53cca5[_0xccc0('0x2f')]=_[_0xccc0('0x30')](_0x53cca5[_0xccc0('0x2c')],_0x53cca5[_0xccc0('0x2d')]);_0x164488[_0xccc0('0x31')]=_[_0xccc0('0x30')](_0x53cca5[_0xccc0('0x2c')],qs[_0xccc0('0x32')](_0x38943e[_0xccc0('0x2d')][_0xccc0('0x32')]));_0x164488[_0xccc0('0x31')]=_0x164488[_0xccc0('0x31')][_0xccc0('0x33')]?_0x164488[_0xccc0('0x31')]:_0x53cca5['model'];if(!_0x38943e[_0xccc0('0x2d')][_0xccc0('0x34')](_0xccc0('0x35'))){_0x164488[_0xccc0('0x19')]=qs['limit'](_0x38943e[_0xccc0('0x2d')]['limit']);_0x164488[_0xccc0('0x18')]=qs[_0xccc0('0x18')](_0x38943e[_0xccc0('0x2d')][_0xccc0('0x18')]);}_0x164488[_0xccc0('0x36')]=qs[_0xccc0('0x37')](_0x38943e['query'][_0xccc0('0x37')]);_0x164488['where']=qs['filters'](_[_0xccc0('0x38')](_0x38943e[_0xccc0('0x2d')],_0x53cca5[_0xccc0('0x2f')]),_0x331df1);if(_0x38943e[_0xccc0('0x2d')][_0xccc0('0x39')]){_0x164488['where']=_['merge'](_0x164488[_0xccc0('0x3a')],{'$or':_['map'](_0x331df1,function(_0x58c4c3){if(_0x58c4c3[_0xccc0('0x2a')]!=='VIRTUAL'){var _0x5330db={};_0x5330db[_0x58c4c3[_0xccc0('0x24')]]={'$like':'%'+_0x38943e[_0xccc0('0x2d')][_0xccc0('0x39')]+'%'};return _0x5330db;}})});}_0x164488=_[_0xccc0('0x3b')]({},_0x164488,_0x38943e[_0xccc0('0x3c')]);var _0xa6b099={'where':_0x164488[_0xccc0('0x3a')]};return db[_0xccc0('0x27')][_0xccc0('0x3d')](_0xa6b099)[_0xccc0('0x20')](function(_0x562186){_0x3aa2c8[_0xccc0('0x3d')]=_0x562186;if(_0x38943e['query'][_0xccc0('0x3e')]){_0x164488[_0xccc0('0x3f')]=[{'all':!![]}];}return db[_0xccc0('0x27')][_0xccc0('0x40')](_0x164488);})[_0xccc0('0x20')](function(_0x22a7ba){_0x3aa2c8[_0xccc0('0x41')]=_0x22a7ba;return _0x3aa2c8;})[_0xccc0('0x20')](respondWithFilteredResult(_0x2d3ae6,_0x164488))[_0xccc0('0x42')](handleError(_0x2d3ae6,null));};exports[_0xccc0('0x43')]=function(_0x2f509f,_0x3daf41){var _0x13d32e={'raw':!![],'where':{'id':_0x2f509f['params']['id']}},_0xd8fd92={};_0xd8fd92[_0xccc0('0x2c')]=_[_0xccc0('0x2e')](db['VoiceQueuesLog'][_0xccc0('0x28')]);_0xd8fd92[_0xccc0('0x2d')]=_['keys'](_0x2f509f[_0xccc0('0x2d')]);_0xd8fd92[_0xccc0('0x2f')]=_[_0xccc0('0x30')](_0xd8fd92[_0xccc0('0x2c')],_0xd8fd92[_0xccc0('0x2d')]);_0x13d32e[_0xccc0('0x31')]=_['intersection'](_0xd8fd92['model'],qs[_0xccc0('0x32')](_0x2f509f[_0xccc0('0x2d')][_0xccc0('0x32')]));_0x13d32e[_0xccc0('0x31')]=_0x13d32e['attributes'][_0xccc0('0x33')]?_0x13d32e[_0xccc0('0x31')]:_0xd8fd92[_0xccc0('0x2c')];if(_0x2f509f[_0xccc0('0x2d')][_0xccc0('0x3e')]){_0x13d32e[_0xccc0('0x3f')]=[{'all':!![]}];}_0x13d32e=_[_0xccc0('0x3b')]({},_0x13d32e,_0x2f509f[_0xccc0('0x3c')]);return db[_0xccc0('0x27')]['find'](_0x13d32e)['then'](handleEntityNotFound(_0x3daf41,null))[_0xccc0('0x20')](respondWithResult(_0x3daf41,null))[_0xccc0('0x42')](handleError(_0x3daf41,null));};exports[_0xccc0('0x44')]=function(_0x8042c0,_0x276fc7){return db[_0xccc0('0x27')][_0xccc0('0x44')](_0x8042c0[_0xccc0('0x45')],{})[_0xccc0('0x20')](respondWithResult(_0x276fc7,0xc9))[_0xccc0('0x42')](handleError(_0x276fc7,null));};exports[_0xccc0('0x1f')]=function(_0x4adbd9,_0x17b141){if(_0x4adbd9[_0xccc0('0x45')]['id']){delete _0x4adbd9['body']['id'];}return db['VoiceQueuesLog'][_0xccc0('0x46')]({'where':{'id':_0x4adbd9[_0xccc0('0x47')]['id']}})[_0xccc0('0x20')](handleEntityNotFound(_0x17b141,null))[_0xccc0('0x20')](saveUpdates(_0x4adbd9['body'],null))[_0xccc0('0x20')](respondWithResult(_0x17b141,null))[_0xccc0('0x42')](handleError(_0x17b141,null));};exports[_0xccc0('0x48')]=function(_0x10d799,_0x500dcd){return db[_0xccc0('0x27')]['find']({'where':{'id':_0x10d799[_0xccc0('0x47')]['id']}})[_0xccc0('0x20')](handleEntityNotFound(_0x500dcd,null))[_0xccc0('0x20')](removeEntity(_0x500dcd,null))[_0xccc0('0x42')](handleError(_0x500dcd,null));};
\ No newline at end of file
+var _0x734b=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','then','end','error','stack','name','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','VoiceQueuesLog','include','findAll','params','includeAll','find','create','body','catch','destroy','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x734b,0x181));var _0xb734=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x734b[_0x1573ea];return _0x51c0e2;};'use strict';var emlformat=require(_0xb734('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb734('0x1'));var jsonpatch=require(_0xb734('0x2'));var rp=require('request-promise');var moment=require(_0xb734('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb734('0x4'));var util=require('util');var path=require(_0xb734('0x5'));var sox=require(_0xb734('0x6'));var csv=require(_0xb734('0x7'));var ejs=require(_0xb734('0x8'));var fs=require('fs');var fs_extra=require(_0xb734('0x9'));var _=require(_0xb734('0xa'));var squel=require(_0xb734('0xb'));var crypto=require(_0xb734('0xc'));var jsforce=require(_0xb734('0xd'));var deskjs=require(_0xb734('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb734('0xf'));var Papa=require(_0xb734('0x10'));var Redis=require(_0xb734('0x11'));var authService=require(_0xb734('0x12'));var qs=require(_0xb734('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb734('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb734('0x15'));var db=require(_0xb734('0x16'))['db'];function respondWithStatusCode(_0x119ab1,_0x5b8477){_0x5b8477=_0x5b8477||0xcc;return function(_0x52a88f){if(_0x52a88f){return _0x119ab1[_0xb734('0x17')](_0x5b8477);}return _0x119ab1['status'](_0x5b8477)['end']();};}function respondWithResult(_0x4b2613,_0x5467c9){_0x5467c9=_0x5467c9||0xc8;return function(_0x513312){if(_0x513312){return _0x4b2613['status'](_0x5467c9)[_0xb734('0x18')](_0x513312);}};}function respondWithFilteredResult(_0x3e49fe,_0x34281e){return function(_0x1eb3cc){if(_0x1eb3cc){var _0x3c9777=typeof _0x34281e[_0xb734('0x19')]===_0xb734('0x1a')&&typeof _0x34281e[_0xb734('0x1b')]===_0xb734('0x1a');var _0x976f15=_0x1eb3cc[_0xb734('0x1c')];var _0x7eba0c=_0x3c9777?0x0:_0x34281e[_0xb734('0x19')];var _0xb896bd=_0x3c9777?_0x1eb3cc[_0xb734('0x1c')]:_0x34281e[_0xb734('0x19')]+_0x34281e[_0xb734('0x1b')];var _0xb43c91;if(_0xb896bd>=_0x976f15){_0xb896bd=_0x976f15;_0xb43c91=0xc8;}else{_0xb43c91=0xce;}_0x3e49fe[_0xb734('0x1d')](_0xb43c91);return _0x3e49fe[_0xb734('0x1e')](_0xb734('0x1f'),_0x7eba0c+'-'+_0xb896bd+'/'+_0x976f15)[_0xb734('0x18')](_0x1eb3cc);}return null;};}function patchUpdates(_0x29cf48){return function(_0x50a037){try{jsonpatch['apply'](_0x50a037,_0x29cf48,!![]);}catch(_0x1b6c23){return BPromise['reject'](_0x1b6c23);}return _0x50a037['save']();};}function saveUpdates(_0x2cd46d,_0x33819c){return function(_0x5917fe){if(_0x5917fe){return _0x5917fe['update'](_0x2cd46d)[_0xb734('0x20')](function(_0x2a4409){return _0x2a4409;});}return null;};}function removeEntity(_0x206837,_0x5ea099){return function(_0x297d9e){if(_0x297d9e){return _0x297d9e['destroy']()[_0xb734('0x20')](function(){_0x206837[_0xb734('0x1d')](0xcc)[_0xb734('0x21')]();});}};}function handleEntityNotFound(_0x436b15,_0x3dcb1b){return function(_0x16a3b7){if(!_0x16a3b7){_0x436b15['sendStatus'](0x194);}return _0x16a3b7;};}function handleError(_0x3d7fae,_0x3484c4){_0x3484c4=_0x3484c4||0x1f4;return function(_0x672153){logger[_0xb734('0x22')](_0x672153[_0xb734('0x23')]);if(_0x672153[_0xb734('0x24')]){delete _0x672153[_0xb734('0x24')];}_0x3d7fae[_0xb734('0x1d')](_0x3484c4)['send'](_0x672153);};}exports['index']=function(_0x2717a1,_0x156b9c){var _0x3bfd35={},_0x311abe={},_0x9f5fae={'count':0x0,'rows':[]};var _0x104a0a=_['map'](db['VoiceQueuesLog'][_0xb734('0x25')],function(_0x15e32d){return{'name':_0x15e32d[_0xb734('0x26')],'type':_0x15e32d[_0xb734('0x27')]['key']};});_0x311abe['model']=_[_0xb734('0x28')](_0x104a0a,_0xb734('0x24'));_0x311abe[_0xb734('0x29')]=_[_0xb734('0x2a')](_0x2717a1[_0xb734('0x29')]);_0x311abe[_0xb734('0x2b')]=_[_0xb734('0x2c')](_0x311abe[_0xb734('0x2d')],_0x311abe[_0xb734('0x29')]);_0x3bfd35[_0xb734('0x2e')]=_[_0xb734('0x2c')](_0x311abe['model'],qs[_0xb734('0x2f')](_0x2717a1[_0xb734('0x29')][_0xb734('0x2f')]));_0x3bfd35[_0xb734('0x2e')]=_0x3bfd35[_0xb734('0x2e')][_0xb734('0x30')]?_0x3bfd35[_0xb734('0x2e')]:_0x311abe[_0xb734('0x2d')];if(!_0x2717a1['query'][_0xb734('0x31')](_0xb734('0x32'))){_0x3bfd35['limit']=qs[_0xb734('0x1b')](_0x2717a1[_0xb734('0x29')][_0xb734('0x1b')]);_0x3bfd35['offset']=qs[_0xb734('0x19')](_0x2717a1['query']['offset']);}_0x3bfd35['order']=qs[_0xb734('0x33')](_0x2717a1[_0xb734('0x29')][_0xb734('0x33')]);_0x3bfd35[_0xb734('0x34')]=qs[_0xb734('0x2b')](_['pick'](_0x2717a1[_0xb734('0x29')],_0x311abe[_0xb734('0x2b')]),_0x104a0a);if(_0x2717a1['query'][_0xb734('0x35')]){_0x3bfd35[_0xb734('0x34')]=_[_0xb734('0x36')](_0x3bfd35[_0xb734('0x34')],{'$or':_['map'](_0x104a0a,function(_0x3954d4){if(_0x3954d4['type']!=='VIRTUAL'){var _0x587e42={};_0x587e42[_0x3954d4['name']]={'$like':'%'+_0x2717a1[_0xb734('0x29')][_0xb734('0x35')]+'%'};return _0x587e42;}})});}_0x3bfd35=_[_0xb734('0x36')]({},_0x3bfd35,_0x2717a1[_0xb734('0x37')]);var _0x678ea3={'where':_0x3bfd35[_0xb734('0x34')]};return db[_0xb734('0x38')]['count'](_0x678ea3)[_0xb734('0x20')](function(_0xa0e1f3){_0x9f5fae[_0xb734('0x1c')]=_0xa0e1f3;if(_0x2717a1[_0xb734('0x29')]['includeAll']){_0x3bfd35[_0xb734('0x39')]=[{'all':!![]}];}return db[_0xb734('0x38')][_0xb734('0x3a')](_0x3bfd35);})[_0xb734('0x20')](function(_0x2f73a0){_0x9f5fae['rows']=_0x2f73a0;return _0x9f5fae;})[_0xb734('0x20')](respondWithFilteredResult(_0x156b9c,_0x3bfd35))['catch'](handleError(_0x156b9c,null));};exports['show']=function(_0x30036c,_0x301836){var _0x5b4fa8={'raw':!![],'where':{'id':_0x30036c[_0xb734('0x3b')]['id']}},_0x146691={};_0x146691['model']=_[_0xb734('0x2a')](db[_0xb734('0x38')][_0xb734('0x25')]);_0x146691[_0xb734('0x29')]=_[_0xb734('0x2a')](_0x30036c['query']);_0x146691[_0xb734('0x2b')]=_[_0xb734('0x2c')](_0x146691[_0xb734('0x2d')],_0x146691['query']);_0x5b4fa8[_0xb734('0x2e')]=_[_0xb734('0x2c')](_0x146691[_0xb734('0x2d')],qs[_0xb734('0x2f')](_0x30036c['query']['fields']));_0x5b4fa8[_0xb734('0x2e')]=_0x5b4fa8[_0xb734('0x2e')]['length']?_0x5b4fa8[_0xb734('0x2e')]:_0x146691['model'];if(_0x30036c[_0xb734('0x29')][_0xb734('0x3c')]){_0x5b4fa8[_0xb734('0x39')]=[{'all':!![]}];}_0x5b4fa8=_['merge']({},_0x5b4fa8,_0x30036c[_0xb734('0x37')]);return db[_0xb734('0x38')][_0xb734('0x3d')](_0x5b4fa8)['then'](handleEntityNotFound(_0x301836,null))[_0xb734('0x20')](respondWithResult(_0x301836,null))['catch'](handleError(_0x301836,null));};exports[_0xb734('0x3e')]=function(_0x5d2cbe,_0x528054){return db[_0xb734('0x38')][_0xb734('0x3e')](_0x5d2cbe[_0xb734('0x3f')],{})['then'](respondWithResult(_0x528054,0xc9))[_0xb734('0x40')](handleError(_0x528054,null));};exports['update']=function(_0x5d57f7,_0x464f4a){if(_0x5d57f7[_0xb734('0x3f')]['id']){delete _0x5d57f7[_0xb734('0x3f')]['id'];}return db[_0xb734('0x38')][_0xb734('0x3d')]({'where':{'id':_0x5d57f7[_0xb734('0x3b')]['id']}})[_0xb734('0x20')](handleEntityNotFound(_0x464f4a,null))[_0xb734('0x20')](saveUpdates(_0x5d57f7[_0xb734('0x3f')],null))[_0xb734('0x20')](respondWithResult(_0x464f4a,null))[_0xb734('0x40')](handleError(_0x464f4a,null));};exports[_0xb734('0x41')]=function(_0x49c942,_0x46f354){return db[_0xb734('0x38')][_0xb734('0x3d')]({'where':{'id':_0x49c942[_0xb734('0x3b')]['id']}})[_0xb734('0x20')](handleEntityNotFound(_0x46f354,null))[_0xb734('0x20')](removeEntity(_0x46f354,null))['catch'](handleError(_0x46f354,null));};
\ No newline at end of file