Built motion from commit 459747fdfe53bbf13fbede61eeaffea1f1438f86. Version 3.0.0...
[motion-next.git] / server / api / userProfileSection / userProfileSection.controller.js
1 const a678_0x40ee=['include','limit','params','end','includeAll','catch','merge','filter','show','where','attributes','then','key','destroy','json','error','index','map','fields','findAll','rows','UserProfileSection','model','type','order','describe','send','../../config/logger','count','intersection','VIRTUAL','../../mysqldb','../../components/parsers/qs','query','filters','keys','findOne','create','status','body','sort','name','undefined','rawAttributes','set','nolimit','offset','sendStatus','pick','options','sequelize','update','length'];(function(_0x30253f,_0x40ee8d){const _0x39daa6=function(_0x9606b7){while(--_0x9606b7){_0x30253f['push'](_0x30253f['shift']());}};_0x39daa6(++_0x40ee8d);}(a678_0x40ee,0xa2));const a678_0x39da=function(_0x30253f,_0x40ee8d){_0x30253f=_0x30253f-0x0;let _0x39daa6=a678_0x40ee[_0x30253f];return _0x39daa6;};const _0x2078df=a678_0x39da;'use strict';const _=require('lodash'),qs=require(_0x2078df('0x1d')),logger=require(_0x2078df('0x18'))('api'),db=require(_0x2078df('0x1c'))['db'],{Op}=require(_0x2078df('0x2f'));function respondWithResult(_0x9606b7,_0xfbf3a5){return _0xfbf3a5=_0xfbf3a5||0xc8,function(_0xfce3c2){const _0x1ea72c=a678_0x39da;if(_0xfce3c2)return _0x9606b7[_0x1ea72c('0x23')](_0xfbf3a5)['json'](_0xfce3c2);};}function respondWithFilteredResult(_0x3d3a21,_0x430700){return function(_0x163bae){const _0x2ef2f6=a678_0x39da;if(_0x163bae){const _0x3c99b8=_0x163bae[_0x2ef2f6('0x19')],_0x20101b=_0x430700[_0x2ef2f6('0x2b')];let _0x2187de=_0x430700['offset']+_0x430700[_0x2ef2f6('0x33')],_0x134c30;return _0x2187de>=_0x3c99b8?(_0x2187de=_0x3c99b8,_0x134c30=0xc8):_0x134c30=0xce,_0x3d3a21['status'](_0x134c30),_0x3d3a21[_0x2ef2f6('0x29')]('Content-Range',_0x20101b+'-'+_0x2187de+'/'+_0x3c99b8)[_0x2ef2f6('0xb')](_0x163bae);}return null;};}function saveUpdates(_0x487ca5){return function(_0x193b4f){const _0x357b35=a678_0x39da;if(_0x193b4f)return _0x193b4f[_0x357b35('0x30')](_0x487ca5)[_0x357b35('0x8')](function(_0xb26535){return _0xb26535;});return null;};}function removeEntity(_0x9b2daa){return function(_0x34cb1c){const _0x43ebd4=a678_0x39da;if(_0x34cb1c)return _0x34cb1c[_0x43ebd4('0xa')]()['then'](function(){const _0x57f32b=_0x43ebd4;_0x9b2daa['status'](0xcc)[_0x57f32b('0x0')]();});};}function handleEntityNotFound(_0x2218ae){return function(_0x1e87d1){const _0x35c9dc=a678_0x39da;return!_0x1e87d1&&_0x2218ae[_0x35c9dc('0x2c')](0x194),_0x1e87d1;};}function handleError(_0x4ea355,_0x18a18c){return _0x18a18c=_0x18a18c||0x1f4,function(_0x5e68b7){const _0x160bfe=a678_0x39da;logger[_0x160bfe('0xc')](_0x5e68b7['stack']),_0x5e68b7[_0x160bfe('0x26')]&&delete _0x5e68b7[_0x160bfe('0x26')],_0x4ea355['status'](_0x18a18c)[_0x160bfe('0x17')](_0x5e68b7);};}exports[_0x2078df('0xd')]=function(_0x69c28a,_0x9b61c1){const _0x2ca41b=_0x2078df;let _0x214387={};const _0x28dee9={},_0x2983d6={'count':0x0,'rows':[]},_0x5b1b28=_[_0x2ca41b('0xe')](db[_0x2ca41b('0x12')]['rawAttributes'],function(_0x1cd743){const _0x5e910a=_0x2ca41b;return{'name':_0x1cd743['fieldName'],'type':_0x1cd743[_0x5e910a('0x14')][_0x5e910a('0x9')]};});_0x28dee9[_0x2ca41b('0x13')]=_[_0x2ca41b('0xe')](_0x5b1b28,_0x2ca41b('0x26')),_0x28dee9[_0x2ca41b('0x1e')]=_[_0x2ca41b('0x20')](_0x69c28a[_0x2ca41b('0x1e')]),_0x28dee9[_0x2ca41b('0x1f')]=_[_0x2ca41b('0x1a')](_0x28dee9['model'],_0x28dee9[_0x2ca41b('0x1e')]),_0x214387[_0x2ca41b('0x7')]=_['intersection'](_0x28dee9[_0x2ca41b('0x13')],qs[_0x2ca41b('0xf')](_0x69c28a['query'][_0x2ca41b('0xf')])),_0x214387[_0x2ca41b('0x7')]=_0x214387['attributes'][_0x2ca41b('0x31')]?_0x214387[_0x2ca41b('0x7')]:_0x28dee9[_0x2ca41b('0x13')];typeof _0x69c28a[_0x2ca41b('0x1e')][_0x2ca41b('0x2a')]===_0x2ca41b('0x27')&&(_0x214387[_0x2ca41b('0x33')]=qs['limit'](_0x69c28a[_0x2ca41b('0x1e')][_0x2ca41b('0x33')]),_0x214387['offset']=qs[_0x2ca41b('0x2b')](_0x69c28a[_0x2ca41b('0x1e')][_0x2ca41b('0x2b')]));_0x214387[_0x2ca41b('0x15')]=qs[_0x2ca41b('0x25')](_0x69c28a['query'][_0x2ca41b('0x25')]),_0x214387[_0x2ca41b('0x6')]=qs[_0x2ca41b('0x1f')](_[_0x2ca41b('0x2d')](_0x69c28a['query'],_0x28dee9['filters']),_0x5b1b28);_0x69c28a[_0x2ca41b('0x1e')]['filter']&&(_0x214387[_0x2ca41b('0x6')]=_[_0x2ca41b('0x3')](_0x214387['where'],{[Op['or']]:_['map'](_0x5b1b28,function(_0x12783a){const _0xf9a66a=_0x2ca41b;if(_0x12783a[_0xf9a66a('0x14')]!==_0xf9a66a('0x1b')){const _0x4b33f7={};return _0x4b33f7[_0x12783a[_0xf9a66a('0x26')]]={[Op['like']]:'%'+_0x69c28a[_0xf9a66a('0x1e')][_0xf9a66a('0x4')]+'%'},_0x4b33f7;}})}));_0x214387=_[_0x2ca41b('0x3')]({},_0x214387,_0x69c28a[_0x2ca41b('0x2e')]);const _0x32c8f2={'where':_0x214387[_0x2ca41b('0x6')]};return db[_0x2ca41b('0x12')][_0x2ca41b('0x19')](_0x32c8f2)[_0x2ca41b('0x8')](function(_0x1a9482){const _0x17b3f4=_0x2ca41b;return _0x2983d6[_0x17b3f4('0x19')]=_0x1a9482,_0x69c28a['query'][_0x17b3f4('0x1')]&&(_0x214387['include']=[{'all':!![]}]),db[_0x17b3f4('0x12')][_0x17b3f4('0x10')](_0x214387);})[_0x2ca41b('0x8')](function(_0x54b867){const _0x1dc5a1=_0x2ca41b;return _0x2983d6[_0x1dc5a1('0x11')]=_0x54b867,_0x2983d6;})[_0x2ca41b('0x8')](respondWithFilteredResult(_0x9b61c1,_0x214387))[_0x2ca41b('0x2')](handleError(_0x9b61c1,null));},exports[_0x2078df('0x5')]=function(_0x252ea6,_0x325e55){const _0x4931b0=_0x2078df;let _0x4afe26={'raw':![],'where':{'id':_0x252ea6['params']['id']}};const _0x438492={};return _0x438492[_0x4931b0('0x13')]=_[_0x4931b0('0x20')](db[_0x4931b0('0x12')][_0x4931b0('0x28')]),_0x438492[_0x4931b0('0x1e')]=_['keys'](_0x252ea6[_0x4931b0('0x1e')]),_0x438492[_0x4931b0('0x1f')]=_[_0x4931b0('0x1a')](_0x438492[_0x4931b0('0x13')],_0x438492[_0x4931b0('0x1e')]),_0x4afe26['attributes']=_[_0x4931b0('0x1a')](_0x438492[_0x4931b0('0x13')],qs['fields'](_0x252ea6['query']['fields'])),_0x4afe26[_0x4931b0('0x7')]=_0x4afe26[_0x4931b0('0x7')]['length']?_0x4afe26[_0x4931b0('0x7')]:_0x438492['model'],_0x252ea6[_0x4931b0('0x1e')][_0x4931b0('0x1')]&&(_0x4afe26[_0x4931b0('0x32')]=[{'all':!![]}]),_0x4afe26=_[_0x4931b0('0x3')]({},_0x4afe26,_0x252ea6[_0x4931b0('0x2e')]),db['UserProfileSection'][_0x4931b0('0x21')](_0x4afe26)['then'](handleEntityNotFound(_0x325e55,null))[_0x4931b0('0x8')](respondWithResult(_0x325e55,null))['catch'](handleError(_0x325e55,null));},exports['create']=function(_0x389998,_0x2740e5){const _0x3edf90=_0x2078df;return db[_0x3edf90('0x12')][_0x3edf90('0x22')](_0x389998[_0x3edf90('0x24')],{})['then'](respondWithResult(_0x2740e5,0xc9))[_0x3edf90('0x2')](handleError(_0x2740e5,null));},exports['update']=function(_0x481b2e,_0x4c1a3f){const _0x8e6f46=_0x2078df;return _0x481b2e[_0x8e6f46('0x24')]['id']&&delete _0x481b2e[_0x8e6f46('0x24')]['id'],db[_0x8e6f46('0x12')][_0x8e6f46('0x21')]({'where':{'id':_0x481b2e[_0x8e6f46('0x34')]['id']}})['then'](handleEntityNotFound(_0x4c1a3f,null))['then'](saveUpdates(_0x481b2e[_0x8e6f46('0x24')],null))[_0x8e6f46('0x8')](respondWithResult(_0x4c1a3f,null))[_0x8e6f46('0x2')](handleError(_0x4c1a3f,null));},exports[_0x2078df('0xa')]=function(_0x99e22f,_0x580f3a){const _0xc884c7=_0x2078df;return db[_0xc884c7('0x12')]['findOne']({'where':{'id':_0x99e22f[_0xc884c7('0x34')]['id']}})[_0xc884c7('0x8')](handleEntityNotFound(_0x580f3a,null))[_0xc884c7('0x8')](removeEntity(_0x580f3a,null))['catch'](handleError(_0x580f3a,null));},exports[_0x2078df('0x16')]=function(_0x2a87d7,_0x5a45ab){const _0x4c8de8=_0x2078df;return db[_0x4c8de8('0x12')]['describe']()[_0x4c8de8('0x8')](respondWithResult(_0x5a45ab,null))[_0x4c8de8('0x2')](handleError(_0x5a45ab,null));};