Built motion from commit f861bcb808219e66da88ba48b61bddb35224a65e. Version 3.0.0...
[motion-next.git] / server / api / voiceMusicOnHold / voiceMusicOnHold.controller.js
index 99d8543..cf9aad4 100644 (file)
@@ -1 +1 @@
-'use strict';const a890_0x87f4=['rawAttributes','path','15EyOqgv','create','message','id2','mode','files','mkdirSync','rows','type','627IZfSBS','forEach','status','1UymXEs','1157554CwYpHL','userProfileId','111291FxFqEQ','transaction','unlinkSync','save_name','keys','findOne','262nONbsd','include','model','end','22074wAgGvQ','api','query','sendStatus','where','findAll','name','merge','join','update','@mysqldb','711xQHsNr','0777','undefined','getSounds','@components/parsers/qs','intersection','attributes','VoiceMusicOnHold','key','map','2123UbtmTF','filter','Sound','sequelize','createdAt','@config/environment','removeSound','nolimit','count','addSound','existsSync','autoAssociation','readdirSync','Content-Range','user','converted_format','UserProfileSection','1FBDynb','offset','limit','sort','length','then','body','destroy','basename','includeAll','options','8uiVBEi','fields','MusicOnHolds','format','%s.%s','catch','1421161szSAik','directory','error','files/moh','filters','set','rmdirSync','1uXTJsw','json','root','get','files/sounds/converted','UserProfileResource','fieldName','stack','@config/logger','params','role','943461TFPOkJ','Unable\x20to\x20retrieve\x20the\x20current\x20user','order'];const a890_0x2f2c=function(_0x2fd22b,_0x30e2a2){_0x2fd22b=_0x2fd22b-0x71;let _0x87f498=a890_0x87f4[_0x2fd22b];return _0x87f498;};const a890_0x1fc8de=a890_0x2f2c;(function(_0x2d836f,_0xa6524){const _0x16a7ce=a890_0x2f2c;while(!![]){try{const _0xcf9cd8=-parseInt(_0x16a7ce(0xbc))*parseInt(_0x16a7ce(0xd7))+parseInt(_0x16a7ce(0x9c))*parseInt(_0x16a7ce(0x8b))+parseInt(_0x16a7ce(0xc2))*-parseInt(_0x16a7ce(0x96))+-parseInt(_0x16a7ce(0xcc))*-parseInt(_0x16a7ce(0xb3))+parseInt(_0x16a7ce(0xa3))*-parseInt(_0x16a7ce(0xc0))+parseInt(_0x16a7ce(0xbf))*parseInt(_0x16a7ce(0xae))+-parseInt(_0x16a7ce(0x7a))*-parseInt(_0x16a7ce(0xc8));if(_0xcf9cd8===_0xa6524)break;else _0x2d836f['push'](_0x2d836f['shift']());}catch(_0x1d7f5d){_0x2d836f['push'](_0x2d836f['shift']());}}}(a890_0x87f4,0xb9207));const util=require('util'),path=require(a890_0x1fc8de(0xb2)),fs=require('fs'),_=require('lodash'),qs=require(a890_0x1fc8de(0x74)),logger=require(a890_0x1fc8de(0xab))(a890_0x1fc8de(0xcd)),config=require(a890_0x1fc8de(0x7f)),{db}=require(a890_0x1fc8de(0xd6)),{ValidationError}=require(a890_0x1fc8de(0x7d)),{filterAttributes}=require('@utils/filter-attributes');function respondWithStatusCode(_0x5eb91d,_0x42f036){return _0x42f036=_0x42f036||0xcc,function(_0x12056c){const _0x503c82=a890_0x2f2c;if(_0x12056c)return _0x5eb91d[_0x503c82(0xcf)](_0x42f036);return _0x5eb91d[_0x503c82(0xbe)](_0x42f036)[_0x503c82(0xcb)]();};}function respondWithResult(_0x245584,_0x51b12e){return _0x51b12e=_0x51b12e||0xc8,function(_0xbf7a12){const _0x4b5aa5=a890_0x2f2c;if(_0xbf7a12)return _0x245584[_0x4b5aa5(0xbe)](_0x51b12e)[_0x4b5aa5(0xa4)](_0xbf7a12);};}function respondWithFilteredResult(_0x2813ae,_0x2221fb){return function(_0x314dc4){const _0x2fb429=a890_0x2f2c;if(_0x314dc4){const _0x5f0808=_0x314dc4[_0x2fb429(0x82)],_0x4f740b=_0x2221fb[_0x2fb429(0x8c)];let _0x12c7e2=_0x2221fb[_0x2fb429(0x8c)]+_0x2221fb[_0x2fb429(0x8d)],_0xb57f7e;return _0x12c7e2>=_0x5f0808?(_0x12c7e2=_0x5f0808,_0xb57f7e=0xc8):_0xb57f7e=0xce,_0x2813ae[_0x2fb429(0xbe)](_0xb57f7e),_0x2813ae[_0x2fb429(0xa1)](_0x2fb429(0x87),_0x4f740b+'-'+_0x12c7e2+'/'+_0x5f0808)[_0x2fb429(0xa4)](_0x314dc4);}return null;};}function saveUpdates(_0x3be45a){return function(_0x33f64e){const _0x53a722=a890_0x2f2c;if(_0x33f64e)return _0x33f64e['update'](_0x3be45a)[_0x53a722(0x90)](function(_0x55a319){return _0x55a319;});return null;};}function removeEntity(_0x2cca4d){return function(_0x5879fd){const _0x3180d5=a890_0x2f2c;if(_0x5879fd)return _0x5879fd[_0x3180d5(0x92)]()[_0x3180d5(0x90)](function(){const _0x330e01=_0x3180d5,_0x419dda=_0x5879fd['get']({'plain':!![]}),_0x1636c5=_0x330e01(0x98);return db['UserProfileResource'][_0x330e01(0x92)]({'where':{'type':_0x1636c5,'resourceId':_0x419dda['id']}})[_0x330e01(0x90)](function(){return _0x5879fd;});})['then'](function(){const _0x4d9ab2=_0x3180d5;_0x2cca4d[_0x4d9ab2(0xbe)](0xcc)[_0x4d9ab2(0xcb)]();});};}function handleEntityNotFound(_0xf426fb){return function(_0x5df1da){const _0xe823d9=a890_0x2f2c;return!_0x5df1da&&_0xf426fb[_0xe823d9(0xcf)](0x194),_0x5df1da;};}function handleError(_0x340659,_0x4ee395){return _0x4ee395=_0x4ee395||0x1f4,function(_0x580c2d){const _0x358ebb=a890_0x2f2c;logger[_0x358ebb(0x9e)](_0x580c2d[_0x358ebb(0xaa)]),_0x580c2d[_0x358ebb(0xd2)]&&delete _0x580c2d[_0x358ebb(0xd2)],_0x340659[_0x358ebb(0xbe)](_0x4ee395)['send'](_0x580c2d);};}exports['index']=function(_0x15d874,_0x53fee7){const _0x4b9ba2=a890_0x1fc8de;let _0xbcde5={};const _0x50ee24={},_0x4bea2d={'count':0x0,'rows':[]},_0x103057=_['map'](db[_0x4b9ba2(0x77)][_0x4b9ba2(0xb1)],function(_0x49aa34){const _0x15df8c=_0x4b9ba2;return{'name':_0x49aa34[_0x15df8c(0xa9)],'type':_0x49aa34[_0x15df8c(0xbb)][_0x15df8c(0x78)]};});_0x50ee24['model']=_[_0x4b9ba2(0x79)](_0x103057,_0x4b9ba2(0xd2)),_0x50ee24[_0x4b9ba2(0xce)]=_[_0x4b9ba2(0xc6)](_0x15d874[_0x4b9ba2(0xce)]),_0x50ee24[_0x4b9ba2(0xa0)]=_[_0x4b9ba2(0x75)](_0x50ee24[_0x4b9ba2(0xca)],_0x50ee24['query']),_0xbcde5[_0x4b9ba2(0x76)]=_[_0x4b9ba2(0x75)](_0x50ee24[_0x4b9ba2(0xca)],qs[_0x4b9ba2(0x97)](_0x15d874[_0x4b9ba2(0xce)][_0x4b9ba2(0x97)])),_0xbcde5[_0x4b9ba2(0x76)]=_0xbcde5[_0x4b9ba2(0x76)][_0x4b9ba2(0x8f)]?_0xbcde5[_0x4b9ba2(0x76)]:_0x50ee24[_0x4b9ba2(0xca)];typeof _0x15d874[_0x4b9ba2(0xce)][_0x4b9ba2(0x81)]===_0x4b9ba2(0x72)&&(_0xbcde5['limit']=qs[_0x4b9ba2(0x8d)](_0x15d874[_0x4b9ba2(0xce)][_0x4b9ba2(0x8d)]),_0xbcde5[_0x4b9ba2(0x8c)]=qs[_0x4b9ba2(0x8c)](_0x15d874['query']['offset']));_0xbcde5[_0x4b9ba2(0xb0)]=qs['sort'](_0x15d874[_0x4b9ba2(0xce)][_0x4b9ba2(0x8e)]),delete _0x15d874[_0x4b9ba2(0xce)][_0x4b9ba2(0x8e)],_0xbcde5['where']=qs[_0x4b9ba2(0xa0)](_['pick'](_0x15d874['query'],_0x50ee24[_0x4b9ba2(0xa0)]),_0x103057),_0xbcde5=filterAttributes(_0xbcde5,_0x15d874[_0x4b9ba2(0xce)][_0x4b9ba2(0x7b)],_0x103057,_0x15d874[_0x4b9ba2(0x95)]);const _0x58f1b1={'where':_0xbcde5[_0x4b9ba2(0xd0)]};return db[_0x4b9ba2(0x77)]['count'](_0x58f1b1)[_0x4b9ba2(0x90)](function(_0x59e975){const _0x2ba531=_0x4b9ba2;return _0x4bea2d['count']=_0x59e975,_0x15d874[_0x2ba531(0xce)][_0x2ba531(0x94)]&&(_0xbcde5[_0x2ba531(0xc9)]=[{'all':!![]}]),db[_0x2ba531(0x77)][_0x2ba531(0xd1)](_0xbcde5);})[_0x4b9ba2(0x90)](function(_0xc16cc6){const _0x27fa89=_0x4b9ba2;return _0x4bea2d[_0x27fa89(0xba)]=_0xc16cc6,_0x4bea2d;})[_0x4b9ba2(0x90)](respondWithFilteredResult(_0x53fee7,_0xbcde5))[_0x4b9ba2(0x9b)](handleError(_0x53fee7,null));},exports['show']=function(_0x32b2cc,_0x3a6f13){const _0x429227=a890_0x1fc8de;let _0x3fecee={'raw':![],'where':{'id':_0x32b2cc[_0x429227(0xac)]['id']}};const _0x3d2ecf={};return _0x3d2ecf['model']=_[_0x429227(0xc6)](db[_0x429227(0x77)]['rawAttributes']),_0x3d2ecf[_0x429227(0xce)]=_[_0x429227(0xc6)](_0x32b2cc['query']),_0x3d2ecf[_0x429227(0xa0)]=_['intersection'](_0x3d2ecf[_0x429227(0xca)],_0x3d2ecf['query']),_0x3fecee['attributes']=_[_0x429227(0x75)](_0x3d2ecf[_0x429227(0xca)],qs[_0x429227(0x97)](_0x32b2cc['query'][_0x429227(0x97)])),_0x3fecee['attributes']=_0x3fecee['attributes']['length']?_0x3fecee['attributes']:_0x3d2ecf[_0x429227(0xca)],_0x32b2cc[_0x429227(0xce)][_0x429227(0x94)]&&(_0x3fecee[_0x429227(0xc9)]=[{'all':!![]}]),_0x3fecee=_[_0x429227(0xd3)]({},_0x3fecee,_0x32b2cc[_0x429227(0x95)]),db[_0x429227(0x77)][_0x429227(0xc7)](_0x3fecee)[_0x429227(0x90)](handleEntityNotFound(_0x3a6f13,null))[_0x429227(0x90)](respondWithResult(_0x3a6f13,null))[_0x429227(0x9b)](handleError(_0x3a6f13,null));},exports[a890_0x1fc8de(0xd5)]=function(_0x4094a1,_0x3b94b4){const _0x18edd5=a890_0x1fc8de;return _0x4094a1['body']['id']&&delete _0x4094a1[_0x18edd5(0x91)]['id'],db[_0x18edd5(0x77)][_0x18edd5(0xc7)]({'where':{'id':_0x4094a1['params']['id']}})['then'](handleEntityNotFound(_0x3b94b4,null))[_0x18edd5(0x90)](saveUpdates(_0x4094a1[_0x18edd5(0x91)],null))[_0x18edd5(0x90)](respondWithResult(_0x3b94b4,null))[_0x18edd5(0x9b)](handleError(_0x3b94b4,null));},exports[a890_0x1fc8de(0xb4)]=function(_0x297c08,_0x135a23){const _0x1cb1a0=a890_0x1fc8de;return db[_0x1cb1a0(0x7d)][_0x1cb1a0(0xc3)](function(_0x1e362d){const _0x4a3567=_0x1cb1a0;return _0x297c08[_0x4a3567(0x91)][_0x4a3567(0xb7)]===_0x4a3567(0xb8)&&(_0x297c08['body'][_0x4a3567(0x9d)]=path[_0x4a3567(0xd4)](config[_0x4a3567(0xa5)],_0x4a3567(0x9f),_0x297c08[_0x4a3567(0x91)]['name'])),db[_0x4a3567(0x77)][_0x4a3567(0xb4)](_0x297c08['body'],{'transaction':_0x1e362d})[_0x4a3567(0x90)](function(_0x11cbe3){const _0x15a484=_0x4a3567;_0x297c08[_0x15a484(0x91)]['mode']==='files'&&fs[_0x15a484(0xb9)](_0x11cbe3[_0x15a484(0x9d)],parseInt(_0x15a484(0x71),0x8));const _0x57c96a=_0x297c08[_0x15a484(0x88)][_0x15a484(0xa6)]({'plain':!![]});if(!_0x57c96a)throw new Error(_0x15a484(0xaf));if(_0x57c96a[_0x15a484(0xad)]===_0x15a484(0x88)){const _0x2261e0=_0x11cbe3[_0x15a484(0xa6)]({'plain':!![]});return db[_0x15a484(0x8a)][_0x15a484(0xc7)]({'where':{'name':_0x15a484(0x98),'userProfileId':_0x57c96a[_0x15a484(0xc1)]},'raw':!![]})['then'](function(_0x256f85){const _0x3c6612=_0x15a484;return _0x256f85&&_0x256f85[_0x3c6612(0x85)]===0x0?db[_0x3c6612(0xa8)]['create']({'name':_0x2261e0[_0x3c6612(0xd2)],'resourceId':_0x2261e0['id'],'type':_0x256f85['name'],'sectionId':_0x256f85['id']},{})[_0x3c6612(0x90)](function(){return _0x11cbe3;}):_0x11cbe3;})[_0x15a484(0x9b)](function(_0x47bd30){const _0x556c29=_0x15a484;logger[_0x556c29(0x9e)]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47bd30);});}return _0x11cbe3;});})[_0x1cb1a0(0x90)](respondWithResult(_0x135a23,0xc9))[_0x1cb1a0(0x9b)](handleError(_0x135a23,null));},exports[a890_0x1fc8de(0x92)]=function(_0xe5637,_0x92736){const _0x17ad84=a890_0x1fc8de;return db['VoiceMusicOnHold'][_0x17ad84(0xc7)]({'where':{'id':_0xe5637[_0x17ad84(0xac)]['id']}})[_0x17ad84(0x90)](function(_0x440d6e){const _0x966f44=_0x17ad84;if(_0x440d6e)return db[_0x966f44(0x7d)][_0x966f44(0xc3)](function(_0x4ae250){const _0x489167=_0x966f44;return _0x440d6e['destroy']({'transaction':_0x4ae250,'raw':!![]})[_0x489167(0x90)](function(_0x26a701){const _0x37a827=_0x489167;return _0x26a701[_0x37a827(0x9d)]&&fs[_0x37a827(0x84)](_0x26a701[_0x37a827(0x9d)])&&(fs[_0x37a827(0x86)](_0x26a701['directory'])[_0x37a827(0xbd)](function(_0x558ec4){const _0x253eb8=_0x37a827;fs[_0x253eb8(0xc4)](path['join'](_0x26a701[_0x253eb8(0x9d)],_0x558ec4));}),fs[_0x37a827(0xa2)](_0x26a701[_0x37a827(0x9d)])),_0x26a701;});})['catch'](function(_0xf0b789){const _0x5d7b36=_0x966f44;throw new ValidationError(_0xf0b789[_0x5d7b36(0xb5)]);});})[_0x17ad84(0x90)](handleEntityNotFound(_0x92736,null))[_0x17ad84(0x90)](removeEntity(_0x92736,null))[_0x17ad84(0x9b)](handleError(_0x92736,null));},exports[a890_0x1fc8de(0x83)]=function(_0x37839a,_0xdca6a0){const _0x1083fe=a890_0x1fc8de;return db[_0x1083fe(0x7d)][_0x1083fe(0xc3)](function(_0x1434a7){const _0x568b6d=_0x1083fe;let _0x134e27;return db[_0x568b6d(0x77)][_0x568b6d(0xc7)]({'where':{'id':_0x37839a[_0x568b6d(0xac)]['id']}})['then'](function(_0xdaf61e){const _0x544d73=_0x568b6d;if(_0xdaf61e)return _0x134e27=_0xdaf61e,_0xdaf61e['addSound'](_0x37839a[_0x544d73(0x91)]['id'],{'transaction':_0x1434a7});})[_0x568b6d(0x90)](function(_0xac9823){const _0x1064b2=_0x568b6d;if(_0xac9823)return db[_0x1064b2(0x7c)][_0x1064b2(0xc7)]({'where':{'id':_0x37839a[_0x1064b2(0x91)]['id']},'attributes':['id','name',_0x1064b2(0xc5),_0x1064b2(0x89),_0x1064b2(0x7e)],'raw':!![]});})[_0x568b6d(0x90)](function(_0x4958ba){const _0x4f8fcf=_0x568b6d;if(_0x4958ba){const _0xc6158=path['join'](config[_0x4f8fcf(0xa5)],_0x4f8fcf(0xa7),util[_0x4f8fcf(0x99)](_0x4f8fcf(0x9a),path[_0x4f8fcf(0x93)](_0x4958ba[_0x4f8fcf(0xc5)],path['extname'](_0x4958ba[_0x4f8fcf(0xc5)])),_0x4958ba[_0x4f8fcf(0x89)])),_0x19075e=path['join'](config[_0x4f8fcf(0xa5)],_0x4f8fcf(0x9f),_0x134e27['name'],util[_0x4f8fcf(0x99)](_0x4f8fcf(0x9a),_0x4958ba[_0x4f8fcf(0xd2)],_0x4958ba[_0x4f8fcf(0x89)]));return fs['symlinkSync'](_0xc6158,_0x19075e),_0x4958ba;}})[_0x568b6d(0x9b)](function(_0x5b2fa2){const _0x26b348=_0x568b6d;throw new ValidationError(_0x5b2fa2[_0x26b348(0xb5)]);});})['then'](handleEntityNotFound(_0xdca6a0,null))[_0x1083fe(0x90)](respondWithResult(_0xdca6a0,0xc9))[_0x1083fe(0x9b)](handleError(_0xdca6a0,null));},exports['removeSound']=function(_0x2b8d87,_0x3d3da1){const _0x1a1afb=a890_0x1fc8de;return db[_0x1a1afb(0x7d)]['transaction'](function(){const _0x1aeeb4=_0x1a1afb;let _0x3172be;return db[_0x1aeeb4(0x77)][_0x1aeeb4(0xc7)]({'where':{'id':_0x2b8d87['params']['id']}})[_0x1aeeb4(0x90)](handleEntityNotFound(_0x3d3da1,null))[_0x1aeeb4(0x90)](function(_0x1ce618){const _0xfaa47=_0x1aeeb4;if(_0x1ce618)return _0x3172be=_0x1ce618,_0x1ce618[_0xfaa47(0x80)](_0x2b8d87[_0xfaa47(0xac)][_0xfaa47(0xb6)]);})['then'](function(_0x2612e5){const _0x1ad0fe=_0x1aeeb4;if(_0x2612e5)return db['Sound'][_0x1ad0fe(0xc7)]({'where':{'id':_0x2b8d87['params']['id2']},'attributes':['id',_0x1ad0fe(0xd2),_0x1ad0fe(0xc5),_0x1ad0fe(0x89),'createdAt'],'raw':!![]});})[_0x1aeeb4(0x90)](function(_0x5d6368){const _0x47303e=_0x1aeeb4;if(_0x5d6368)return fs['unlinkSync'](path['join'](_0x3172be[_0x47303e(0x9d)],util[_0x47303e(0x99)]('%s.%s',_0x5d6368[_0x47303e(0xd2)],_0x5d6368[_0x47303e(0x89)]))),_0x5d6368;})[_0x1aeeb4(0x9b)](function(_0x1e41ae){throw new ValidationError(_0x1e41ae['message']);});})[_0x1a1afb(0x90)](handleEntityNotFound(_0x3d3da1,null))['then'](respondWithStatusCode(_0x3d3da1,0xcc))[_0x1a1afb(0x9b)](handleError(_0x3d3da1,null));},exports[a890_0x1fc8de(0x73)]=function(_0x2a7940,_0x3ca3be){const _0x298573=a890_0x1fc8de;let _0x251406={};const _0x45ff13={};let _0x13b1bc,_0xd09720;return db['VoiceMusicOnHold'][_0x298573(0xc7)]({'where':{'id':_0x2a7940[_0x298573(0xac)]['id']}})[_0x298573(0x90)](handleEntityNotFound(_0x3ca3be,null))[_0x298573(0x90)](function(_0x57bffd){const _0x4e4fa5=_0x298573;if(_0x57bffd)return _0x13b1bc=_0x57bffd,_0x45ff13[_0x4e4fa5(0xca)]=_[_0x4e4fa5(0xc6)](db['Sound'][_0x4e4fa5(0xb1)]),_0x45ff13[_0x4e4fa5(0xce)]=_[_0x4e4fa5(0xc6)](_0x2a7940[_0x4e4fa5(0xce)]),_0x45ff13[_0x4e4fa5(0xa0)]=_['intersection'](_0x45ff13['model'],_0x45ff13[_0x4e4fa5(0xce)]),_0x251406[_0x4e4fa5(0x76)]=_[_0x4e4fa5(0x75)](_0x45ff13[_0x4e4fa5(0xca)],qs[_0x4e4fa5(0x97)](_0x2a7940[_0x4e4fa5(0xce)]['fields'])),_0x251406[_0x4e4fa5(0x76)]=_0x251406[_0x4e4fa5(0x76)][_0x4e4fa5(0x8f)]?_0x251406[_0x4e4fa5(0x76)]:_0x45ff13[_0x4e4fa5(0xca)],_0x251406['order']=qs['sort'](_0x2a7940[_0x4e4fa5(0xce)][_0x4e4fa5(0x8e)]),_0x251406['where']=qs[_0x4e4fa5(0xa0)](_['pick'](_0x2a7940[_0x4e4fa5(0xce)],_0x45ff13[_0x4e4fa5(0xa0)])),_0x251406=filterAttributes(_0x251406,_0x2a7940[_0x4e4fa5(0xce)][_0x4e4fa5(0x7b)],_0x251406[_0x4e4fa5(0x76)],_0x2a7940['options'],![]),_0x13b1bc[_0x4e4fa5(0x73)](_0x251406);})[_0x298573(0x90)](function(_0x5090dd){const _0x556a6b=_0x298573;if(_0x5090dd)return _0xd09720=_0x5090dd[_0x556a6b(0x8f)],typeof _0x2a7940[_0x556a6b(0xce)]['nolimit']===_0x556a6b(0x72)&&(_0x251406['limit']=qs[_0x556a6b(0x8d)](_0x2a7940[_0x556a6b(0xce)]['limit']),_0x251406[_0x556a6b(0x8c)]=qs[_0x556a6b(0x8c)](_0x2a7940[_0x556a6b(0xce)][_0x556a6b(0x8c)])),_0x13b1bc[_0x556a6b(0x73)](_0x251406);})[_0x298573(0x90)](function(_0x395c5a){if(_0x395c5a)return _0x395c5a?{'count':_0xd09720,'rows':_0x395c5a}:null;})[_0x298573(0x90)](respondWithResult(_0x3ca3be,null))[_0x298573(0x9b)](handleError(_0x3ca3be,null));};
\ No newline at end of file
+'use strict';const a894_0x5e28=['pick','25IvSLtd','status','0777','lodash','createdAt','format','show','query','intersection','fields','options','sequelize','mode','create','order','limit','files','42219bIGLhU','stack','model','map','%s.%s','61398zKfYlj','keys','join','include','30522KCIbrw','catch','getSounds','@config/logger','unlinkSync','json','sort','set','sendStatus','userProfileId','1cNRXqn','VoiceMusicOnHold','101361RpFEtd','removeSound','offset','body','update','where','params','files/sounds/converted','addSound','nolimit','merge','length','filters','findAll','path','195107yYTEBu','readdirSync','root','MusicOnHolds','@mysqldb','converted_format','name','8Igdkbf','Content-Range','includeAll','files/moh','api','@config/get-config','Sound','rmdirSync','role','count','key','10367lsIuRc','end','util','directory','5tipeGI','attributes','get','message','@utils/filter-attributes','UserProfileSection','forEach','4DAZoTX','UserProfileResource','save_name','findOne','rows','fieldName','user','then','@components/parsers/qs','id2','11995hDEiTx','transaction','type','destroy','rawAttributes','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','7FMtoPq'];const a894_0x3281=function(_0x32fdec,_0xccb153){_0x32fdec=_0x32fdec-0x1da;let _0x5e281e=a894_0x5e28[_0x32fdec];return _0x5e281e;};const a894_0x5a77a9=a894_0x3281;(function(_0x36eca1,_0x122038){const _0x588592=a894_0x3281;while(!![]){try{const _0x510214=parseInt(_0x588592(0x207))*parseInt(_0x588592(0x218))+-parseInt(_0x588592(0x1f4))*parseInt(_0x588592(0x21f))+parseInt(_0x588592(0x209))+parseInt(_0x588592(0x1da))*parseInt(_0x588592(0x1e3))+-parseInt(_0x588592(0x1fd))*-parseInt(_0x588592(0x1e1))+parseInt(_0x588592(0x22e))*-parseInt(_0x588592(0x22a))+-parseInt(_0x588592(0x235))*parseInt(_0x588592(0x1f9));if(_0x510214===_0x122038)break;else _0x36eca1['push'](_0x36eca1['shift']());}catch(_0x3a77b4){_0x36eca1['push'](_0x36eca1['shift']());}}}(a894_0x5e28,0x2aae2));const util=require(a894_0x5a77a9(0x22c)),path=require(a894_0x5a77a9(0x217)),fs=require('fs'),_=require(a894_0x5a77a9(0x1e6)),qs=require(a894_0x5a77a9(0x23d)),logger=require(a894_0x5a77a9(0x200))(a894_0x5a77a9(0x223)),{getConfig}=require(a894_0x5a77a9(0x224)),config=getConfig(),{db}=require(a894_0x5a77a9(0x21c)),{ValidationError}=require(a894_0x5a77a9(0x1ee)),{filterAttributes}=require(a894_0x5a77a9(0x232));function respondWithStatusCode(_0x18a973,_0x173c07){return _0x173c07=_0x173c07||0xcc,function(_0x663908){const _0x1ab3d7=a894_0x3281;if(_0x663908)return _0x18a973['sendStatus'](_0x173c07);return _0x18a973[_0x1ab3d7(0x1e4)](_0x173c07)[_0x1ab3d7(0x22b)]();};}function respondWithResult(_0x3cbad5,_0x4bc10d){return _0x4bc10d=_0x4bc10d||0xc8,function(_0x4cf2ad){const _0x2bed6b=a894_0x3281;if(_0x4cf2ad)return _0x3cbad5[_0x2bed6b(0x1e4)](_0x4bc10d)[_0x2bed6b(0x202)](_0x4cf2ad);};}function respondWithFilteredResult(_0x1e049b,_0x1fe037){return function(_0x448109){const _0x58bc1b=a894_0x3281;if(_0x448109){const _0x1d0d22=_0x448109[_0x58bc1b(0x228)],_0x1bd861=_0x1fe037['offset'];let _0x1f066a=_0x1fe037[_0x58bc1b(0x20b)]+_0x1fe037[_0x58bc1b(0x1f2)],_0x590d6b;return _0x1f066a>=_0x1d0d22?(_0x1f066a=_0x1d0d22,_0x590d6b=0xc8):_0x590d6b=0xce,_0x1e049b['status'](_0x590d6b),_0x1e049b[_0x58bc1b(0x204)](_0x58bc1b(0x220),_0x1bd861+'-'+_0x1f066a+'/'+_0x1d0d22)[_0x58bc1b(0x202)](_0x448109);}return null;};}function saveUpdates(_0x4f2192){return function(_0x6042c){const _0x415043=a894_0x3281;if(_0x6042c)return _0x6042c[_0x415043(0x20d)](_0x4f2192)['then'](function(_0xcf7253){return _0xcf7253;});return null;};}function removeEntity(_0x197f80){return function(_0x34f115){const _0x49a5d5=a894_0x3281;if(_0x34f115)return _0x34f115[_0x49a5d5(0x1dd)]()[_0x49a5d5(0x23c)](function(){const _0x1981ff=_0x49a5d5,_0x338f34=_0x34f115[_0x1981ff(0x230)]({'plain':!![]}),_0xe4f32a=_0x1981ff(0x21b);return db[_0x1981ff(0x236)][_0x1981ff(0x1dd)]({'where':{'type':_0xe4f32a,'resourceId':_0x338f34['id']}})[_0x1981ff(0x23c)](function(){return _0x34f115;});})[_0x49a5d5(0x23c)](function(){const _0x100b83=_0x49a5d5;_0x197f80['status'](0xcc)[_0x100b83(0x22b)]();});};}function handleEntityNotFound(_0x3d89a8){return function(_0x2d005b){const _0x2bfe74=a894_0x3281;return!_0x2d005b&&_0x3d89a8[_0x2bfe74(0x205)](0x194),_0x2d005b;};}function handleError(_0xb10e95,_0x48d435){return _0x48d435=_0x48d435||0x1f4,function(_0x26ef03){const _0x1fc8a6=a894_0x3281;logger['error'](_0x26ef03[_0x1fc8a6(0x1f5)]),_0x26ef03[_0x1fc8a6(0x21e)]&&delete _0x26ef03['name'],_0xb10e95['status'](_0x48d435)[_0x1fc8a6(0x1e0)](_0x26ef03);};}exports['index']=function(_0x7387fa,_0x571c2a){const _0x3d8d46=a894_0x5a77a9;let _0x323baa={};const _0x12692d={},_0x261f2d={'count':0x0,'rows':[]},_0x1cbd70=_[_0x3d8d46(0x1f7)](db[_0x3d8d46(0x208)][_0x3d8d46(0x1de)],function(_0xc417bd){const _0x529d02=_0x3d8d46;return{'name':_0xc417bd[_0x529d02(0x23a)],'type':_0xc417bd[_0x529d02(0x1dc)][_0x529d02(0x229)]};});_0x12692d[_0x3d8d46(0x1f6)]=_['map'](_0x1cbd70,'name'),_0x12692d['query']=_[_0x3d8d46(0x1fa)](_0x7387fa['query']),_0x12692d[_0x3d8d46(0x215)]=_['intersection'](_0x12692d['model'],_0x12692d['query']),_0x323baa['attributes']=_[_0x3d8d46(0x1eb)](_0x12692d[_0x3d8d46(0x1f6)],qs[_0x3d8d46(0x1ec)](_0x7387fa[_0x3d8d46(0x1ea)][_0x3d8d46(0x1ec)])),_0x323baa[_0x3d8d46(0x22f)]=_0x323baa['attributes'][_0x3d8d46(0x214)]?_0x323baa[_0x3d8d46(0x22f)]:_0x12692d[_0x3d8d46(0x1f6)];typeof _0x7387fa[_0x3d8d46(0x1ea)][_0x3d8d46(0x212)]==='undefined'&&(_0x323baa[_0x3d8d46(0x1f2)]=qs[_0x3d8d46(0x1f2)](_0x7387fa[_0x3d8d46(0x1ea)][_0x3d8d46(0x1f2)]),_0x323baa[_0x3d8d46(0x20b)]=qs[_0x3d8d46(0x20b)](_0x7387fa[_0x3d8d46(0x1ea)][_0x3d8d46(0x20b)]));_0x323baa[_0x3d8d46(0x1f1)]=qs[_0x3d8d46(0x203)](_0x7387fa[_0x3d8d46(0x1ea)][_0x3d8d46(0x203)]),delete _0x7387fa[_0x3d8d46(0x1ea)]['sort'],_0x323baa[_0x3d8d46(0x20e)]=qs[_0x3d8d46(0x215)](_[_0x3d8d46(0x1e2)](_0x7387fa[_0x3d8d46(0x1ea)],_0x12692d[_0x3d8d46(0x215)]),_0x1cbd70),_0x323baa=filterAttributes(_0x323baa,_0x7387fa[_0x3d8d46(0x1ea)]['filter'],_0x1cbd70,_0x7387fa[_0x3d8d46(0x1ed)]);const _0x49eab1={'where':_0x323baa['where']};return db[_0x3d8d46(0x208)][_0x3d8d46(0x228)](_0x49eab1)['then'](function(_0x242bc8){const _0x351178=_0x3d8d46;return _0x261f2d[_0x351178(0x228)]=_0x242bc8,_0x7387fa[_0x351178(0x1ea)][_0x351178(0x221)]&&(_0x323baa[_0x351178(0x1fc)]=[{'all':!![]}]),db[_0x351178(0x208)][_0x351178(0x216)](_0x323baa);})['then'](function(_0x287da4){const _0x3bde9b=_0x3d8d46;return _0x261f2d[_0x3bde9b(0x239)]=_0x287da4,_0x261f2d;})[_0x3d8d46(0x23c)](respondWithFilteredResult(_0x571c2a,_0x323baa))['catch'](handleError(_0x571c2a,null));},exports[a894_0x5a77a9(0x1e9)]=function(_0x24caa0,_0x468581){const _0x2d3c53=a894_0x5a77a9;let _0x2bfdcb={'raw':![],'where':{'id':_0x24caa0['params']['id']}};const _0x10ecbd={};return _0x10ecbd[_0x2d3c53(0x1f6)]=_[_0x2d3c53(0x1fa)](db[_0x2d3c53(0x208)][_0x2d3c53(0x1de)]),_0x10ecbd[_0x2d3c53(0x1ea)]=_[_0x2d3c53(0x1fa)](_0x24caa0[_0x2d3c53(0x1ea)]),_0x10ecbd[_0x2d3c53(0x215)]=_['intersection'](_0x10ecbd[_0x2d3c53(0x1f6)],_0x10ecbd[_0x2d3c53(0x1ea)]),_0x2bfdcb[_0x2d3c53(0x22f)]=_[_0x2d3c53(0x1eb)](_0x10ecbd[_0x2d3c53(0x1f6)],qs[_0x2d3c53(0x1ec)](_0x24caa0['query'][_0x2d3c53(0x1ec)])),_0x2bfdcb[_0x2d3c53(0x22f)]=_0x2bfdcb[_0x2d3c53(0x22f)][_0x2d3c53(0x214)]?_0x2bfdcb[_0x2d3c53(0x22f)]:_0x10ecbd[_0x2d3c53(0x1f6)],_0x24caa0['query'][_0x2d3c53(0x221)]&&(_0x2bfdcb[_0x2d3c53(0x1fc)]=[{'all':!![]}]),_0x2bfdcb=_[_0x2d3c53(0x213)]({},_0x2bfdcb,_0x24caa0[_0x2d3c53(0x1ed)]),db[_0x2d3c53(0x208)][_0x2d3c53(0x238)](_0x2bfdcb)[_0x2d3c53(0x23c)](handleEntityNotFound(_0x468581,null))[_0x2d3c53(0x23c)](respondWithResult(_0x468581,null))[_0x2d3c53(0x1fe)](handleError(_0x468581,null));},exports['update']=function(_0x55b2a5,_0x43b62f){const _0xdeeab5=a894_0x5a77a9;return _0x55b2a5[_0xdeeab5(0x20c)]['id']&&delete _0x55b2a5[_0xdeeab5(0x20c)]['id'],db[_0xdeeab5(0x208)]['findOne']({'where':{'id':_0x55b2a5[_0xdeeab5(0x20f)]['id']}})[_0xdeeab5(0x23c)](handleEntityNotFound(_0x43b62f,null))['then'](saveUpdates(_0x55b2a5[_0xdeeab5(0x20c)],null))[_0xdeeab5(0x23c)](respondWithResult(_0x43b62f,null))['catch'](handleError(_0x43b62f,null));},exports['create']=function(_0x17fa9f,_0x29f427){const _0xc79e1f=a894_0x5a77a9;return db['sequelize'][_0xc79e1f(0x1db)](function(_0x55df77){const _0x57cbe1=_0xc79e1f;return _0x17fa9f['body'][_0x57cbe1(0x1ef)]===_0x57cbe1(0x1f3)&&(_0x17fa9f['body'][_0x57cbe1(0x22d)]=path[_0x57cbe1(0x1fb)](config['root'],_0x57cbe1(0x222),_0x17fa9f['body'][_0x57cbe1(0x21e)])),db[_0x57cbe1(0x208)][_0x57cbe1(0x1f0)](_0x17fa9f['body'],{'transaction':_0x55df77})['then'](function(_0x44efd5){const _0x1b7ea0=_0x57cbe1;_0x17fa9f['body'][_0x1b7ea0(0x1ef)]===_0x1b7ea0(0x1f3)&&fs['mkdirSync'](_0x44efd5[_0x1b7ea0(0x22d)],parseInt(_0x1b7ea0(0x1e5),0x8));const _0x5ea6b0=_0x17fa9f[_0x1b7ea0(0x23b)][_0x1b7ea0(0x230)]({'plain':!![]});if(!_0x5ea6b0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ea6b0[_0x1b7ea0(0x227)]===_0x1b7ea0(0x23b)){const _0x517cc1=_0x44efd5[_0x1b7ea0(0x230)]({'plain':!![]});return db[_0x1b7ea0(0x233)][_0x1b7ea0(0x238)]({'where':{'name':_0x1b7ea0(0x21b),'userProfileId':_0x5ea6b0[_0x1b7ea0(0x206)]},'raw':!![]})[_0x1b7ea0(0x23c)](function(_0x1ddd03){const _0x2c3a86=_0x1b7ea0;return _0x1ddd03&&_0x1ddd03['autoAssociation']===0x0?db[_0x2c3a86(0x236)][_0x2c3a86(0x1f0)]({'name':_0x517cc1[_0x2c3a86(0x21e)],'resourceId':_0x517cc1['id'],'type':_0x1ddd03[_0x2c3a86(0x21e)],'sectionId':_0x1ddd03['id']},{})[_0x2c3a86(0x23c)](function(){return _0x44efd5;}):_0x44efd5;})[_0x1b7ea0(0x1fe)](function(_0x9117d4){const _0x1cef13=_0x1b7ea0;logger['error'](_0x1cef13(0x1df),_0x9117d4);});}return _0x44efd5;});})[_0xc79e1f(0x23c)](respondWithResult(_0x29f427,0xc9))[_0xc79e1f(0x1fe)](handleError(_0x29f427,null));},exports[a894_0x5a77a9(0x1dd)]=function(_0x55bf71,_0x1fa77a){const _0x576bed=a894_0x5a77a9;return db[_0x576bed(0x208)][_0x576bed(0x238)]({'where':{'id':_0x55bf71['params']['id']}})[_0x576bed(0x23c)](function(_0x5ff5fe){const _0x5b63a0=_0x576bed;if(_0x5ff5fe)return db[_0x5b63a0(0x1ee)]['transaction'](function(_0x3be909){const _0x402605=_0x5b63a0;return _0x5ff5fe['destroy']({'transaction':_0x3be909,'raw':!![]})[_0x402605(0x23c)](function(_0x389e64){const _0x1e35f8=_0x402605;return _0x389e64['directory']&&fs['existsSync'](_0x389e64[_0x1e35f8(0x22d)])&&(fs[_0x1e35f8(0x219)](_0x389e64[_0x1e35f8(0x22d)])[_0x1e35f8(0x234)](function(_0x6aba1e){const _0x2a2957=_0x1e35f8;fs[_0x2a2957(0x201)](path[_0x2a2957(0x1fb)](_0x389e64[_0x2a2957(0x22d)],_0x6aba1e));}),fs[_0x1e35f8(0x226)](_0x389e64[_0x1e35f8(0x22d)])),_0x389e64;});})[_0x5b63a0(0x1fe)](function(_0x2ffdc3){const _0x295a67=_0x5b63a0;throw new ValidationError(_0x2ffdc3[_0x295a67(0x231)]);});})[_0x576bed(0x23c)](handleEntityNotFound(_0x1fa77a,null))[_0x576bed(0x23c)](removeEntity(_0x1fa77a,null))[_0x576bed(0x1fe)](handleError(_0x1fa77a,null));},exports[a894_0x5a77a9(0x211)]=function(_0x3626ec,_0x37d701){const _0x4e7fdb=a894_0x5a77a9;return db[_0x4e7fdb(0x1ee)]['transaction'](function(_0x38ed01){const _0x26681d=_0x4e7fdb;let _0x2fde54;return db[_0x26681d(0x208)][_0x26681d(0x238)]({'where':{'id':_0x3626ec[_0x26681d(0x20f)]['id']}})[_0x26681d(0x23c)](function(_0x58ef4b){const _0x488e24=_0x26681d;if(_0x58ef4b)return _0x2fde54=_0x58ef4b,_0x58ef4b[_0x488e24(0x211)](_0x3626ec[_0x488e24(0x20c)]['id'],{'transaction':_0x38ed01});})[_0x26681d(0x23c)](function(_0x2611b2){const _0x517d0b=_0x26681d;if(_0x2611b2)return db[_0x517d0b(0x225)][_0x517d0b(0x238)]({'where':{'id':_0x3626ec[_0x517d0b(0x20c)]['id']},'attributes':['id',_0x517d0b(0x21e),_0x517d0b(0x237),_0x517d0b(0x21d),_0x517d0b(0x1e7)],'raw':!![]});})[_0x26681d(0x23c)](function(_0x30dc52){const _0xe60eb3=_0x26681d;if(_0x30dc52){const _0x32b5d0=path[_0xe60eb3(0x1fb)](config['root'],_0xe60eb3(0x210),util[_0xe60eb3(0x1e8)](_0xe60eb3(0x1f8),path['basename'](_0x30dc52['save_name'],path['extname'](_0x30dc52[_0xe60eb3(0x237)])),_0x30dc52[_0xe60eb3(0x21d)])),_0x4f4ea6=path[_0xe60eb3(0x1fb)](config[_0xe60eb3(0x21a)],_0xe60eb3(0x222),_0x2fde54['name'],util[_0xe60eb3(0x1e8)](_0xe60eb3(0x1f8),_0x30dc52[_0xe60eb3(0x21e)],_0x30dc52[_0xe60eb3(0x21d)]));return fs['symlinkSync'](_0x32b5d0,_0x4f4ea6),_0x30dc52;}})[_0x26681d(0x1fe)](function(_0xbdbafb){const _0xaf3a9e=_0x26681d;throw new ValidationError(_0xbdbafb[_0xaf3a9e(0x231)]);});})['then'](handleEntityNotFound(_0x37d701,null))['then'](respondWithResult(_0x37d701,0xc9))[_0x4e7fdb(0x1fe)](handleError(_0x37d701,null));},exports[a894_0x5a77a9(0x20a)]=function(_0x524b4d,_0x186520){const _0x2fb5c2=a894_0x5a77a9;return db['sequelize'][_0x2fb5c2(0x1db)](function(){const _0x5a3993=_0x2fb5c2;let _0x318fc4;return db[_0x5a3993(0x208)]['findOne']({'where':{'id':_0x524b4d[_0x5a3993(0x20f)]['id']}})['then'](handleEntityNotFound(_0x186520,null))[_0x5a3993(0x23c)](function(_0x23fc37){const _0x525cda=_0x5a3993;if(_0x23fc37)return _0x318fc4=_0x23fc37,_0x23fc37[_0x525cda(0x20a)](_0x524b4d[_0x525cda(0x20f)][_0x525cda(0x23e)]);})['then'](function(_0x3f90a5){const _0x186d46=_0x5a3993;if(_0x3f90a5)return db[_0x186d46(0x225)][_0x186d46(0x238)]({'where':{'id':_0x524b4d[_0x186d46(0x20f)][_0x186d46(0x23e)]},'attributes':['id',_0x186d46(0x21e),_0x186d46(0x237),_0x186d46(0x21d),_0x186d46(0x1e7)],'raw':!![]});})['then'](function(_0x57fd54){const _0xe05579=_0x5a3993;if(_0x57fd54)return fs[_0xe05579(0x201)](path[_0xe05579(0x1fb)](_0x318fc4[_0xe05579(0x22d)],util[_0xe05579(0x1e8)](_0xe05579(0x1f8),_0x57fd54[_0xe05579(0x21e)],_0x57fd54[_0xe05579(0x21d)]))),_0x57fd54;})['catch'](function(_0x5d3282){const _0x53764b=_0x5a3993;throw new ValidationError(_0x5d3282[_0x53764b(0x231)]);});})[_0x2fb5c2(0x23c)](handleEntityNotFound(_0x186520,null))[_0x2fb5c2(0x23c)](respondWithStatusCode(_0x186520,0xcc))[_0x2fb5c2(0x1fe)](handleError(_0x186520,null));},exports[a894_0x5a77a9(0x1ff)]=function(_0x244447,_0x3d1048){const _0x3ed486=a894_0x5a77a9;let _0x174d4c={};const _0x237bc3={};let _0x18cc32,_0x194fcc;return db[_0x3ed486(0x208)]['findOne']({'where':{'id':_0x244447[_0x3ed486(0x20f)]['id']}})[_0x3ed486(0x23c)](handleEntityNotFound(_0x3d1048,null))[_0x3ed486(0x23c)](function(_0x8e8f83){const _0x18213b=_0x3ed486;if(_0x8e8f83)return _0x18cc32=_0x8e8f83,_0x237bc3[_0x18213b(0x1f6)]=_[_0x18213b(0x1fa)](db[_0x18213b(0x225)][_0x18213b(0x1de)]),_0x237bc3[_0x18213b(0x1ea)]=_[_0x18213b(0x1fa)](_0x244447[_0x18213b(0x1ea)]),_0x237bc3[_0x18213b(0x215)]=_['intersection'](_0x237bc3[_0x18213b(0x1f6)],_0x237bc3[_0x18213b(0x1ea)]),_0x174d4c['attributes']=_[_0x18213b(0x1eb)](_0x237bc3[_0x18213b(0x1f6)],qs[_0x18213b(0x1ec)](_0x244447[_0x18213b(0x1ea)][_0x18213b(0x1ec)])),_0x174d4c[_0x18213b(0x22f)]=_0x174d4c[_0x18213b(0x22f)][_0x18213b(0x214)]?_0x174d4c[_0x18213b(0x22f)]:_0x237bc3[_0x18213b(0x1f6)],_0x174d4c[_0x18213b(0x1f1)]=qs['sort'](_0x244447[_0x18213b(0x1ea)][_0x18213b(0x203)]),_0x174d4c[_0x18213b(0x20e)]=qs[_0x18213b(0x215)](_[_0x18213b(0x1e2)](_0x244447['query'],_0x237bc3[_0x18213b(0x215)])),_0x174d4c=filterAttributes(_0x174d4c,_0x244447['query']['filter'],_0x174d4c[_0x18213b(0x22f)],_0x244447['options'],![]),_0x18cc32[_0x18213b(0x1ff)](_0x174d4c);})[_0x3ed486(0x23c)](function(_0x21fa9b){const _0xb063c7=_0x3ed486;if(_0x21fa9b)return _0x194fcc=_0x21fa9b[_0xb063c7(0x214)],typeof _0x244447[_0xb063c7(0x1ea)]['nolimit']==='undefined'&&(_0x174d4c[_0xb063c7(0x1f2)]=qs[_0xb063c7(0x1f2)](_0x244447[_0xb063c7(0x1ea)]['limit']),_0x174d4c['offset']=qs[_0xb063c7(0x20b)](_0x244447['query'][_0xb063c7(0x20b)])),_0x18cc32[_0xb063c7(0x1ff)](_0x174d4c);})[_0x3ed486(0x23c)](function(_0x546b79){if(_0x546b79)return _0x546b79?{'count':_0x194fcc,'rows':_0x546b79}:null;})['then'](respondWithResult(_0x3d1048,null))['catch'](handleError(_0x3d1048,null));};
\ No newline at end of file