Built motion from commit 973e3e332e1c8e2f84c4b0cd2e5af794131724f5. Version 3.0.0...
[motion-next.git] / server / api / voiceMusicOnHold / voiceMusicOnHold.controller.js
index 068d076..aa2f23a 100644 (file)
@@ -1 +1 @@
-const a742_0x585c=['type','findOne','basename','directory','filter','fields','undefined','catch','findAll','../../config/environment','user','symlinkSync','role','autoAssociation','%s.%s','intersection','where','update','name','addSound','message','filters','id2','VoiceMusicOnHold','model','params','send','forEach','body','unlinkSync','stack','like','merge','offset','getSounds','rawAttributes','count','transaction','mkdirSync','MusicOnHolds','../../config/logger','destroy','sequelize','order','../../components/parsers/qs','save_name','pick','Sound','query','rows','VIRTUAL','converted_format','create','map','rmdirSync','keys','nolimit','include','removeSound','limit','UserProfileSection','error','readdirSync','Content-Range','sort','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','show','status','get','util','../../mysqldb','mode','length','attributes','fieldName','includeAll','UserProfileResource','index','set','userProfileId','api','server/files/sounds/converted','json','key','join','then','format','server/files/moh','options','root','files','end'];(function(_0xe16ed7,_0x585c65){const _0x1db7a5=function(_0x510331){while(--_0x510331){_0xe16ed7['push'](_0xe16ed7['shift']());}};_0x1db7a5(++_0x585c65);}(a742_0x585c,0xad));const a742_0x1db7=function(_0xe16ed7,_0x585c65){_0xe16ed7=_0xe16ed7-0x0;let _0x1db7a5=a742_0x585c[_0xe16ed7];return _0x1db7a5;};const _0xb40445=a742_0x1db7;'use strict';const util=require(_0xb40445('0x50')),path=require('path'),fs=require('fs'),_=require('lodash'),qs=require(_0xb40445('0x37')),logger=require(_0xb40445('0x33'))(_0xb40445('0x5b')),config=require(_0xb40445('0x14')),db=require(_0xb40445('0x51'))['db'],{Op,ValidationError}=require(_0xb40445('0x35'));function respondWithStatusCode(_0x510331,_0x6eb76f){return _0x6eb76f=_0x6eb76f||0xcc,function(_0x4b82d3){const _0x9e5c=a742_0x1db7;if(_0x4b82d3)return _0x510331['sendStatus'](_0x6eb76f);return _0x510331[_0x9e5c('0x4e')](_0x6eb76f)[_0x9e5c('0xa')]();};}function respondWithResult(_0x3b52c2,_0xb6ccca){return _0xb6ccca=_0xb6ccca||0xc8,function(_0x2fa946){const _0x241b93=a742_0x1db7;if(_0x2fa946)return _0x3b52c2[_0x241b93('0x4e')](_0xb6ccca)[_0x241b93('0x1')](_0x2fa946);};}function respondWithFilteredResult(_0x1a134b,_0x37c248){return function(_0x51a1b4){const _0x3310ff=a742_0x1db7;if(_0x51a1b4){const _0x449345=_0x51a1b4[_0x3310ff('0x2f')],_0x466f88=_0x37c248[_0x3310ff('0x2c')];let _0x2d55fd=_0x37c248['offset']+_0x37c248[_0x3310ff('0x46')],_0x207129;return _0x2d55fd>=_0x449345?(_0x2d55fd=_0x449345,_0x207129=0xc8):_0x207129=0xce,_0x1a134b[_0x3310ff('0x4e')](_0x207129),_0x1a134b[_0x3310ff('0x59')](_0x3310ff('0x4a'),_0x466f88+'-'+_0x2d55fd+'/'+_0x449345)[_0x3310ff('0x1')](_0x51a1b4);}return null;};}function saveUpdates(_0x331adc){return function(_0xf8f2c){const _0x382b8f=a742_0x1db7;if(_0xf8f2c)return _0xf8f2c[_0x382b8f('0x1c')](_0x331adc)['then'](function(_0x5145c2){return _0x5145c2;});return null;};}function removeEntity(_0xc70ab1){return function(_0x1b5e9c){const _0x49cdbe=a742_0x1db7;if(_0x1b5e9c)return _0x1b5e9c['destroy']()[_0x49cdbe('0x4')](function(){const _0x455c6c=_0x49cdbe,_0x121b17=_0x1b5e9c['get']({'plain':!![]}),_0x27d5e8=_0x455c6c('0x32');return db[_0x455c6c('0x57')]['destroy']({'where':{'type':_0x27d5e8,'resourceId':_0x121b17['id']}})[_0x455c6c('0x4')](function(){return _0x1b5e9c;});})[_0x49cdbe('0x4')](function(){const _0x59d0fb=_0x49cdbe;_0xc70ab1[_0x59d0fb('0x4e')](0xcc)['end']();});};}function handleEntityNotFound(_0x4ee88a){return function(_0x24a4ac){return!_0x24a4ac&&_0x4ee88a['sendStatus'](0x194),_0x24a4ac;};}function handleError(_0x2ac32c,_0x53739b){return _0x53739b=_0x53739b||0x1f4,function(_0x3268e8){const _0x3d08f5=a742_0x1db7;logger[_0x3d08f5('0x48')](_0x3268e8[_0x3d08f5('0x29')]),_0x3268e8[_0x3d08f5('0x1d')]&&delete _0x3268e8[_0x3d08f5('0x1d')],_0x2ac32c[_0x3d08f5('0x4e')](_0x53739b)[_0x3d08f5('0x25')](_0x3268e8);};}exports[_0xb40445('0x58')]=function(_0x31f8f8,_0x4dce96){const _0x366e3c=_0xb40445;let _0x4eadff={};const _0x4f36b2={},_0x4a92de={'count':0x0,'rows':[]},_0x45470b=_['map'](db['VoiceMusicOnHold'][_0x366e3c('0x2e')],function(_0x327041){const _0x573a55=_0x366e3c;return{'name':_0x327041[_0x573a55('0x55')],'type':_0x327041[_0x573a55('0xb')][_0x573a55('0x2')]};});_0x4f36b2[_0x366e3c('0x23')]=_['map'](_0x45470b,_0x366e3c('0x1d')),_0x4f36b2[_0x366e3c('0x3b')]=_['keys'](_0x31f8f8[_0x366e3c('0x3b')]),_0x4f36b2[_0x366e3c('0x20')]=_[_0x366e3c('0x1a')](_0x4f36b2[_0x366e3c('0x23')],_0x4f36b2[_0x366e3c('0x3b')]),_0x4eadff[_0x366e3c('0x54')]=_[_0x366e3c('0x1a')](_0x4f36b2[_0x366e3c('0x23')],qs[_0x366e3c('0x10')](_0x31f8f8['query'][_0x366e3c('0x10')])),_0x4eadff[_0x366e3c('0x54')]=_0x4eadff[_0x366e3c('0x54')][_0x366e3c('0x53')]?_0x4eadff[_0x366e3c('0x54')]:_0x4f36b2[_0x366e3c('0x23')];typeof _0x31f8f8['query'][_0x366e3c('0x43')]===_0x366e3c('0x11')&&(_0x4eadff[_0x366e3c('0x46')]=qs[_0x366e3c('0x46')](_0x31f8f8[_0x366e3c('0x3b')]['limit']),_0x4eadff[_0x366e3c('0x2c')]=qs[_0x366e3c('0x2c')](_0x31f8f8['query'][_0x366e3c('0x2c')]));_0x4eadff[_0x366e3c('0x36')]=qs['sort'](_0x31f8f8[_0x366e3c('0x3b')][_0x366e3c('0x4b')]),_0x4eadff[_0x366e3c('0x1b')]=qs[_0x366e3c('0x20')](_[_0x366e3c('0x39')](_0x31f8f8[_0x366e3c('0x3b')],_0x4f36b2['filters']),_0x45470b);_0x31f8f8[_0x366e3c('0x3b')]['filter']&&(_0x4eadff[_0x366e3c('0x1b')]=_[_0x366e3c('0x2b')](_0x4eadff[_0x366e3c('0x1b')],{[Op['or']]:_[_0x366e3c('0x40')](_0x45470b,function(_0x454e45){const _0x2db5eb=_0x366e3c;if(_0x454e45[_0x2db5eb('0xb')]!==_0x2db5eb('0x3d')){const _0x49d2be={};return _0x49d2be[_0x454e45['name']]={[Op[_0x2db5eb('0x2a')]]:'%'+_0x31f8f8[_0x2db5eb('0x3b')][_0x2db5eb('0xf')]+'%'},_0x49d2be;}})}));_0x4eadff=_[_0x366e3c('0x2b')]({},_0x4eadff,_0x31f8f8['options']);const _0x2d64ff={'where':_0x4eadff[_0x366e3c('0x1b')]};return db[_0x366e3c('0x22')][_0x366e3c('0x2f')](_0x2d64ff)['then'](function(_0x2b756b){const _0x585459=_0x366e3c;return _0x4a92de[_0x585459('0x2f')]=_0x2b756b,_0x31f8f8[_0x585459('0x3b')][_0x585459('0x56')]&&(_0x4eadff[_0x585459('0x44')]=[{'all':!![]}]),db[_0x585459('0x22')][_0x585459('0x13')](_0x4eadff);})['then'](function(_0x26b0de){const _0x5e2109=_0x366e3c;return _0x4a92de[_0x5e2109('0x3c')]=_0x26b0de,_0x4a92de;})['then'](respondWithFilteredResult(_0x4dce96,_0x4eadff))[_0x366e3c('0x12')](handleError(_0x4dce96,null));},exports[_0xb40445('0x4d')]=function(_0x3d7278,_0x4c78b9){const _0x268d3e=_0xb40445;let _0x2e3142={'raw':![],'where':{'id':_0x3d7278[_0x268d3e('0x24')]['id']}};const _0x3d8c14={};return _0x3d8c14[_0x268d3e('0x23')]=_[_0x268d3e('0x42')](db[_0x268d3e('0x22')][_0x268d3e('0x2e')]),_0x3d8c14[_0x268d3e('0x3b')]=_['keys'](_0x3d7278[_0x268d3e('0x3b')]),_0x3d8c14[_0x268d3e('0x20')]=_[_0x268d3e('0x1a')](_0x3d8c14[_0x268d3e('0x23')],_0x3d8c14['query']),_0x2e3142[_0x268d3e('0x54')]=_[_0x268d3e('0x1a')](_0x3d8c14['model'],qs['fields'](_0x3d7278[_0x268d3e('0x3b')][_0x268d3e('0x10')])),_0x2e3142[_0x268d3e('0x54')]=_0x2e3142['attributes'][_0x268d3e('0x53')]?_0x2e3142['attributes']:_0x3d8c14[_0x268d3e('0x23')],_0x3d7278['query'][_0x268d3e('0x56')]&&(_0x2e3142[_0x268d3e('0x44')]=[{'all':!![]}]),_0x2e3142=_[_0x268d3e('0x2b')]({},_0x2e3142,_0x3d7278[_0x268d3e('0x7')]),db[_0x268d3e('0x22')]['findOne'](_0x2e3142)[_0x268d3e('0x4')](handleEntityNotFound(_0x4c78b9,null))[_0x268d3e('0x4')](respondWithResult(_0x4c78b9,null))['catch'](handleError(_0x4c78b9,null));},exports[_0xb40445('0x1c')]=function(_0x21fea6,_0x8e6dc7){const _0x160690=_0xb40445;return _0x21fea6['body']['id']&&delete _0x21fea6['body']['id'],db[_0x160690('0x22')]['findOne']({'where':{'id':_0x21fea6[_0x160690('0x24')]['id']}})[_0x160690('0x4')](handleEntityNotFound(_0x8e6dc7,null))[_0x160690('0x4')](saveUpdates(_0x21fea6[_0x160690('0x27')],null))[_0x160690('0x4')](respondWithResult(_0x8e6dc7,null))[_0x160690('0x12')](handleError(_0x8e6dc7,null));},exports['create']=function(_0x522dd9,_0x49f118){const _0x3ade85=_0xb40445;return db[_0x3ade85('0x35')][_0x3ade85('0x30')](function(_0x3510f0){const _0xbbacd6=_0x3ade85;return _0x522dd9[_0xbbacd6('0x27')][_0xbbacd6('0x52')]===_0xbbacd6('0x9')&&(_0x522dd9[_0xbbacd6('0x27')][_0xbbacd6('0xe')]=path[_0xbbacd6('0x3')](config['root'],'server/files/moh',_0x522dd9[_0xbbacd6('0x27')][_0xbbacd6('0x1d')])),db[_0xbbacd6('0x22')][_0xbbacd6('0x3f')](_0x522dd9['body'],{'transaction':_0x3510f0})[_0xbbacd6('0x4')](function(_0x1045b5){const _0x27bda2=_0xbbacd6;_0x522dd9['body'][_0x27bda2('0x52')]===_0x27bda2('0x9')&&fs[_0x27bda2('0x31')](_0x1045b5[_0x27bda2('0xe')],parseInt('0777',0x8));const _0x4ec967=_0x522dd9[_0x27bda2('0x15')][_0x27bda2('0x4f')]({'plain':!![]});if(!_0x4ec967)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ec967[_0x27bda2('0x17')]==='user'){const _0x3efcc0=_0x1045b5[_0x27bda2('0x4f')]({'plain':!![]});return db[_0x27bda2('0x47')][_0x27bda2('0xc')]({'where':{'name':'MusicOnHolds','userProfileId':_0x4ec967[_0x27bda2('0x5a')]},'raw':!![]})[_0x27bda2('0x4')](function(_0x529ed5){const _0x2496c0=_0x27bda2;return _0x529ed5&&_0x529ed5[_0x2496c0('0x18')]===0x0?db['UserProfileResource'][_0x2496c0('0x3f')]({'name':_0x3efcc0['name'],'resourceId':_0x3efcc0['id'],'type':_0x529ed5[_0x2496c0('0x1d')],'sectionId':_0x529ed5['id']},{})[_0x2496c0('0x4')](function(){return _0x1045b5;}):_0x1045b5;})[_0x27bda2('0x12')](function(_0x407f36){const _0x3c067c=_0x27bda2;logger['error'](_0x3c067c('0x4c'),_0x407f36);});}return _0x1045b5;});})['then'](respondWithResult(_0x49f118,0xc9))['catch'](handleError(_0x49f118,null));},exports[_0xb40445('0x34')]=function(_0x1d93e5,_0x95169b){const _0x159058=_0xb40445;return db[_0x159058('0x22')][_0x159058('0xc')]({'where':{'id':_0x1d93e5[_0x159058('0x24')]['id']}})[_0x159058('0x4')](function(_0x39748d){const _0xacf5df=_0x159058;if(_0x39748d)return db[_0xacf5df('0x35')][_0xacf5df('0x30')](function(_0x946d6f){const _0x3bc70d=_0xacf5df;return _0x39748d[_0x3bc70d('0x34')]({'transaction':_0x946d6f,'raw':!![]})[_0x3bc70d('0x4')](function(_0x1b00ed){const _0x2e6d53=_0x3bc70d;return _0x1b00ed[_0x2e6d53('0xe')]&&(fs[_0x2e6d53('0x49')](_0x1b00ed['directory'])[_0x2e6d53('0x26')](function(_0x3ece78){const _0x3f5c46=_0x2e6d53;fs[_0x3f5c46('0x28')](path[_0x3f5c46('0x3')](_0x1b00ed[_0x3f5c46('0xe')],_0x3ece78));}),fs[_0x2e6d53('0x41')](_0x1b00ed[_0x2e6d53('0xe')])),_0x1b00ed;});})[_0xacf5df('0x12')](function(_0x6522a9){const _0x26029c=_0xacf5df;throw new ValidationError(_0x6522a9[_0x26029c('0x1f')]);});})[_0x159058('0x4')](handleEntityNotFound(_0x95169b,null))[_0x159058('0x4')](removeEntity(_0x95169b,null))[_0x159058('0x12')](handleError(_0x95169b,null));},exports[_0xb40445('0x1e')]=function(_0x25666a,_0xc28998){const _0x16a5a5=_0xb40445;return db[_0x16a5a5('0x35')][_0x16a5a5('0x30')](function(_0x5a05b1){const _0x23ef04=_0x16a5a5;let _0x528fed;return db[_0x23ef04('0x22')][_0x23ef04('0xc')]({'where':{'id':_0x25666a[_0x23ef04('0x24')]['id']}})[_0x23ef04('0x4')](function(_0x2d13a0){const _0x4d0ba1=_0x23ef04;if(_0x2d13a0)return _0x528fed=_0x2d13a0,_0x2d13a0[_0x4d0ba1('0x1e')](_0x25666a[_0x4d0ba1('0x27')]['id'],{'transaction':_0x5a05b1});})[_0x23ef04('0x4')](function(_0x5281b2){const _0x30e780=_0x23ef04;if(_0x5281b2)return db[_0x30e780('0x3a')]['findOne']({'where':{'id':_0x25666a[_0x30e780('0x27')]['id']},'attributes':['id',_0x30e780('0x1d'),_0x30e780('0x38'),'converted_format','createdAt'],'raw':!![]});})[_0x23ef04('0x4')](function(_0x48e8ef){const _0x55e8f1=_0x23ef04;if(_0x48e8ef){const _0x4873e2=path[_0x55e8f1('0x3')](config['root'],_0x55e8f1('0x0'),util[_0x55e8f1('0x5')](_0x55e8f1('0x19'),path[_0x55e8f1('0xd')](_0x48e8ef['save_name'],path['extname'](_0x48e8ef[_0x55e8f1('0x38')])),_0x48e8ef[_0x55e8f1('0x3e')])),_0x2788fa=path[_0x55e8f1('0x3')](config[_0x55e8f1('0x8')],_0x55e8f1('0x6'),_0x528fed[_0x55e8f1('0x1d')],util['format']('%s.%s',_0x48e8ef[_0x55e8f1('0x1d')],_0x48e8ef[_0x55e8f1('0x3e')]));return fs[_0x55e8f1('0x16')](_0x4873e2,_0x2788fa),_0x48e8ef;}})[_0x23ef04('0x12')](function(_0xa01b4){const _0x54598d=_0x23ef04;throw new ValidationError(_0xa01b4[_0x54598d('0x1f')]);});})['then'](handleEntityNotFound(_0xc28998,null))[_0x16a5a5('0x4')](respondWithResult(_0xc28998,0xc9))[_0x16a5a5('0x12')](handleError(_0xc28998,null));},exports[_0xb40445('0x45')]=function(_0x4b1a10,_0x2569f9){const _0xc6a16c=_0xb40445;return db[_0xc6a16c('0x35')][_0xc6a16c('0x30')](function(){const _0x4585a1=_0xc6a16c;let _0x31657e;return db[_0x4585a1('0x22')]['findOne']({'where':{'id':_0x4b1a10[_0x4585a1('0x24')]['id']}})[_0x4585a1('0x4')](handleEntityNotFound(_0x2569f9,null))[_0x4585a1('0x4')](function(_0x4e3401){const _0x1bbabe=_0x4585a1;if(_0x4e3401)return _0x31657e=_0x4e3401,_0x4e3401[_0x1bbabe('0x45')](_0x4b1a10[_0x1bbabe('0x24')][_0x1bbabe('0x21')]);})['then'](function(_0x38af86){const _0x132b20=_0x4585a1;if(_0x38af86)return db[_0x132b20('0x3a')][_0x132b20('0xc')]({'where':{'id':_0x4b1a10[_0x132b20('0x24')][_0x132b20('0x21')]},'attributes':['id',_0x132b20('0x1d'),_0x132b20('0x38'),_0x132b20('0x3e'),'createdAt'],'raw':!![]});})[_0x4585a1('0x4')](function(_0x30a704){const _0x335425=_0x4585a1;if(_0x30a704)return fs[_0x335425('0x28')](path[_0x335425('0x3')](_0x31657e[_0x335425('0xe')],util[_0x335425('0x5')](_0x335425('0x19'),_0x30a704[_0x335425('0x1d')],_0x30a704[_0x335425('0x3e')]))),_0x30a704;})['catch'](function(_0x5cebcf){const _0x4b7c50=_0x4585a1;throw new ValidationError(_0x5cebcf[_0x4b7c50('0x1f')]);});})['then'](handleEntityNotFound(_0x2569f9,null))[_0xc6a16c('0x4')](respondWithStatusCode(_0x2569f9,0xcc))[_0xc6a16c('0x12')](handleError(_0x2569f9,null));},exports['getSounds']=function(_0x58930a,_0x3e2ac8){const _0x2001f1=_0xb40445;let _0x439f1c={};const _0x49197f={};let _0x26def9,_0x360cd9;return db[_0x2001f1('0x22')][_0x2001f1('0xc')]({'where':{'id':_0x58930a['params']['id']}})[_0x2001f1('0x4')](handleEntityNotFound(_0x3e2ac8,null))[_0x2001f1('0x4')](function(_0x200ba8){const _0x29dc8a=_0x2001f1;if(_0x200ba8)return _0x26def9=_0x200ba8,_0x49197f[_0x29dc8a('0x23')]=_['keys'](db[_0x29dc8a('0x3a')][_0x29dc8a('0x2e')]),_0x49197f[_0x29dc8a('0x3b')]=_[_0x29dc8a('0x42')](_0x58930a[_0x29dc8a('0x3b')]),_0x49197f[_0x29dc8a('0x20')]=_[_0x29dc8a('0x1a')](_0x49197f[_0x29dc8a('0x23')],_0x49197f[_0x29dc8a('0x3b')]),_0x439f1c[_0x29dc8a('0x54')]=_['intersection'](_0x49197f[_0x29dc8a('0x23')],qs[_0x29dc8a('0x10')](_0x58930a['query'][_0x29dc8a('0x10')])),_0x439f1c['attributes']=_0x439f1c[_0x29dc8a('0x54')][_0x29dc8a('0x53')]?_0x439f1c[_0x29dc8a('0x54')]:_0x49197f[_0x29dc8a('0x23')],_0x439f1c[_0x29dc8a('0x36')]=qs[_0x29dc8a('0x4b')](_0x58930a['query'][_0x29dc8a('0x4b')]),_0x439f1c[_0x29dc8a('0x1b')]=qs[_0x29dc8a('0x20')](_[_0x29dc8a('0x39')](_0x58930a[_0x29dc8a('0x3b')],_0x49197f['filters'])),_0x58930a[_0x29dc8a('0x3b')]['filter']&&(_0x439f1c[_0x29dc8a('0x1b')]=_[_0x29dc8a('0x2b')](_0x439f1c['where'],{[Op['or']]:_['map'](_0x439f1c[_0x29dc8a('0x54')],function(_0x281cc2){const _0x2ad25f=_0x29dc8a,_0x31c3f6={};return _0x31c3f6[_0x281cc2]={[Op[_0x2ad25f('0x2a')]]:'%'+_0x58930a[_0x2ad25f('0x3b')][_0x2ad25f('0xf')]+'%'},_0x31c3f6;})})),_0x439f1c=_['merge']({},_0x439f1c,_0x58930a['options']),_0x26def9[_0x29dc8a('0x2d')](_0x439f1c);})[_0x2001f1('0x4')](function(_0x1ed6fe){const _0x4895b1=_0x2001f1;if(_0x1ed6fe)return _0x360cd9=_0x1ed6fe[_0x4895b1('0x53')],typeof _0x58930a[_0x4895b1('0x3b')][_0x4895b1('0x43')]===_0x4895b1('0x11')&&(_0x439f1c[_0x4895b1('0x46')]=qs[_0x4895b1('0x46')](_0x58930a[_0x4895b1('0x3b')][_0x4895b1('0x46')]),_0x439f1c[_0x4895b1('0x2c')]=qs[_0x4895b1('0x2c')](_0x58930a['query'][_0x4895b1('0x2c')])),_0x26def9[_0x4895b1('0x2d')](_0x439f1c);})[_0x2001f1('0x4')](function(_0x21c386){if(_0x21c386)return _0x21c386?{'count':_0x360cd9,'rows':_0x21c386}:null;})[_0x2001f1('0x4')](respondWithResult(_0x3e2ac8,null))[_0x2001f1('0x12')](handleError(_0x3e2ac8,null));};
\ No newline at end of file
+const a742_0x59e4=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','create','../../components/parsers/qs','../../config/environment','include','VoiceMusicOnHold','forEach','format','UserProfileResource','keys','attributes','../../config/logger','limit','transaction','filter','count','findAll','then','findOne','message','status','%s.%s','where','catch','get','removeSound','key','error','fieldName','VIRTUAL','MusicOnHolds','body','end','0777','Sound','readdirSync','root','nolimit','../../mysqldb','destroy','fields','sequelize','type','mkdirSync','server/files/moh','id2','includeAll','role','order','basename','index','length','addSound','UserProfileSection','intersection','userProfileId','directory','sendStatus','api','map','user','json','rawAttributes','merge','save_name','mode','createdAt','autoAssociation','symlinkSync','rows','lodash','sort','undefined','server/files/sounds/converted','join','update','query','offset','options','files','converted_format','path','Unable\x20to\x20retrieve\x20the\x20current\x20user','rmdirSync','name','Content-Range','params','getSounds','filters','like','model'];(function(_0x2429ea,_0x59e471){const _0x352615=function(_0x107d45){while(--_0x107d45){_0x2429ea['push'](_0x2429ea['shift']());}};_0x352615(++_0x59e471);}(a742_0x59e4,0x6c));const a742_0x3526=function(_0x2429ea,_0x59e471){_0x2429ea=_0x2429ea-0x0;let _0x352615=a742_0x59e4[_0x2429ea];return _0x352615;};const _0x52e6cc=a742_0x3526;'use strict';const util=require('util'),path=require(_0x52e6cc('0x40')),fs=require('fs'),_=require(_0x52e6cc('0x35')),qs=require(_0x52e6cc('0x4c')),logger=require(_0x52e6cc('0x55'))(_0x52e6cc('0x29')),config=require(_0x52e6cc('0x4d')),db=require(_0x52e6cc('0x15'))['db'],{Op,ValidationError}=require(_0x52e6cc('0x18'));function respondWithStatusCode(_0x107d45,_0x2a3375){return _0x2a3375=_0x2a3375||0xcc,function(_0x5beeb0){const _0x1dc17f=a742_0x3526;if(_0x5beeb0)return _0x107d45[_0x1dc17f('0x28')](_0x2a3375);return _0x107d45[_0x1dc17f('0x3')](_0x2a3375)[_0x1dc17f('0xf')]();};}function respondWithResult(_0x146f74,_0x4c2e26){return _0x4c2e26=_0x4c2e26||0xc8,function(_0x311db6){const _0x425bb5=a742_0x3526;if(_0x311db6)return _0x146f74[_0x425bb5('0x3')](_0x4c2e26)[_0x425bb5('0x2c')](_0x311db6);};}function respondWithFilteredResult(_0x2f717c,_0x2d359c){return function(_0x5a5b2f){const _0x251739=a742_0x3526;if(_0x5a5b2f){const _0x3a41dd=_0x5a5b2f['count'],_0x330c0e=_0x2d359c['offset'];let _0x30f5fe=_0x2d359c[_0x251739('0x3c')]+_0x2d359c['limit'],_0x438623;return _0x30f5fe>=_0x3a41dd?(_0x30f5fe=_0x3a41dd,_0x438623=0xc8):_0x438623=0xce,_0x2f717c[_0x251739('0x3')](_0x438623),_0x2f717c['set'](_0x251739('0x44'),_0x330c0e+'-'+_0x30f5fe+'/'+_0x3a41dd)[_0x251739('0x2c')](_0x5a5b2f);}return null;};}function saveUpdates(_0x37674d){return function(_0x335f87){const _0x36afc1=a742_0x3526;if(_0x335f87)return _0x335f87[_0x36afc1('0x3a')](_0x37674d)['then'](function(_0x589fb9){return _0x589fb9;});return null;};}function removeEntity(_0x281b5e){return function(_0x595c5f){const _0x15ee07=a742_0x3526;if(_0x595c5f)return _0x595c5f[_0x15ee07('0x16')]()['then'](function(){const _0x45e3a1=_0x15ee07,_0x4eafdd=_0x595c5f[_0x45e3a1('0x7')]({'plain':!![]}),_0x3487a2=_0x45e3a1('0xd');return db[_0x45e3a1('0x52')][_0x45e3a1('0x16')]({'where':{'type':_0x3487a2,'resourceId':_0x4eafdd['id']}})['then'](function(){return _0x595c5f;});})['then'](function(){const _0x5ae9da=_0x15ee07;_0x281b5e['status'](0xcc)[_0x5ae9da('0xf')]();});};}function handleEntityNotFound(_0x38ee51){return function(_0x1e0934){const _0x444c38=a742_0x3526;return!_0x1e0934&&_0x38ee51[_0x444c38('0x28')](0x194),_0x1e0934;};}function handleError(_0x1ea406,_0x311d84){return _0x311d84=_0x311d84||0x1f4,function(_0x3668ec){const _0x39167c=a742_0x3526;logger['error'](_0x3668ec['stack']),_0x3668ec['name']&&delete _0x3668ec[_0x39167c('0x43')],_0x1ea406[_0x39167c('0x3')](_0x311d84)['send'](_0x3668ec);};}exports[_0x52e6cc('0x21')]=function(_0x9d3115,_0x3e108f){const _0x1315e3=_0x52e6cc;let _0x3bcd35={};const _0x489c39={},_0x51843a={'count':0x0,'rows':[]},_0x25141a=_[_0x1315e3('0x2a')](db[_0x1315e3('0x4f')][_0x1315e3('0x2d')],function(_0x4ba679){const _0x54b735=_0x1315e3;return{'name':_0x4ba679[_0x54b735('0xb')],'type':_0x4ba679[_0x54b735('0x19')][_0x54b735('0x9')]};});_0x489c39['model']=_['map'](_0x25141a,_0x1315e3('0x43')),_0x489c39[_0x1315e3('0x3b')]=_[_0x1315e3('0x53')](_0x9d3115[_0x1315e3('0x3b')]),_0x489c39[_0x1315e3('0x47')]=_[_0x1315e3('0x25')](_0x489c39[_0x1315e3('0x49')],_0x489c39[_0x1315e3('0x3b')]),_0x3bcd35[_0x1315e3('0x54')]=_[_0x1315e3('0x25')](_0x489c39[_0x1315e3('0x49')],qs[_0x1315e3('0x17')](_0x9d3115[_0x1315e3('0x3b')][_0x1315e3('0x17')])),_0x3bcd35[_0x1315e3('0x54')]=_0x3bcd35[_0x1315e3('0x54')]['length']?_0x3bcd35[_0x1315e3('0x54')]:_0x489c39['model'];typeof _0x9d3115[_0x1315e3('0x3b')][_0x1315e3('0x14')]==='undefined'&&(_0x3bcd35[_0x1315e3('0x56')]=qs['limit'](_0x9d3115[_0x1315e3('0x3b')][_0x1315e3('0x56')]),_0x3bcd35[_0x1315e3('0x3c')]=qs['offset'](_0x9d3115[_0x1315e3('0x3b')][_0x1315e3('0x3c')]));_0x3bcd35[_0x1315e3('0x1f')]=qs[_0x1315e3('0x36')](_0x9d3115[_0x1315e3('0x3b')][_0x1315e3('0x36')]),_0x3bcd35[_0x1315e3('0x5')]=qs[_0x1315e3('0x47')](_['pick'](_0x9d3115[_0x1315e3('0x3b')],_0x489c39[_0x1315e3('0x47')]),_0x25141a);_0x9d3115[_0x1315e3('0x3b')][_0x1315e3('0x58')]&&(_0x3bcd35['where']=_['merge'](_0x3bcd35[_0x1315e3('0x5')],{[Op['or']]:_['map'](_0x25141a,function(_0x7216fa){const _0x4aa51e=_0x1315e3;if(_0x7216fa[_0x4aa51e('0x19')]!==_0x4aa51e('0xc')){const _0x55345c={};return _0x55345c[_0x7216fa['name']]={[Op[_0x4aa51e('0x48')]]:'%'+_0x9d3115[_0x4aa51e('0x3b')][_0x4aa51e('0x58')]+'%'},_0x55345c;}})}));_0x3bcd35=_[_0x1315e3('0x2e')]({},_0x3bcd35,_0x9d3115[_0x1315e3('0x3d')]);const _0x2f3e1a={'where':_0x3bcd35[_0x1315e3('0x5')]};return db[_0x1315e3('0x4f')][_0x1315e3('0x59')](_0x2f3e1a)['then'](function(_0x40b5ff){const _0x16c0bc=_0x1315e3;return _0x51843a[_0x16c0bc('0x59')]=_0x40b5ff,_0x9d3115[_0x16c0bc('0x3b')]['includeAll']&&(_0x3bcd35[_0x16c0bc('0x4e')]=[{'all':!![]}]),db[_0x16c0bc('0x4f')][_0x16c0bc('0x5a')](_0x3bcd35);})[_0x1315e3('0x0')](function(_0x72d42){const _0x341466=_0x1315e3;return _0x51843a[_0x341466('0x34')]=_0x72d42,_0x51843a;})[_0x1315e3('0x0')](respondWithFilteredResult(_0x3e108f,_0x3bcd35))['catch'](handleError(_0x3e108f,null));},exports['show']=function(_0xa07905,_0x4b3cb1){const _0x578f4d=_0x52e6cc;let _0x5cada1={'raw':![],'where':{'id':_0xa07905['params']['id']}};const _0x3c5c22={};return _0x3c5c22[_0x578f4d('0x49')]=_['keys'](db[_0x578f4d('0x4f')][_0x578f4d('0x2d')]),_0x3c5c22[_0x578f4d('0x3b')]=_[_0x578f4d('0x53')](_0xa07905['query']),_0x3c5c22[_0x578f4d('0x47')]=_['intersection'](_0x3c5c22[_0x578f4d('0x49')],_0x3c5c22[_0x578f4d('0x3b')]),_0x5cada1['attributes']=_[_0x578f4d('0x25')](_0x3c5c22[_0x578f4d('0x49')],qs[_0x578f4d('0x17')](_0xa07905[_0x578f4d('0x3b')][_0x578f4d('0x17')])),_0x5cada1[_0x578f4d('0x54')]=_0x5cada1[_0x578f4d('0x54')]['length']?_0x5cada1[_0x578f4d('0x54')]:_0x3c5c22[_0x578f4d('0x49')],_0xa07905[_0x578f4d('0x3b')][_0x578f4d('0x1d')]&&(_0x5cada1[_0x578f4d('0x4e')]=[{'all':!![]}]),_0x5cada1=_[_0x578f4d('0x2e')]({},_0x5cada1,_0xa07905['options']),db[_0x578f4d('0x4f')][_0x578f4d('0x1')](_0x5cada1)[_0x578f4d('0x0')](handleEntityNotFound(_0x4b3cb1,null))[_0x578f4d('0x0')](respondWithResult(_0x4b3cb1,null))[_0x578f4d('0x6')](handleError(_0x4b3cb1,null));},exports[_0x52e6cc('0x3a')]=function(_0x2a408c,_0x192f70){const _0x4eb25d=_0x52e6cc;return _0x2a408c['body']['id']&&delete _0x2a408c[_0x4eb25d('0xe')]['id'],db['VoiceMusicOnHold'][_0x4eb25d('0x1')]({'where':{'id':_0x2a408c[_0x4eb25d('0x45')]['id']}})[_0x4eb25d('0x0')](handleEntityNotFound(_0x192f70,null))[_0x4eb25d('0x0')](saveUpdates(_0x2a408c[_0x4eb25d('0xe')],null))[_0x4eb25d('0x0')](respondWithResult(_0x192f70,null))[_0x4eb25d('0x6')](handleError(_0x192f70,null));},exports['create']=function(_0x440e05,_0x38fc6d){const _0x9bb645=_0x52e6cc;return db[_0x9bb645('0x18')][_0x9bb645('0x57')](function(_0x47d3e3){const _0x12b9f1=_0x9bb645;return _0x440e05['body'][_0x12b9f1('0x30')]===_0x12b9f1('0x3e')&&(_0x440e05[_0x12b9f1('0xe')][_0x12b9f1('0x27')]=path[_0x12b9f1('0x39')](config[_0x12b9f1('0x13')],'server/files/moh',_0x440e05[_0x12b9f1('0xe')][_0x12b9f1('0x43')])),db[_0x12b9f1('0x4f')][_0x12b9f1('0x4b')](_0x440e05[_0x12b9f1('0xe')],{'transaction':_0x47d3e3})['then'](function(_0x202293){const _0x4cd6b0=_0x12b9f1;_0x440e05['body'][_0x4cd6b0('0x30')]===_0x4cd6b0('0x3e')&&fs[_0x4cd6b0('0x1a')](_0x202293['directory'],parseInt(_0x4cd6b0('0x10'),0x8));const _0x2b8647=_0x440e05['user'][_0x4cd6b0('0x7')]({'plain':!![]});if(!_0x2b8647)throw new Error(_0x4cd6b0('0x41'));if(_0x2b8647[_0x4cd6b0('0x1e')]===_0x4cd6b0('0x2b')){const _0x42add0=_0x202293[_0x4cd6b0('0x7')]({'plain':!![]});return db[_0x4cd6b0('0x24')][_0x4cd6b0('0x1')]({'where':{'name':_0x4cd6b0('0xd'),'userProfileId':_0x2b8647[_0x4cd6b0('0x26')]},'raw':!![]})[_0x4cd6b0('0x0')](function(_0x51cc57){const _0xe0ef58=_0x4cd6b0;return _0x51cc57&&_0x51cc57[_0xe0ef58('0x32')]===0x0?db[_0xe0ef58('0x52')]['create']({'name':_0x42add0[_0xe0ef58('0x43')],'resourceId':_0x42add0['id'],'type':_0x51cc57[_0xe0ef58('0x43')],'sectionId':_0x51cc57['id']},{})[_0xe0ef58('0x0')](function(){return _0x202293;}):_0x202293;})['catch'](function(_0x442215){const _0x17d3d9=_0x4cd6b0;logger[_0x17d3d9('0xa')](_0x17d3d9('0x4a'),_0x442215);});}return _0x202293;});})[_0x9bb645('0x0')](respondWithResult(_0x38fc6d,0xc9))['catch'](handleError(_0x38fc6d,null));},exports[_0x52e6cc('0x16')]=function(_0x225fce,_0x2e5458){const _0x1a8a7d=_0x52e6cc;return db[_0x1a8a7d('0x4f')][_0x1a8a7d('0x1')]({'where':{'id':_0x225fce[_0x1a8a7d('0x45')]['id']}})[_0x1a8a7d('0x0')](function(_0x5d2679){const _0x5abddc=_0x1a8a7d;if(_0x5d2679)return db[_0x5abddc('0x18')][_0x5abddc('0x57')](function(_0x3fb8e5){const _0xedd853=_0x5abddc;return _0x5d2679[_0xedd853('0x16')]({'transaction':_0x3fb8e5,'raw':!![]})[_0xedd853('0x0')](function(_0xd6c772){const _0x1aee88=_0xedd853;return _0xd6c772['directory']&&(fs[_0x1aee88('0x12')](_0xd6c772['directory'])[_0x1aee88('0x50')](function(_0x439fdc){fs['unlinkSync'](path['join'](_0xd6c772['directory'],_0x439fdc));}),fs[_0x1aee88('0x42')](_0xd6c772[_0x1aee88('0x27')])),_0xd6c772;});})[_0x5abddc('0x6')](function(_0x4a83cc){const _0x496cc3=_0x5abddc;throw new ValidationError(_0x4a83cc[_0x496cc3('0x2')]);});})['then'](handleEntityNotFound(_0x2e5458,null))[_0x1a8a7d('0x0')](removeEntity(_0x2e5458,null))['catch'](handleError(_0x2e5458,null));},exports[_0x52e6cc('0x23')]=function(_0x4036fa,_0x2ac5ca){const _0x4e36b9=_0x52e6cc;return db[_0x4e36b9('0x18')][_0x4e36b9('0x57')](function(_0x5ed4d0){const _0x27376a=_0x4e36b9;let _0x5e68bf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x4036fa[_0x27376a('0x45')]['id']}})[_0x27376a('0x0')](function(_0x505891){const _0x390da5=_0x27376a;if(_0x505891)return _0x5e68bf=_0x505891,_0x505891[_0x390da5('0x23')](_0x4036fa[_0x390da5('0xe')]['id'],{'transaction':_0x5ed4d0});})['then'](function(_0x5bed10){const _0x6cd77a=_0x27376a;if(_0x5bed10)return db[_0x6cd77a('0x11')][_0x6cd77a('0x1')]({'where':{'id':_0x4036fa[_0x6cd77a('0xe')]['id']},'attributes':['id','name',_0x6cd77a('0x2f'),_0x6cd77a('0x3f'),_0x6cd77a('0x31')],'raw':!![]});})['then'](function(_0xc80e18){const _0x290981=_0x27376a;if(_0xc80e18){const _0x55e1f6=path[_0x290981('0x39')](config[_0x290981('0x13')],_0x290981('0x38'),util['format'](_0x290981('0x4'),path[_0x290981('0x20')](_0xc80e18[_0x290981('0x2f')],path['extname'](_0xc80e18['save_name'])),_0xc80e18['converted_format'])),_0x4b4ca3=path[_0x290981('0x39')](config[_0x290981('0x13')],_0x290981('0x1b'),_0x5e68bf[_0x290981('0x43')],util[_0x290981('0x51')](_0x290981('0x4'),_0xc80e18['name'],_0xc80e18[_0x290981('0x3f')]));return fs[_0x290981('0x33')](_0x55e1f6,_0x4b4ca3),_0xc80e18;}})[_0x27376a('0x6')](function(_0x3a260c){const _0x306840=_0x27376a;throw new ValidationError(_0x3a260c[_0x306840('0x2')]);});})[_0x4e36b9('0x0')](handleEntityNotFound(_0x2ac5ca,null))['then'](respondWithResult(_0x2ac5ca,0xc9))[_0x4e36b9('0x6')](handleError(_0x2ac5ca,null));},exports[_0x52e6cc('0x8')]=function(_0x5ef412,_0x2dfc37){const _0x1e7f23=_0x52e6cc;return db[_0x1e7f23('0x18')]['transaction'](function(){const _0x431aee=_0x1e7f23;let _0x3a49a5;return db[_0x431aee('0x4f')][_0x431aee('0x1')]({'where':{'id':_0x5ef412[_0x431aee('0x45')]['id']}})[_0x431aee('0x0')](handleEntityNotFound(_0x2dfc37,null))[_0x431aee('0x0')](function(_0x2fdf38){const _0x1bf8b4=_0x431aee;if(_0x2fdf38)return _0x3a49a5=_0x2fdf38,_0x2fdf38[_0x1bf8b4('0x8')](_0x5ef412[_0x1bf8b4('0x45')][_0x1bf8b4('0x1c')]);})[_0x431aee('0x0')](function(_0x5062e3){const _0xf84244=_0x431aee;if(_0x5062e3)return db['Sound']['findOne']({'where':{'id':_0x5ef412[_0xf84244('0x45')]['id2']},'attributes':['id',_0xf84244('0x43'),'save_name','converted_format',_0xf84244('0x31')],'raw':!![]});})[_0x431aee('0x0')](function(_0x24ba64){const _0x333fa3=_0x431aee;if(_0x24ba64)return fs['unlinkSync'](path[_0x333fa3('0x39')](_0x3a49a5[_0x333fa3('0x27')],util[_0x333fa3('0x51')](_0x333fa3('0x4'),_0x24ba64[_0x333fa3('0x43')],_0x24ba64[_0x333fa3('0x3f')]))),_0x24ba64;})['catch'](function(_0x46d17b){const _0x42fead=_0x431aee;throw new ValidationError(_0x46d17b[_0x42fead('0x2')]);});})[_0x1e7f23('0x0')](handleEntityNotFound(_0x2dfc37,null))[_0x1e7f23('0x0')](respondWithStatusCode(_0x2dfc37,0xcc))[_0x1e7f23('0x6')](handleError(_0x2dfc37,null));},exports[_0x52e6cc('0x46')]=function(_0x49a71a,_0x2907b8){const _0x303072=_0x52e6cc;let _0x30a569={};const _0x1d8629={};let _0x41f26,_0x5be076;return db[_0x303072('0x4f')][_0x303072('0x1')]({'where':{'id':_0x49a71a['params']['id']}})[_0x303072('0x0')](handleEntityNotFound(_0x2907b8,null))[_0x303072('0x0')](function(_0x4fd34b){const _0x5d2fc7=_0x303072;if(_0x4fd34b)return _0x41f26=_0x4fd34b,_0x1d8629[_0x5d2fc7('0x49')]=_[_0x5d2fc7('0x53')](db[_0x5d2fc7('0x11')][_0x5d2fc7('0x2d')]),_0x1d8629['query']=_['keys'](_0x49a71a[_0x5d2fc7('0x3b')]),_0x1d8629[_0x5d2fc7('0x47')]=_[_0x5d2fc7('0x25')](_0x1d8629[_0x5d2fc7('0x49')],_0x1d8629['query']),_0x30a569[_0x5d2fc7('0x54')]=_[_0x5d2fc7('0x25')](_0x1d8629['model'],qs['fields'](_0x49a71a[_0x5d2fc7('0x3b')][_0x5d2fc7('0x17')])),_0x30a569[_0x5d2fc7('0x54')]=_0x30a569['attributes'][_0x5d2fc7('0x22')]?_0x30a569[_0x5d2fc7('0x54')]:_0x1d8629[_0x5d2fc7('0x49')],_0x30a569['order']=qs[_0x5d2fc7('0x36')](_0x49a71a['query'][_0x5d2fc7('0x36')]),_0x30a569[_0x5d2fc7('0x5')]=qs['filters'](_['pick'](_0x49a71a['query'],_0x1d8629[_0x5d2fc7('0x47')])),_0x49a71a[_0x5d2fc7('0x3b')][_0x5d2fc7('0x58')]&&(_0x30a569[_0x5d2fc7('0x5')]=_[_0x5d2fc7('0x2e')](_0x30a569[_0x5d2fc7('0x5')],{[Op['or']]:_[_0x5d2fc7('0x2a')](_0x30a569[_0x5d2fc7('0x54')],function(_0x379074){const _0x5704b7=_0x5d2fc7,_0x26295b={};return _0x26295b[_0x379074]={[Op[_0x5704b7('0x48')]]:'%'+_0x49a71a[_0x5704b7('0x3b')][_0x5704b7('0x58')]+'%'},_0x26295b;})})),_0x30a569=_[_0x5d2fc7('0x2e')]({},_0x30a569,_0x49a71a[_0x5d2fc7('0x3d')]),_0x41f26[_0x5d2fc7('0x46')](_0x30a569);})['then'](function(_0x12299e){const _0x2b7846=_0x303072;if(_0x12299e)return _0x5be076=_0x12299e['length'],typeof _0x49a71a[_0x2b7846('0x3b')][_0x2b7846('0x14')]===_0x2b7846('0x37')&&(_0x30a569[_0x2b7846('0x56')]=qs[_0x2b7846('0x56')](_0x49a71a[_0x2b7846('0x3b')][_0x2b7846('0x56')]),_0x30a569[_0x2b7846('0x3c')]=qs['offset'](_0x49a71a[_0x2b7846('0x3b')]['offset'])),_0x41f26[_0x2b7846('0x46')](_0x30a569);})[_0x303072('0x0')](function(_0x5a8bf){if(_0x5a8bf)return _0x5a8bf?{'count':_0x5be076,'rows':_0x5a8bf}:null;})['then'](respondWithResult(_0x2907b8,null))[_0x303072('0x6')](handleError(_0x2907b8,null));};
\ No newline at end of file