Built motion from commit 97153652.|2.6.26
[motion2.git] / server / api / voiceMail / voiceMail.controller.js
index b2b6c32..b2541d0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa74f=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','json','reject','save','destroy','then','Voicemails','UserProfileResource','error','stack','send','map','VoiceMail','rawAttributes','fieldName','type','key','model','name','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','rows','catch','show','params','keys','include','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','VoiceMailMessage','hasOwnProperty','nolimit','mailbox','options','findAndCountAll','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x1bef27,_0x46acf2){var _0x2d7f10=function(_0x12193){while(--_0x12193){_0x1bef27['push'](_0x1bef27['shift']());}};_0x2d7f10(++_0x46acf2);}(_0xa74f,0x9a));var _0xfa74=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0xa74f[_0x5311a1];return _0x2acb9f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa74('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa74('0x1'));var BPromise=require(_0xfa74('0x2'));var Mustache=require(_0xfa74('0x3'));var util=require(_0xfa74('0x4'));var path=require('path');var sox=require(_0xfa74('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa74('0x6'));var _=require(_0xfa74('0x7'));var squel=require(_0xfa74('0x8'));var crypto=require(_0xfa74('0x9'));var jsforce=require(_0xfa74('0xa'));var deskjs=require(_0xfa74('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfa74('0xc'));var Papa=require(_0xfa74('0xd'));var Redis=require(_0xfa74('0xe'));var authService=require(_0xfa74('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfa74('0x10'));var hardwareService=require(_0xfa74('0x11'));var logger=require('../../config/logger')(_0xfa74('0x12'));var utils=require(_0xfa74('0x13'));var config=require(_0xfa74('0x14'));var licenseUtil=require(_0xfa74('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23591a,_0x998585){_0x998585=_0x998585||0xcc;return function(_0x78173f){if(_0x78173f){return _0x23591a[_0xfa74('0x16')](_0x998585);}return _0x23591a['status'](_0x998585)[_0xfa74('0x17')]();};}function respondWithResult(_0x33cda3,_0x3eb49b){_0x3eb49b=_0x3eb49b||0xc8;return function(_0x3947ca){if(_0x3947ca){return _0x33cda3[_0xfa74('0x18')](_0x3eb49b)['json'](_0x3947ca);}};}function respondWithFilteredResult(_0x199d20,_0x13d911){return function(_0x947da6){if(_0x947da6){var _0x1f1de0=typeof _0x13d911[_0xfa74('0x19')]===_0xfa74('0x1a')&&typeof _0x13d911[_0xfa74('0x1b')]==='undefined';var _0x58a67a=_0x947da6[_0xfa74('0x1c')];var _0x51dda1=_0x1f1de0?0x0:_0x13d911['offset'];var _0x31d3c1=_0x1f1de0?_0x947da6[_0xfa74('0x1c')]:_0x13d911[_0xfa74('0x19')]+_0x13d911['limit'];var _0x3bede6;if(_0x31d3c1>=_0x58a67a){_0x31d3c1=_0x58a67a;_0x3bede6=0xc8;}else{_0x3bede6=0xce;}_0x199d20[_0xfa74('0x18')](_0x3bede6);return _0x199d20[_0xfa74('0x1d')]('Content-Range',_0x51dda1+'-'+_0x31d3c1+'/'+_0x58a67a)[_0xfa74('0x1e')](_0x947da6);}return null;};}function patchUpdates(_0x302eb4){return function(_0x2e6c33){try{jsonpatch['apply'](_0x2e6c33,_0x302eb4,!![]);}catch(_0x5466ca){return BPromise[_0xfa74('0x1f')](_0x5466ca);}return _0x2e6c33[_0xfa74('0x20')]();};}function saveUpdates(_0x9932db,_0xeaaa19){return function(_0x1a453d){if(_0x1a453d){return _0x1a453d['update'](_0x9932db)['then'](function(_0x3721bf){return _0x3721bf;});}return null;};}function removeEntity(_0x5aa8a7,_0x48cbd3){return function(_0x529810){if(_0x529810){return _0x529810[_0xfa74('0x21')]()[_0xfa74('0x22')](function(){var _0x42d9bf=_0x529810['get']({'plain':!![]});var _0x530f99=_0xfa74('0x23');return db[_0xfa74('0x24')]['destroy']({'where':{'type':_0x530f99,'resourceId':_0x42d9bf['id']}})[_0xfa74('0x22')](function(){return _0x529810;});})['then'](function(){_0x5aa8a7[_0xfa74('0x18')](0xcc)[_0xfa74('0x17')]();});}};}function handleEntityNotFound(_0x55d8e4,_0x298388){return function(_0x1130de){if(!_0x1130de){_0x55d8e4[_0xfa74('0x16')](0x194);}return _0x1130de;};}function handleError(_0x218c86,_0x4f7337){_0x4f7337=_0x4f7337||0x1f4;return function(_0xd9c55d){logger[_0xfa74('0x25')](_0xd9c55d[_0xfa74('0x26')]);if(_0xd9c55d['name']){delete _0xd9c55d['name'];}_0x218c86[_0xfa74('0x18')](_0x4f7337)[_0xfa74('0x27')](_0xd9c55d);};}exports['index']=function(_0x4b38fc,_0x343466){var _0x564060={},_0x2238d4={},_0x4d6d0a={'count':0x0,'rows':[]};var _0x363173=_[_0xfa74('0x28')](db[_0xfa74('0x29')][_0xfa74('0x2a')],function(_0x4c506f){return{'name':_0x4c506f[_0xfa74('0x2b')],'type':_0x4c506f[_0xfa74('0x2c')][_0xfa74('0x2d')]};});_0x2238d4[_0xfa74('0x2e')]=_[_0xfa74('0x28')](_0x363173,_0xfa74('0x2f'));_0x2238d4[_0xfa74('0x30')]=_['keys'](_0x4b38fc[_0xfa74('0x30')]);_0x2238d4['filters']=_[_0xfa74('0x31')](_0x2238d4[_0xfa74('0x2e')],_0x2238d4[_0xfa74('0x30')]);_0x564060[_0xfa74('0x32')]=_['intersection'](_0x2238d4['model'],qs[_0xfa74('0x33')](_0x4b38fc[_0xfa74('0x30')][_0xfa74('0x33')]));_0x564060[_0xfa74('0x32')]=_0x564060['attributes'][_0xfa74('0x34')]?_0x564060[_0xfa74('0x32')]:_0x2238d4['model'];if(!_0x4b38fc['query']['hasOwnProperty']('nolimit')){_0x564060['limit']=qs[_0xfa74('0x1b')](_0x4b38fc[_0xfa74('0x30')][_0xfa74('0x1b')]);_0x564060[_0xfa74('0x19')]=qs[_0xfa74('0x19')](_0x4b38fc[_0xfa74('0x30')][_0xfa74('0x19')]);}_0x564060[_0xfa74('0x35')]=qs[_0xfa74('0x36')](_0x4b38fc['query'][_0xfa74('0x36')]);_0x564060[_0xfa74('0x37')]=qs[_0xfa74('0x38')](_[_0xfa74('0x39')](_0x4b38fc[_0xfa74('0x30')],_0x2238d4[_0xfa74('0x38')]),_0x363173);if(_0x4b38fc['query'][_0xfa74('0x3a')]){_0x564060[_0xfa74('0x37')]=_[_0xfa74('0x3b')](_0x564060[_0xfa74('0x37')],{'$or':_['map'](_0x363173,function(_0x207566){if(_0x207566[_0xfa74('0x2c')]!==_0xfa74('0x3c')){var _0x35f252={};_0x35f252[_0x207566['name']]={'$like':'%'+_0x4b38fc[_0xfa74('0x30')][_0xfa74('0x3a')]+'%'};return _0x35f252;}})});}_0x564060=_[_0xfa74('0x3b')]({},_0x564060,_0x4b38fc['options']);var _0x5d32bc={'where':_0x564060[_0xfa74('0x37')]};return db[_0xfa74('0x29')][_0xfa74('0x1c')](_0x5d32bc)[_0xfa74('0x22')](function(_0x55f4e3){_0x4d6d0a[_0xfa74('0x1c')]=_0x55f4e3;if(_0x4b38fc[_0xfa74('0x30')]['includeAll']){_0x564060['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x564060);})[_0xfa74('0x22')](function(_0x3098ca){_0x4d6d0a[_0xfa74('0x3d')]=_0x3098ca;return _0x4d6d0a;})[_0xfa74('0x22')](respondWithFilteredResult(_0x343466,_0x564060))[_0xfa74('0x3e')](handleError(_0x343466,null));};exports[_0xfa74('0x3f')]=function(_0x7735c5,_0x5aac45){var _0x274062={'raw':!![],'where':{'id':_0x7735c5[_0xfa74('0x40')]['id']}},_0x3938c1={};_0x3938c1[_0xfa74('0x2e')]=_[_0xfa74('0x41')](db['VoiceMail'][_0xfa74('0x2a')]);_0x3938c1[_0xfa74('0x30')]=_[_0xfa74('0x41')](_0x7735c5[_0xfa74('0x30')]);_0x3938c1[_0xfa74('0x38')]=_[_0xfa74('0x31')](_0x3938c1[_0xfa74('0x2e')],_0x3938c1[_0xfa74('0x30')]);_0x274062[_0xfa74('0x32')]=_[_0xfa74('0x31')](_0x3938c1['model'],qs[_0xfa74('0x33')](_0x7735c5['query'][_0xfa74('0x33')]));_0x274062[_0xfa74('0x32')]=_0x274062[_0xfa74('0x32')][_0xfa74('0x34')]?_0x274062['attributes']:_0x3938c1[_0xfa74('0x2e')];if(_0x7735c5[_0xfa74('0x30')]['includeAll']){_0x274062[_0xfa74('0x42')]=[{'all':!![]}];}_0x274062=_[_0xfa74('0x3b')]({},_0x274062,_0x7735c5['options']);return db[_0xfa74('0x29')][_0xfa74('0x43')](_0x274062)[_0xfa74('0x22')](handleEntityNotFound(_0x5aac45,null))[_0xfa74('0x22')](respondWithResult(_0x5aac45,null))[_0xfa74('0x3e')](handleError(_0x5aac45,null));};exports['create']=function(_0x54e06c,_0x36f6ca){return db[_0xfa74('0x29')]['create'](_0x54e06c[_0xfa74('0x44')],{})[_0xfa74('0x22')](function(_0x3100f2){var _0x4ca49e=_0x54e06c['user'][_0xfa74('0x45')]({'plain':!![]});if(!_0x4ca49e)throw new Error(_0xfa74('0x46'));if(_0x4ca49e[_0xfa74('0x47')]===_0xfa74('0x48')){var _0x36508a=_0x3100f2[_0xfa74('0x45')]({'plain':!![]});var _0x2d217d=_0xfa74('0x23');return db['UserProfileSection'][_0xfa74('0x43')]({'where':{'name':_0x2d217d,'userProfileId':_0x4ca49e[_0xfa74('0x49')]},'raw':!![]})[_0xfa74('0x22')](function(_0x2654b5){if(_0x2654b5&&_0x2654b5['autoAssociation']===0x0){return db['UserProfileResource'][_0xfa74('0x4a')]({'name':_0x36508a['name'],'resourceId':_0x36508a['id'],'type':_0x2654b5[_0xfa74('0x2f')],'sectionId':_0x2654b5['id']},{})[_0xfa74('0x22')](function(){return _0x3100f2;});}else{return _0x3100f2;}})[_0xfa74('0x3e')](function(_0x33e31e){logger[_0xfa74('0x25')](_0xfa74('0x4b'),_0x33e31e);throw _0x33e31e;});}return _0x3100f2;})[_0xfa74('0x22')](respondWithResult(_0x36f6ca,0xc9))['catch'](handleError(_0x36f6ca,null));};exports[_0xfa74('0x4c')]=function(_0x4bcee3,_0x21d7c5){if(_0x4bcee3['body']['id']){delete _0x4bcee3['body']['id'];}return db[_0xfa74('0x29')][_0xfa74('0x43')]({'where':{'id':_0x4bcee3['params']['id']}})['then'](handleEntityNotFound(_0x21d7c5,null))[_0xfa74('0x22')](saveUpdates(_0x4bcee3[_0xfa74('0x44')],null))[_0xfa74('0x22')](respondWithResult(_0x21d7c5,null))[_0xfa74('0x3e')](handleError(_0x21d7c5,null));};exports[_0xfa74('0x21')]=function(_0xfc3547,_0x1198f3){return db[_0xfa74('0x29')][_0xfa74('0x43')]({'where':{'id':_0xfc3547[_0xfa74('0x40')]['id']}})['then'](handleEntityNotFound(_0x1198f3,null))[_0xfa74('0x22')](removeEntity(_0x1198f3,null))[_0xfa74('0x3e')](handleError(_0x1198f3,null));};exports['getMessages']=function(_0x550974,_0x3d88dc,_0x2e7262){return db[_0xfa74('0x29')][_0xfa74('0x4d')]({'where':{'id':_0x550974[_0xfa74('0x40')]['id']}})['then'](handleEntityNotFound(_0x3d88dc,null))[_0xfa74('0x22')](function(_0x4d6235){var _0x26b398;var _0x2fff37={},_0x375bf7={};_0x375bf7['model']=_['keys'](db[_0xfa74('0x4e')][_0xfa74('0x2a')]);_0x375bf7[_0xfa74('0x30')]=_[_0xfa74('0x41')](_0x550974['query']);_0x375bf7[_0xfa74('0x38')]=_[_0xfa74('0x31')](_0x375bf7['model'],_0x375bf7[_0xfa74('0x30')]);_0x2fff37[_0xfa74('0x32')]=_[_0xfa74('0x31')](_0x375bf7[_0xfa74('0x2e')],qs['fields'](_0x550974[_0xfa74('0x30')]['fields']));_0x2fff37[_0xfa74('0x32')]=_0x2fff37[_0xfa74('0x32')][_0xfa74('0x34')]?_0x2fff37[_0xfa74('0x32')]:_0x375bf7[_0xfa74('0x2e')];if(!_0x550974[_0xfa74('0x30')][_0xfa74('0x4f')](_0xfa74('0x50'))){_0x2fff37[_0xfa74('0x1b')]=qs[_0xfa74('0x1b')](_0x550974[_0xfa74('0x30')][_0xfa74('0x1b')]);_0x2fff37[_0xfa74('0x19')]=qs[_0xfa74('0x19')](_0x550974[_0xfa74('0x30')]['offset']);}_0x2fff37[_0xfa74('0x35')]=qs[_0xfa74('0x36')](_0x550974['query']['sort']);_0x2fff37[_0xfa74('0x37')]=qs['filters'](_[_0xfa74('0x39')](_0x550974[_0xfa74('0x30')],_0x375bf7[_0xfa74('0x38')]));if(_0x550974['query'][_0xfa74('0x3a')]){_0x2fff37['where']=_['merge'](_0x2fff37[_0xfa74('0x37')],{'$or':_[_0xfa74('0x28')](_0x2fff37[_0xfa74('0x32')],function(_0x414e31){var _0x474c7d={};_0x474c7d[_0x414e31]={'$like':'%'+_0x550974[_0xfa74('0x30')][_0xfa74('0x3a')]+'%'};return _0x474c7d;})});}_0x2fff37[_0xfa74('0x37')]=_[_0xfa74('0x3b')](_0x2fff37[_0xfa74('0x37')],{'mailboxuser':_0x4d6235[_0xfa74('0x51')]});_0x2fff37=_['merge']({},_0x2fff37,_0x550974[_0xfa74('0x52')]);return db['VoiceMailMessage'][_0xfa74('0x53')](_0x2fff37)[_0xfa74('0x22')](respondWithFilteredResult(_0x3d88dc,_0x2fff37));})[_0xfa74('0x3e')](handleError(_0x3d88dc,null));};
\ No newline at end of file
+var _0x9ffd=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','update','then','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMail','includeAll','include','findAll','rows','catch','params','find','create','user','get','Voicemails','UserProfileSection','userProfileId','autoAssociation','body','destroy','getMessages','findOne','VoiceMailMessage','order','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','request-promise'];(function(_0x2a243a,_0x382151){var _0x43d146=function(_0x1fa890){while(--_0x1fa890){_0x2a243a['push'](_0x2a243a['shift']());}};_0x43d146(++_0x382151);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5cac98,_0x3aaee9){_0x5cac98=_0x5cac98-0x0;var _0x45aba2=_0x9ffd[_0x5cac98];return _0x45aba2;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require(_0xd9ff('0x19'))['db'];function respondWithStatusCode(_0x47d842,_0x47b0d7){_0x47b0d7=_0x47b0d7||0xcc;return function(_0xaaf7af){if(_0xaaf7af){return _0x47d842[_0xd9ff('0x1a')](_0x47b0d7);}return _0x47d842[_0xd9ff('0x1b')](_0x47b0d7)[_0xd9ff('0x1c')]();};}function respondWithResult(_0x12c39a,_0x556aa4){_0x556aa4=_0x556aa4||0xc8;return function(_0x2f78c1){if(_0x2f78c1){return _0x12c39a[_0xd9ff('0x1b')](_0x556aa4)['json'](_0x2f78c1);}};}function respondWithFilteredResult(_0xf14c9f,_0x5db010){return function(_0x4ffe54){if(_0x4ffe54){var _0x547e28=typeof _0x5db010['offset']===_0xd9ff('0x1d')&&typeof _0x5db010['limit']===_0xd9ff('0x1d');var _0xa30fd2=_0x4ffe54[_0xd9ff('0x1e')];var _0x3afd19=_0x547e28?0x0:_0x5db010[_0xd9ff('0x1f')];var _0x2d4df1=_0x547e28?_0x4ffe54[_0xd9ff('0x1e')]:_0x5db010[_0xd9ff('0x1f')]+_0x5db010[_0xd9ff('0x20')];var _0x1f028f;if(_0x2d4df1>=_0xa30fd2){_0x2d4df1=_0xa30fd2;_0x1f028f=0xc8;}else{_0x1f028f=0xce;}_0xf14c9f[_0xd9ff('0x1b')](_0x1f028f);return _0xf14c9f[_0xd9ff('0x21')](_0xd9ff('0x22'),_0x3afd19+'-'+_0x2d4df1+'/'+_0xa30fd2)['json'](_0x4ffe54);}return null;};}function patchUpdates(_0x4cf8ec){return function(_0x264a3d){try{jsonpatch[_0xd9ff('0x23')](_0x264a3d,_0x4cf8ec,!![]);}catch(_0x4eea4d){return BPromise['reject'](_0x4eea4d);}return _0x264a3d['save']();};}function saveUpdates(_0x4b1477,_0x1f4d9e){return function(_0x58eb5f){if(_0x58eb5f){return _0x58eb5f[_0xd9ff('0x24')](_0x4b1477)[_0xd9ff('0x25')](function(_0x291f52){return _0x291f52;});}return null;};}function removeEntity(_0x9f074e,_0x278b66){return function(_0x42a828){if(_0x42a828){return _0x42a828['destroy']()['then'](function(){var _0x1136e9=_0x42a828['get']({'plain':!![]});var _0x3ca906='Voicemails';return db[_0xd9ff('0x26')]['destroy']({'where':{'type':_0x3ca906,'resourceId':_0x1136e9['id']}})[_0xd9ff('0x25')](function(){return _0x42a828;});})[_0xd9ff('0x25')](function(){_0x9f074e[_0xd9ff('0x1b')](0xcc)[_0xd9ff('0x1c')]();});}};}function handleEntityNotFound(_0x5d685e,_0x11a17b){return function(_0xe11f88){if(!_0xe11f88){_0x5d685e[_0xd9ff('0x1a')](0x194);}return _0xe11f88;};}function handleError(_0x4390f7,_0x5c1c1f){_0x5c1c1f=_0x5c1c1f||0x1f4;return function(_0x1d3684){logger[_0xd9ff('0x27')](_0x1d3684[_0xd9ff('0x28')]);if(_0x1d3684[_0xd9ff('0x29')]){delete _0x1d3684[_0xd9ff('0x29')];}_0x4390f7[_0xd9ff('0x1b')](_0x5c1c1f)[_0xd9ff('0x2a')](_0x1d3684);};}exports[_0xd9ff('0x2b')]=function(_0x3dc443,_0x5706cf){var _0xcea5db={},_0x4ba2be={},_0x1d55fd={'count':0x0,'rows':[]};var _0x29c532=_[_0xd9ff('0x2c')](db['VoiceMail'][_0xd9ff('0x2d')],function(_0x3b26da){return{'name':_0x3b26da[_0xd9ff('0x2e')],'type':_0x3b26da[_0xd9ff('0x2f')]['key']};});_0x4ba2be[_0xd9ff('0x30')]=_['map'](_0x29c532,_0xd9ff('0x29'));_0x4ba2be[_0xd9ff('0x31')]=_[_0xd9ff('0x32')](_0x3dc443[_0xd9ff('0x31')]);_0x4ba2be[_0xd9ff('0x33')]=_[_0xd9ff('0x34')](_0x4ba2be[_0xd9ff('0x30')],_0x4ba2be[_0xd9ff('0x31')]);_0xcea5db[_0xd9ff('0x35')]=_[_0xd9ff('0x34')](_0x4ba2be[_0xd9ff('0x30')],qs[_0xd9ff('0x36')](_0x3dc443[_0xd9ff('0x31')][_0xd9ff('0x36')]));_0xcea5db['attributes']=_0xcea5db[_0xd9ff('0x35')][_0xd9ff('0x37')]?_0xcea5db[_0xd9ff('0x35')]:_0x4ba2be['model'];if(!_0x3dc443[_0xd9ff('0x31')]['hasOwnProperty'](_0xd9ff('0x38'))){_0xcea5db['limit']=qs[_0xd9ff('0x20')](_0x3dc443['query'][_0xd9ff('0x20')]);_0xcea5db[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x3dc443['query']['offset']);}_0xcea5db['order']=qs[_0xd9ff('0x39')](_0x3dc443[_0xd9ff('0x31')][_0xd9ff('0x39')]);_0xcea5db[_0xd9ff('0x3a')]=qs[_0xd9ff('0x33')](_[_0xd9ff('0x3b')](_0x3dc443['query'],_0x4ba2be['filters']),_0x29c532);if(_0x3dc443['query'][_0xd9ff('0x3c')]){_0xcea5db[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0xcea5db[_0xd9ff('0x3a')],{'$or':_['map'](_0x29c532,function(_0x2692c0){if(_0x2692c0['type']!==_0xd9ff('0x3e')){var _0x3e2beb={};_0x3e2beb[_0x2692c0[_0xd9ff('0x29')]]={'$like':'%'+_0x3dc443[_0xd9ff('0x31')]['filter']+'%'};return _0x3e2beb;}})});}_0xcea5db=_[_0xd9ff('0x3d')]({},_0xcea5db,_0x3dc443[_0xd9ff('0x3f')]);var _0x4961a7={'where':_0xcea5db[_0xd9ff('0x3a')]};return db[_0xd9ff('0x40')][_0xd9ff('0x1e')](_0x4961a7)[_0xd9ff('0x25')](function(_0x1fe44d){_0x1d55fd[_0xd9ff('0x1e')]=_0x1fe44d;if(_0x3dc443['query'][_0xd9ff('0x41')]){_0xcea5db[_0xd9ff('0x42')]=[{'all':!![]}];}return db[_0xd9ff('0x40')][_0xd9ff('0x43')](_0xcea5db);})[_0xd9ff('0x25')](function(_0x52aab8){_0x1d55fd[_0xd9ff('0x44')]=_0x52aab8;return _0x1d55fd;})[_0xd9ff('0x25')](respondWithFilteredResult(_0x5706cf,_0xcea5db))[_0xd9ff('0x45')](handleError(_0x5706cf,null));};exports['show']=function(_0x5d06dd,_0x36843b){var _0x7eb1a={'raw':!![],'where':{'id':_0x5d06dd[_0xd9ff('0x46')]['id']}},_0x18d1c4={};_0x18d1c4[_0xd9ff('0x30')]=_[_0xd9ff('0x32')](db['VoiceMail'][_0xd9ff('0x2d')]);_0x18d1c4[_0xd9ff('0x31')]=_['keys'](_0x5d06dd[_0xd9ff('0x31')]);_0x18d1c4[_0xd9ff('0x33')]=_[_0xd9ff('0x34')](_0x18d1c4[_0xd9ff('0x30')],_0x18d1c4[_0xd9ff('0x31')]);_0x7eb1a['attributes']=_['intersection'](_0x18d1c4['model'],qs[_0xd9ff('0x36')](_0x5d06dd['query'][_0xd9ff('0x36')]));_0x7eb1a[_0xd9ff('0x35')]=_0x7eb1a[_0xd9ff('0x35')]['length']?_0x7eb1a[_0xd9ff('0x35')]:_0x18d1c4[_0xd9ff('0x30')];if(_0x5d06dd['query'][_0xd9ff('0x41')]){_0x7eb1a[_0xd9ff('0x42')]=[{'all':!![]}];}_0x7eb1a=_[_0xd9ff('0x3d')]({},_0x7eb1a,_0x5d06dd[_0xd9ff('0x3f')]);return db['VoiceMail'][_0xd9ff('0x47')](_0x7eb1a)['then'](handleEntityNotFound(_0x36843b,null))[_0xd9ff('0x25')](respondWithResult(_0x36843b,null))['catch'](handleError(_0x36843b,null));};exports[_0xd9ff('0x48')]=function(_0x3d91e6,_0x2bf37a){return db[_0xd9ff('0x40')][_0xd9ff('0x48')](_0x3d91e6['body'],{})[_0xd9ff('0x25')](function(_0x3d6f11){var _0x2fbe53=_0x3d91e6[_0xd9ff('0x49')]['get']({'plain':!![]});if(!_0x2fbe53)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fbe53['role']===_0xd9ff('0x49')){var _0x40be56=_0x3d6f11[_0xd9ff('0x4a')]({'plain':!![]});var _0x572618=_0xd9ff('0x4b');return db[_0xd9ff('0x4c')][_0xd9ff('0x47')]({'where':{'name':_0x572618,'userProfileId':_0x2fbe53[_0xd9ff('0x4d')]},'raw':!![]})[_0xd9ff('0x25')](function(_0x40d391){if(_0x40d391&&_0x40d391[_0xd9ff('0x4e')]===0x0){return db[_0xd9ff('0x26')][_0xd9ff('0x48')]({'name':_0x40be56[_0xd9ff('0x29')],'resourceId':_0x40be56['id'],'type':_0x40d391[_0xd9ff('0x29')],'sectionId':_0x40d391['id']},{})[_0xd9ff('0x25')](function(){return _0x3d6f11;});}else{return _0x3d6f11;}})[_0xd9ff('0x45')](function(_0x487b07){logger[_0xd9ff('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x487b07);throw _0x487b07;});}return _0x3d6f11;})[_0xd9ff('0x25')](respondWithResult(_0x2bf37a,0xc9))['catch'](handleError(_0x2bf37a,null));};exports[_0xd9ff('0x24')]=function(_0x49623d,_0xc82610){if(_0x49623d['body']['id']){delete _0x49623d[_0xd9ff('0x4f')]['id'];}return db['VoiceMail'][_0xd9ff('0x47')]({'where':{'id':_0x49623d['params']['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0xc82610,null))['then'](saveUpdates(_0x49623d[_0xd9ff('0x4f')],null))[_0xd9ff('0x25')](respondWithResult(_0xc82610,null))[_0xd9ff('0x45')](handleError(_0xc82610,null));};exports[_0xd9ff('0x50')]=function(_0x4df17b,_0x8c136b){return db[_0xd9ff('0x40')][_0xd9ff('0x47')]({'where':{'id':_0x4df17b['params']['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x8c136b,null))[_0xd9ff('0x25')](removeEntity(_0x8c136b,null))[_0xd9ff('0x45')](handleError(_0x8c136b,null));};exports[_0xd9ff('0x51')]=function(_0x11dd0c,_0x56e8e8,_0x27cc9e){return db[_0xd9ff('0x40')][_0xd9ff('0x52')]({'where':{'id':_0x11dd0c[_0xd9ff('0x46')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x56e8e8,null))[_0xd9ff('0x25')](function(_0x458fd4){var _0x5bac6f;var _0x3be850={},_0x11251f={};_0x11251f['model']=_[_0xd9ff('0x32')](db[_0xd9ff('0x53')]['rawAttributes']);_0x11251f[_0xd9ff('0x31')]=_[_0xd9ff('0x32')](_0x11dd0c[_0xd9ff('0x31')]);_0x11251f['filters']=_['intersection'](_0x11251f[_0xd9ff('0x30')],_0x11251f['query']);_0x3be850[_0xd9ff('0x35')]=_[_0xd9ff('0x34')](_0x11251f[_0xd9ff('0x30')],qs[_0xd9ff('0x36')](_0x11dd0c['query']['fields']));_0x3be850['attributes']=_0x3be850[_0xd9ff('0x35')][_0xd9ff('0x37')]?_0x3be850[_0xd9ff('0x35')]:_0x11251f[_0xd9ff('0x30')];if(!_0x11dd0c[_0xd9ff('0x31')]['hasOwnProperty'](_0xd9ff('0x38'))){_0x3be850['limit']=qs[_0xd9ff('0x20')](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x20')]);_0x3be850[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x1f')]);}_0x3be850[_0xd9ff('0x54')]=qs['sort'](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x39')]);_0x3be850['where']=qs['filters'](_[_0xd9ff('0x3b')](_0x11dd0c['query'],_0x11251f[_0xd9ff('0x33')]));if(_0x11dd0c[_0xd9ff('0x31')]['filter']){_0x3be850[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0x3be850[_0xd9ff('0x3a')],{'$or':_[_0xd9ff('0x2c')](_0x3be850[_0xd9ff('0x35')],function(_0x49c5fa){var _0x12a8d7={};_0x12a8d7[_0x49c5fa]={'$like':'%'+_0x11dd0c['query']['filter']+'%'};return _0x12a8d7;})});}_0x3be850[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0x3be850[_0xd9ff('0x3a')],{'mailboxuser':_0x458fd4[_0xd9ff('0x55')]});_0x3be850=_['merge']({},_0x3be850,_0x11dd0c[_0xd9ff('0x3f')]);return db[_0xd9ff('0x53')][_0xd9ff('0x56')](_0x3be850)[_0xd9ff('0x25')](respondWithFilteredResult(_0x56e8e8,_0x3be850));})[_0xd9ff('0x45')](handleError(_0x56e8e8,null));};
\ No newline at end of file