Built motion from commit b51cdcb3f2cb46634587ce1d55ea1b8f32dacea6. Version 3.0.0...
[motion-next.git] / server / api / cloudProvider / cloudProvider.controller.js
index af986e0..e9bfa80 100644 (file)
@@ -1 +1 @@
-const a118_0x212d=['create','send','count','sendStatus','body','pick','key','map','json','undefined','findAll','index','includeAll','merge','model','name','fieldName','nolimit','include','length','filters','query','update','intersection','keys','filter','VIRTUAL','destroy','findOne','sort','lodash','rows','where','params','offset','attributes','then','end','type','catch','set','rawAttributes','fields','CloudProvider','status','like','../../config/logger','limit'];(function(_0x10cee3,_0x212d46){const _0x3b9c08=function(_0x56cbca){while(--_0x56cbca){_0x10cee3['push'](_0x10cee3['shift']());}};_0x3b9c08(++_0x212d46);}(a118_0x212d,0x9d));const a118_0x3b9c=function(_0x10cee3,_0x212d46){_0x10cee3=_0x10cee3-0x0;let _0x3b9c08=a118_0x212d[_0x10cee3];return _0x3b9c08;};const _0x4afd33=a118_0x3b9c;'use strict';const _=require(_0x4afd33('0x11')),qs=require('../../components/parsers/qs'),logger=require(_0x4afd33('0x21'))('api'),db=require('../../mysqldb')['db'],{Op}=require('sequelize');function respondWithResult(_0x56cbca,_0x8d9dec){return _0x8d9dec=_0x8d9dec||0xc8,function(_0x42b0bb){const _0x37ed7b=a118_0x3b9c;if(_0x42b0bb)return _0x56cbca[_0x37ed7b('0x1f')](_0x8d9dec)[_0x37ed7b('0x2b')](_0x42b0bb);};}function respondWithFilteredResult(_0x5e7c85,_0x549b32){return function(_0x66f498){const _0x48ef4d=a118_0x3b9c;if(_0x66f498){const _0x18ff10=_0x66f498['count'],_0x289ffa=_0x549b32[_0x48ef4d('0x15')];let _0x511669=_0x549b32['offset']+_0x549b32[_0x48ef4d('0x22')],_0x3068db;return _0x511669>=_0x18ff10?(_0x511669=_0x18ff10,_0x3068db=0xc8):_0x3068db=0xce,_0x5e7c85[_0x48ef4d('0x1f')](_0x3068db),_0x5e7c85[_0x48ef4d('0x1b')]('Content-Range',_0x289ffa+'-'+_0x511669+'/'+_0x18ff10)[_0x48ef4d('0x2b')](_0x66f498);}return null;};}function saveUpdates(_0x4e39b0){return function(_0xdcc88a){const _0x3a147f=a118_0x3b9c;if(_0xdcc88a)return _0xdcc88a[_0x3a147f('0x9')](_0x4e39b0)[_0x3a147f('0x17')](function(_0x54e1d7){return _0x54e1d7;});return null;};}function removeEntity(_0x5ae3f5){return function(_0x532111){const _0x1b6b84=a118_0x3b9c;if(_0x532111)return _0x532111['destroy']()[_0x1b6b84('0x17')](function(){const _0x1af094=_0x1b6b84;_0x5ae3f5[_0x1af094('0x1f')](0xcc)[_0x1af094('0x18')]();});};}function handleEntityNotFound(_0xd3cc00){return function(_0x5b3e86){const _0x50dbd2=a118_0x3b9c;return!_0x5b3e86&&_0xd3cc00[_0x50dbd2('0x26')](0x194),_0x5b3e86;};}function handleError(_0x3d51e6,_0x1b14b4){return _0x1b14b4=_0x1b14b4||0x1f4,function(_0x2bff96){const _0x3217d3=a118_0x3b9c;logger['error'](_0x2bff96['stack']),_0x2bff96[_0x3217d3('0x2')]&&delete _0x2bff96['name'],_0x3d51e6[_0x3217d3('0x1f')](_0x1b14b4)[_0x3217d3('0x24')](_0x2bff96);};}exports[_0x4afd33('0x2e')]=function(_0x437d4a,_0x381bab){const _0x1abc83=_0x4afd33;let _0x46ed7c={};const _0x5e30bb={},_0x587cdc={'count':0x0,'rows':[]},_0x57527a=_[_0x1abc83('0x2a')](db[_0x1abc83('0x1e')][_0x1abc83('0x1c')],function(_0x32b6ef){const _0x2001b6=_0x1abc83;return{'name':_0x32b6ef[_0x2001b6('0x3')],'type':_0x32b6ef[_0x2001b6('0x19')][_0x2001b6('0x29')]};});_0x5e30bb[_0x1abc83('0x1')]=_[_0x1abc83('0x2a')](_0x57527a,_0x1abc83('0x2')),_0x5e30bb[_0x1abc83('0x8')]=_[_0x1abc83('0xb')](_0x437d4a[_0x1abc83('0x8')]),_0x5e30bb['filters']=_[_0x1abc83('0xa')](_0x5e30bb['model'],_0x5e30bb[_0x1abc83('0x8')]),_0x46ed7c[_0x1abc83('0x16')]=_[_0x1abc83('0xa')](_0x5e30bb[_0x1abc83('0x1')],qs[_0x1abc83('0x1d')](_0x437d4a[_0x1abc83('0x8')][_0x1abc83('0x1d')])),_0x46ed7c[_0x1abc83('0x16')]=_0x46ed7c['attributes']['length']?_0x46ed7c['attributes']:_0x5e30bb[_0x1abc83('0x1')];typeof _0x437d4a[_0x1abc83('0x8')][_0x1abc83('0x4')]===_0x1abc83('0x2c')&&(_0x46ed7c[_0x1abc83('0x22')]=qs['limit'](_0x437d4a[_0x1abc83('0x8')]['limit']),_0x46ed7c[_0x1abc83('0x15')]=qs[_0x1abc83('0x15')](_0x437d4a[_0x1abc83('0x8')][_0x1abc83('0x15')]));_0x46ed7c['order']=qs[_0x1abc83('0x10')](_0x437d4a[_0x1abc83('0x8')][_0x1abc83('0x10')]),_0x46ed7c['where']=qs['filters'](_[_0x1abc83('0x28')](_0x437d4a[_0x1abc83('0x8')],_0x5e30bb[_0x1abc83('0x7')]),_0x57527a);_0x437d4a['query']['filter']&&(_0x46ed7c[_0x1abc83('0x13')]=_[_0x1abc83('0x0')](_0x46ed7c[_0x1abc83('0x13')],{[Op['or']]:_[_0x1abc83('0x2a')](_0x57527a,function(_0x28e9bd){const _0x4c2e44=_0x1abc83;if(_0x28e9bd['type']!==_0x4c2e44('0xd')){const _0x2fd6c8={};return _0x2fd6c8[_0x28e9bd[_0x4c2e44('0x2')]]={[Op[_0x4c2e44('0x20')]]:'%'+_0x437d4a[_0x4c2e44('0x8')][_0x4c2e44('0xc')]+'%'},_0x2fd6c8;}})}));_0x46ed7c=_['merge']({},_0x46ed7c,_0x437d4a['options']);const _0x517c64={'where':_0x46ed7c[_0x1abc83('0x13')]};return db[_0x1abc83('0x1e')][_0x1abc83('0x25')](_0x517c64)['then'](function(_0x8b16bb){const _0x46bdf9=_0x1abc83;return _0x587cdc[_0x46bdf9('0x25')]=_0x8b16bb,_0x437d4a['query'][_0x46bdf9('0x2f')]&&(_0x46ed7c[_0x46bdf9('0x5')]=[{'all':!![]}]),db[_0x46bdf9('0x1e')][_0x46bdf9('0x2d')](_0x46ed7c);})['then'](function(_0x507c6f){const _0x578dfd=_0x1abc83;return _0x587cdc[_0x578dfd('0x12')]=_0x507c6f,_0x587cdc;})['then'](respondWithFilteredResult(_0x381bab,_0x46ed7c))[_0x1abc83('0x1a')](handleError(_0x381bab,null));},exports['show']=function(_0x31c71e,_0x16f2cc){const _0xedddc3=_0x4afd33;let _0x3cfb6c={'raw':!![],'where':{'id':_0x31c71e[_0xedddc3('0x14')]['id']}};const _0x2e0fa4={};return _0x2e0fa4['model']=_[_0xedddc3('0xb')](db[_0xedddc3('0x1e')]['rawAttributes']),_0x2e0fa4['query']=_[_0xedddc3('0xb')](_0x31c71e[_0xedddc3('0x8')]),_0x2e0fa4[_0xedddc3('0x7')]=_[_0xedddc3('0xa')](_0x2e0fa4[_0xedddc3('0x1')],_0x2e0fa4[_0xedddc3('0x8')]),_0x3cfb6c['attributes']=_[_0xedddc3('0xa')](_0x2e0fa4[_0xedddc3('0x1')],qs[_0xedddc3('0x1d')](_0x31c71e['query']['fields'])),_0x3cfb6c[_0xedddc3('0x16')]=_0x3cfb6c[_0xedddc3('0x16')][_0xedddc3('0x6')]?_0x3cfb6c[_0xedddc3('0x16')]:_0x2e0fa4[_0xedddc3('0x1')],_0x31c71e[_0xedddc3('0x8')]['includeAll']&&(_0x3cfb6c[_0xedddc3('0x5')]=[{'all':!![]}]),_0x3cfb6c=_[_0xedddc3('0x0')]({},_0x3cfb6c,_0x31c71e['options']),db[_0xedddc3('0x1e')][_0xedddc3('0xf')](_0x3cfb6c)[_0xedddc3('0x17')](handleEntityNotFound(_0x16f2cc,null))[_0xedddc3('0x17')](respondWithResult(_0x16f2cc,null))[_0xedddc3('0x1a')](handleError(_0x16f2cc,null));},exports[_0x4afd33('0x23')]=function(_0x59bfc8,_0x14aa50){const _0x3c9816=_0x4afd33;return db[_0x3c9816('0x1e')][_0x3c9816('0x23')](_0x59bfc8[_0x3c9816('0x27')],{})[_0x3c9816('0x17')](respondWithResult(_0x14aa50,0xc9))[_0x3c9816('0x1a')](handleError(_0x14aa50,null));},exports[_0x4afd33('0x9')]=function(_0xc9d0a9,_0x12ba58){const _0x37baec=_0x4afd33;return _0xc9d0a9['body']['id']&&delete _0xc9d0a9[_0x37baec('0x27')]['id'],db['CloudProvider'][_0x37baec('0xf')]({'where':{'id':_0xc9d0a9[_0x37baec('0x14')]['id']}})[_0x37baec('0x17')](handleEntityNotFound(_0x12ba58,null))[_0x37baec('0x17')](saveUpdates(_0xc9d0a9[_0x37baec('0x27')],null))[_0x37baec('0x17')](respondWithResult(_0x12ba58,null))[_0x37baec('0x1a')](handleError(_0x12ba58,null));},exports[_0x4afd33('0xe')]=function(_0x4f65ca,_0x20ca35){const _0x40db78=_0x4afd33;return db[_0x40db78('0x1e')][_0x40db78('0xf')]({'where':{'id':_0x4f65ca[_0x40db78('0x14')]['id']}})[_0x40db78('0x17')](handleEntityNotFound(_0x20ca35,null))['then'](removeEntity(_0x20ca35,null))[_0x40db78('0x1a')](handleError(_0x20ca35,null));};
\ No newline at end of file
+const a118_0x2789=['send','Content-Range','map','model','lodash','filters','catch','error','api','status','include','keys','show','VIRTUAL','pick','includeAll','query','limit','update','rawAttributes','json','params','where','CloudProvider','create','findOne','set','body','type','filter','attributes','length','../../config/logger','offset','findAll','nolimit','rows','merge','key','then','like','intersection','destroy','options','name','count','fields','sequelize','stack','end'];(function(_0x5e8ce7,_0x27898b){const _0x5ebe0c=function(_0x681505){while(--_0x681505){_0x5e8ce7['push'](_0x5e8ce7['shift']());}};_0x5ebe0c(++_0x27898b);}(a118_0x2789,0x1cf));const a118_0x5ebe=function(_0x5e8ce7,_0x27898b){_0x5e8ce7=_0x5e8ce7-0x0;let _0x5ebe0c=a118_0x2789[_0x5e8ce7];return _0x5ebe0c;};const _0x176c46=a118_0x5ebe;'use strict';const _=require(_0x176c46('0x29')),qs=require('../../components/parsers/qs'),logger=require(_0x176c46('0x13'))(_0x176c46('0x2d')),db=require('../../mysqldb')['db'],{Op}=require(_0x176c46('0x22'));function respondWithResult(_0x681505,_0x539027){return _0x539027=_0x539027||0xc8,function(_0x171616){const _0x1ba617=a118_0x5ebe;if(_0x171616)return _0x681505[_0x1ba617('0x2e')](_0x539027)[_0x1ba617('0x7')](_0x171616);};}function respondWithFilteredResult(_0x3f5397,_0x4a78ea){return function(_0x51907c){const _0x49a1ac=a118_0x5ebe;if(_0x51907c){const _0x1b8af6=_0x51907c[_0x49a1ac('0x20')],_0x10ada3=_0x4a78ea[_0x49a1ac('0x14')];let _0x39dfee=_0x4a78ea[_0x49a1ac('0x14')]+_0x4a78ea[_0x49a1ac('0x4')],_0x2b2d9e;return _0x39dfee>=_0x1b8af6?(_0x39dfee=_0x1b8af6,_0x2b2d9e=0xc8):_0x2b2d9e=0xce,_0x3f5397[_0x49a1ac('0x2e')](_0x2b2d9e),_0x3f5397[_0x49a1ac('0xd')](_0x49a1ac('0x26'),_0x10ada3+'-'+_0x39dfee+'/'+_0x1b8af6)['json'](_0x51907c);}return null;};}function saveUpdates(_0x308aab){return function(_0x1215ea){const _0x4ca76c=a118_0x5ebe;if(_0x1215ea)return _0x1215ea[_0x4ca76c('0x5')](_0x308aab)[_0x4ca76c('0x1a')](function(_0x387f12){return _0x387f12;});return null;};}function removeEntity(_0x441eaf){return function(_0x4ef159){const _0x1acffe=a118_0x5ebe;if(_0x4ef159)return _0x4ef159[_0x1acffe('0x1d')]()[_0x1acffe('0x1a')](function(){const _0x443091=_0x1acffe;_0x441eaf[_0x443091('0x2e')](0xcc)[_0x443091('0x24')]();});};}function handleEntityNotFound(_0x24574e){return function(_0x152308){return!_0x152308&&_0x24574e['sendStatus'](0x194),_0x152308;};}function handleError(_0x41832b,_0x50b669){return _0x50b669=_0x50b669||0x1f4,function(_0x459678){const _0x232e4a=a118_0x5ebe;logger[_0x232e4a('0x2c')](_0x459678[_0x232e4a('0x23')]),_0x459678[_0x232e4a('0x1f')]&&delete _0x459678[_0x232e4a('0x1f')],_0x41832b[_0x232e4a('0x2e')](_0x50b669)[_0x232e4a('0x25')](_0x459678);};}exports['index']=function(_0x45b56f,_0x4afdc7){const _0xbeaded=_0x176c46;let _0x507364={};const _0x1492c4={},_0x13fcfd={'count':0x0,'rows':[]},_0x7d3480=_[_0xbeaded('0x27')](db[_0xbeaded('0xa')]['rawAttributes'],function(_0x227603){const _0x653352=_0xbeaded;return{'name':_0x227603['fieldName'],'type':_0x227603[_0x653352('0xf')][_0x653352('0x19')]};});_0x1492c4[_0xbeaded('0x28')]=_[_0xbeaded('0x27')](_0x7d3480,'name'),_0x1492c4[_0xbeaded('0x3')]=_[_0xbeaded('0x30')](_0x45b56f['query']),_0x1492c4[_0xbeaded('0x2a')]=_[_0xbeaded('0x1c')](_0x1492c4[_0xbeaded('0x28')],_0x1492c4[_0xbeaded('0x3')]),_0x507364['attributes']=_[_0xbeaded('0x1c')](_0x1492c4[_0xbeaded('0x28')],qs[_0xbeaded('0x21')](_0x45b56f[_0xbeaded('0x3')][_0xbeaded('0x21')])),_0x507364[_0xbeaded('0x11')]=_0x507364[_0xbeaded('0x11')][_0xbeaded('0x12')]?_0x507364['attributes']:_0x1492c4[_0xbeaded('0x28')];typeof _0x45b56f['query'][_0xbeaded('0x16')]==='undefined'&&(_0x507364['limit']=qs[_0xbeaded('0x4')](_0x45b56f[_0xbeaded('0x3')]['limit']),_0x507364['offset']=qs[_0xbeaded('0x14')](_0x45b56f[_0xbeaded('0x3')][_0xbeaded('0x14')]));_0x507364['order']=qs['sort'](_0x45b56f[_0xbeaded('0x3')]['sort']),_0x507364[_0xbeaded('0x9')]=qs[_0xbeaded('0x2a')](_[_0xbeaded('0x1')](_0x45b56f[_0xbeaded('0x3')],_0x1492c4[_0xbeaded('0x2a')]),_0x7d3480);_0x45b56f[_0xbeaded('0x3')][_0xbeaded('0x10')]&&(_0x507364['where']=_[_0xbeaded('0x18')](_0x507364['where'],{[Op['or']]:_[_0xbeaded('0x27')](_0x7d3480,function(_0x24cef0){const _0x5322ac=_0xbeaded;if(_0x24cef0['type']!==_0x5322ac('0x0')){const _0x4684ba={};return _0x4684ba[_0x24cef0[_0x5322ac('0x1f')]]={[Op[_0x5322ac('0x1b')]]:'%'+_0x45b56f[_0x5322ac('0x3')][_0x5322ac('0x10')]+'%'},_0x4684ba;}})}));_0x507364=_['merge']({},_0x507364,_0x45b56f[_0xbeaded('0x1e')]);const _0x169195={'where':_0x507364[_0xbeaded('0x9')]};return db[_0xbeaded('0xa')][_0xbeaded('0x20')](_0x169195)['then'](function(_0x4a3b50){const _0x1f7ab0=_0xbeaded;return _0x13fcfd[_0x1f7ab0('0x20')]=_0x4a3b50,_0x45b56f[_0x1f7ab0('0x3')][_0x1f7ab0('0x2')]&&(_0x507364[_0x1f7ab0('0x2f')]=[{'all':!![]}]),db[_0x1f7ab0('0xa')][_0x1f7ab0('0x15')](_0x507364);})[_0xbeaded('0x1a')](function(_0x211640){const _0x5016be=_0xbeaded;return _0x13fcfd[_0x5016be('0x17')]=_0x211640,_0x13fcfd;})['then'](respondWithFilteredResult(_0x4afdc7,_0x507364))[_0xbeaded('0x2b')](handleError(_0x4afdc7,null));},exports[_0x176c46('0x31')]=function(_0x504731,_0x3cc923){const _0x5939fb=_0x176c46;let _0x290d79={'raw':!![],'where':{'id':_0x504731[_0x5939fb('0x8')]['id']}};const _0x55a67f={};return _0x55a67f['model']=_[_0x5939fb('0x30')](db[_0x5939fb('0xa')][_0x5939fb('0x6')]),_0x55a67f[_0x5939fb('0x3')]=_[_0x5939fb('0x30')](_0x504731['query']),_0x55a67f['filters']=_['intersection'](_0x55a67f[_0x5939fb('0x28')],_0x55a67f[_0x5939fb('0x3')]),_0x290d79['attributes']=_[_0x5939fb('0x1c')](_0x55a67f[_0x5939fb('0x28')],qs[_0x5939fb('0x21')](_0x504731[_0x5939fb('0x3')]['fields'])),_0x290d79['attributes']=_0x290d79['attributes'][_0x5939fb('0x12')]?_0x290d79[_0x5939fb('0x11')]:_0x55a67f[_0x5939fb('0x28')],_0x504731['query'][_0x5939fb('0x2')]&&(_0x290d79[_0x5939fb('0x2f')]=[{'all':!![]}]),_0x290d79=_[_0x5939fb('0x18')]({},_0x290d79,_0x504731[_0x5939fb('0x1e')]),db['CloudProvider'][_0x5939fb('0xc')](_0x290d79)[_0x5939fb('0x1a')](handleEntityNotFound(_0x3cc923,null))['then'](respondWithResult(_0x3cc923,null))['catch'](handleError(_0x3cc923,null));},exports['create']=function(_0x1283ec,_0x5a4e67){const _0x42a2fd=_0x176c46;return db[_0x42a2fd('0xa')][_0x42a2fd('0xb')](_0x1283ec[_0x42a2fd('0xe')],{})[_0x42a2fd('0x1a')](respondWithResult(_0x5a4e67,0xc9))[_0x42a2fd('0x2b')](handleError(_0x5a4e67,null));},exports[_0x176c46('0x5')]=function(_0x2e20b0,_0xc2b5b1){const _0x5bbc66=_0x176c46;return _0x2e20b0[_0x5bbc66('0xe')]['id']&&delete _0x2e20b0['body']['id'],db[_0x5bbc66('0xa')][_0x5bbc66('0xc')]({'where':{'id':_0x2e20b0[_0x5bbc66('0x8')]['id']}})[_0x5bbc66('0x1a')](handleEntityNotFound(_0xc2b5b1,null))[_0x5bbc66('0x1a')](saveUpdates(_0x2e20b0['body'],null))[_0x5bbc66('0x1a')](respondWithResult(_0xc2b5b1,null))[_0x5bbc66('0x2b')](handleError(_0xc2b5b1,null));},exports[_0x176c46('0x1d')]=function(_0x41e118,_0x13e5ed){const _0x32139c=_0x176c46;return db[_0x32139c('0xa')][_0x32139c('0xc')]({'where':{'id':_0x41e118['params']['id']}})[_0x32139c('0x1a')](handleEntityNotFound(_0x13e5ed,null))[_0x32139c('0x1a')](removeEntity(_0x13e5ed,null))[_0x32139c('0x2b')](handleError(_0x13e5ed,null));};
\ No newline at end of file