Built motion from commit b51cdcb3f2cb46634587ce1d55ea1b8f32dacea6. Version 3.0.0...
[motion-next.git] / server / api / userProfileSection / userProfileSection.controller.js
1 const a678_0x3dff=['filters','../../components/parsers/qs','sort','intersection','index','rawAttributes','sendStatus','nolimit','fields','json','length','merge','findOne','api','options','type','then','describe','undefined','create','query','pick','map','show','params','fieldName','includeAll','attributes','UserProfileSection','error','order','keys','update','body','count','destroy','filter','rows','include','set','name','offset','where','catch','Content-Range','lodash','limit','status','end','model','like'];(function(_0x186a2c,_0x3dff1b){const _0x3b79a4=function(_0x3e2b2e){while(--_0x3e2b2e){_0x186a2c['push'](_0x186a2c['shift']());}};_0x3b79a4(++_0x3dff1b);}(a678_0x3dff,0x148));const a678_0x3b79=function(_0x186a2c,_0x3dff1b){_0x186a2c=_0x186a2c-0x0;let _0x3b79a4=a678_0x3dff[_0x186a2c];return _0x3b79a4;};const _0x2404f4=a678_0x3b79;'use strict';const _=require(_0x2404f4('0x17')),qs=require(_0x2404f4('0x1e')),logger=require('../../config/logger')(_0x2404f4('0x2a')),db=require('../../mysqldb')['db'],{Op}=require('sequelize');function respondWithResult(_0x3e2b2e,_0x73716d){return _0x73716d=_0x73716d||0xc8,function(_0x4b0c47){const _0x261503=a678_0x3b79;if(_0x4b0c47)return _0x3e2b2e[_0x261503('0x19')](_0x73716d)['json'](_0x4b0c47);};}function respondWithFilteredResult(_0x328cb8,_0x2edf6f){return function(_0x358081){const _0x1574eb=a678_0x3b79;if(_0x358081){const _0x4bd9b4=_0x358081[_0x1574eb('0xc')],_0x3711af=_0x2edf6f['offset'];let _0x275268=_0x2edf6f[_0x1574eb('0x13')]+_0x2edf6f[_0x1574eb('0x18')],_0x529d27;return _0x275268>=_0x4bd9b4?(_0x275268=_0x4bd9b4,_0x529d27=0xc8):_0x529d27=0xce,_0x328cb8['status'](_0x529d27),_0x328cb8[_0x1574eb('0x11')](_0x1574eb('0x16'),_0x3711af+'-'+_0x275268+'/'+_0x4bd9b4)[_0x1574eb('0x26')](_0x358081);}return null;};}function saveUpdates(_0x34e0c9){return function(_0xcdc895){const _0x11b66c=a678_0x3b79;if(_0xcdc895)return _0xcdc895[_0x11b66c('0xa')](_0x34e0c9)['then'](function(_0x24d038){return _0x24d038;});return null;};}function removeEntity(_0x8503d){return function(_0x41c18b){const _0x3475fa=a678_0x3b79;if(_0x41c18b)return _0x41c18b[_0x3475fa('0xd')]()['then'](function(){const _0x56edd1=_0x3475fa;_0x8503d[_0x56edd1('0x19')](0xcc)[_0x56edd1('0x1a')]();});};}function handleEntityNotFound(_0x54563b){return function(_0x5a46b0){const _0xfeb5bd=a678_0x3b79;return!_0x5a46b0&&_0x54563b[_0xfeb5bd('0x23')](0x194),_0x5a46b0;};}function handleError(_0x5123ff,_0x2d0973){return _0x2d0973=_0x2d0973||0x1f4,function(_0x58b84){const _0x343134=a678_0x3b79;logger[_0x343134('0x7')](_0x58b84['stack']),_0x58b84[_0x343134('0x12')]&&delete _0x58b84[_0x343134('0x12')],_0x5123ff[_0x343134('0x19')](_0x2d0973)['send'](_0x58b84);};}exports[_0x2404f4('0x21')]=function(_0x489c44,_0x122444){const _0x5dcb77=_0x2404f4;let _0x28f443={};const _0x576690={},_0x2325c7={'count':0x0,'rows':[]},_0x460c6f=_[_0x5dcb77('0x0')](db[_0x5dcb77('0x6')][_0x5dcb77('0x22')],function(_0x115e0e){const _0x48e6d1=_0x5dcb77;return{'name':_0x115e0e[_0x48e6d1('0x3')],'type':_0x115e0e[_0x48e6d1('0x2c')]['key']};});_0x576690[_0x5dcb77('0x1b')]=_[_0x5dcb77('0x0')](_0x460c6f,_0x5dcb77('0x12')),_0x576690[_0x5dcb77('0x31')]=_['keys'](_0x489c44['query']),_0x576690[_0x5dcb77('0x1d')]=_['intersection'](_0x576690[_0x5dcb77('0x1b')],_0x576690[_0x5dcb77('0x31')]),_0x28f443[_0x5dcb77('0x5')]=_[_0x5dcb77('0x20')](_0x576690['model'],qs[_0x5dcb77('0x25')](_0x489c44[_0x5dcb77('0x31')]['fields'])),_0x28f443['attributes']=_0x28f443['attributes'][_0x5dcb77('0x27')]?_0x28f443['attributes']:_0x576690['model'];typeof _0x489c44[_0x5dcb77('0x31')][_0x5dcb77('0x24')]===_0x5dcb77('0x2f')&&(_0x28f443[_0x5dcb77('0x18')]=qs[_0x5dcb77('0x18')](_0x489c44[_0x5dcb77('0x31')][_0x5dcb77('0x18')]),_0x28f443['offset']=qs['offset'](_0x489c44[_0x5dcb77('0x31')][_0x5dcb77('0x13')]));_0x28f443[_0x5dcb77('0x8')]=qs[_0x5dcb77('0x1f')](_0x489c44[_0x5dcb77('0x31')]['sort']),_0x28f443[_0x5dcb77('0x14')]=qs[_0x5dcb77('0x1d')](_[_0x5dcb77('0x32')](_0x489c44[_0x5dcb77('0x31')],_0x576690['filters']),_0x460c6f);_0x489c44[_0x5dcb77('0x31')][_0x5dcb77('0xe')]&&(_0x28f443[_0x5dcb77('0x14')]=_[_0x5dcb77('0x28')](_0x28f443[_0x5dcb77('0x14')],{[Op['or']]:_[_0x5dcb77('0x0')](_0x460c6f,function(_0x32eb31){const _0x5711ae=_0x5dcb77;if(_0x32eb31['type']!=='VIRTUAL'){const _0x1bc1ea={};return _0x1bc1ea[_0x32eb31[_0x5711ae('0x12')]]={[Op[_0x5711ae('0x1c')]]:'%'+_0x489c44[_0x5711ae('0x31')][_0x5711ae('0xe')]+'%'},_0x1bc1ea;}})}));_0x28f443=_[_0x5dcb77('0x28')]({},_0x28f443,_0x489c44[_0x5dcb77('0x2b')]);const _0x3fa042={'where':_0x28f443['where']};return db[_0x5dcb77('0x6')][_0x5dcb77('0xc')](_0x3fa042)[_0x5dcb77('0x2d')](function(_0x123406){const _0x14edae=_0x5dcb77;return _0x2325c7[_0x14edae('0xc')]=_0x123406,_0x489c44['query'][_0x14edae('0x4')]&&(_0x28f443[_0x14edae('0x10')]=[{'all':!![]}]),db['UserProfileSection']['findAll'](_0x28f443);})['then'](function(_0x2d88a4){const _0x232355=_0x5dcb77;return _0x2325c7[_0x232355('0xf')]=_0x2d88a4,_0x2325c7;})['then'](respondWithFilteredResult(_0x122444,_0x28f443))['catch'](handleError(_0x122444,null));},exports[_0x2404f4('0x1')]=function(_0x58a62a,_0x1276df){const _0x4ea0e7=_0x2404f4;let _0x1dbe01={'raw':![],'where':{'id':_0x58a62a[_0x4ea0e7('0x2')]['id']}};const _0xc7a507={};return _0xc7a507['model']=_[_0x4ea0e7('0x9')](db[_0x4ea0e7('0x6')][_0x4ea0e7('0x22')]),_0xc7a507[_0x4ea0e7('0x31')]=_[_0x4ea0e7('0x9')](_0x58a62a[_0x4ea0e7('0x31')]),_0xc7a507[_0x4ea0e7('0x1d')]=_[_0x4ea0e7('0x20')](_0xc7a507[_0x4ea0e7('0x1b')],_0xc7a507[_0x4ea0e7('0x31')]),_0x1dbe01['attributes']=_[_0x4ea0e7('0x20')](_0xc7a507[_0x4ea0e7('0x1b')],qs[_0x4ea0e7('0x25')](_0x58a62a[_0x4ea0e7('0x31')][_0x4ea0e7('0x25')])),_0x1dbe01[_0x4ea0e7('0x5')]=_0x1dbe01[_0x4ea0e7('0x5')][_0x4ea0e7('0x27')]?_0x1dbe01[_0x4ea0e7('0x5')]:_0xc7a507['model'],_0x58a62a[_0x4ea0e7('0x31')][_0x4ea0e7('0x4')]&&(_0x1dbe01[_0x4ea0e7('0x10')]=[{'all':!![]}]),_0x1dbe01=_[_0x4ea0e7('0x28')]({},_0x1dbe01,_0x58a62a['options']),db[_0x4ea0e7('0x6')][_0x4ea0e7('0x29')](_0x1dbe01)[_0x4ea0e7('0x2d')](handleEntityNotFound(_0x1276df,null))[_0x4ea0e7('0x2d')](respondWithResult(_0x1276df,null))[_0x4ea0e7('0x15')](handleError(_0x1276df,null));},exports['create']=function(_0x22f5a4,_0x50a09d){const _0x843dc5=_0x2404f4;return db[_0x843dc5('0x6')][_0x843dc5('0x30')](_0x22f5a4[_0x843dc5('0xb')],{})['then'](respondWithResult(_0x50a09d,0xc9))[_0x843dc5('0x15')](handleError(_0x50a09d,null));},exports['update']=function(_0x2ac6d5,_0x2a093e){const _0x443166=_0x2404f4;return _0x2ac6d5[_0x443166('0xb')]['id']&&delete _0x2ac6d5[_0x443166('0xb')]['id'],db[_0x443166('0x6')][_0x443166('0x29')]({'where':{'id':_0x2ac6d5[_0x443166('0x2')]['id']}})[_0x443166('0x2d')](handleEntityNotFound(_0x2a093e,null))[_0x443166('0x2d')](saveUpdates(_0x2ac6d5[_0x443166('0xb')],null))[_0x443166('0x2d')](respondWithResult(_0x2a093e,null))[_0x443166('0x15')](handleError(_0x2a093e,null));},exports['destroy']=function(_0x41aa10,_0x4903ec){const _0x526dd2=_0x2404f4;return db['UserProfileSection']['findOne']({'where':{'id':_0x41aa10['params']['id']}})['then'](handleEntityNotFound(_0x4903ec,null))['then'](removeEntity(_0x4903ec,null))[_0x526dd2('0x15')](handleError(_0x4903ec,null));},exports[_0x2404f4('0x2e')]=function(_0x41147d,_0x3f0d6b){const _0xc3d989=_0x2404f4;return db['UserProfileSection'][_0xc3d989('0x2e')]()[_0xc3d989('0x2d')](respondWithResult(_0x3f0d6b,null))['catch'](handleError(_0x3f0d6b,null));};