Built motion from commit 82a371561bcdbc7605c801e5e414f4032ba9e7ad. Version 3.0.0...
[motion-next.git] / server / api / userProfileSection / userProfileSection.controller.js
1 const a678_0x329c=['UserProfileSection','order','lodash','catch','limit','fields','VIRTUAL','intersection','query','../../config/logger','error','length','attributes','show','params','Content-Range','map','options','filters','body','create','where','api','../../components/parsers/qs','nolimit','rawAttributes','includeAll','undefined','sort','../../mysqldb','key','merge','offset','like','destroy','update','include','index','then','type','status','send','rows','stack','keys','fieldName','name','count','model','sendStatus','end','set','filter','findOne','describe'];(function(_0x416627,_0x329c14){const _0x465d1c=function(_0x7158eb){while(--_0x7158eb){_0x416627['push'](_0x416627['shift']());}};_0x465d1c(++_0x329c14);}(a678_0x329c,0x1d2));const a678_0x465d=function(_0x416627,_0x329c14){_0x416627=_0x416627-0x0;let _0x465d1c=a678_0x329c[_0x416627];return _0x465d1c;};const _0x2750bc=a678_0x465d;'use strict';const _=require(_0x2750bc('0x1f')),qs=require(_0x2750bc('0x34')),logger=require(_0x2750bc('0x26'))(_0x2750bc('0x33')),db=require(_0x2750bc('0x3'))['db'],{Op}=require('sequelize');function respondWithResult(_0x7158eb,_0x52f50b){return _0x52f50b=_0x52f50b||0xc8,function(_0x1f2db8){const _0x4e7c4f=a678_0x465d;if(_0x1f2db8)return _0x7158eb[_0x4e7c4f('0xe')](_0x52f50b)['json'](_0x1f2db8);};}function respondWithFilteredResult(_0xe554a6,_0x5a926c){return function(_0x321e49){const _0x38ce54=a678_0x465d;if(_0x321e49){const _0x4dd525=_0x321e49['count'],_0x937e6d=_0x5a926c[_0x38ce54('0x6')];let _0xbe820=_0x5a926c[_0x38ce54('0x6')]+_0x5a926c[_0x38ce54('0x21')],_0x17a75d;return _0xbe820>=_0x4dd525?(_0xbe820=_0x4dd525,_0x17a75d=0xc8):_0x17a75d=0xce,_0xe554a6[_0x38ce54('0xe')](_0x17a75d),_0xe554a6[_0x38ce54('0x19')](_0x38ce54('0x2c'),_0x937e6d+'-'+_0xbe820+'/'+_0x4dd525)['json'](_0x321e49);}return null;};}function saveUpdates(_0x56f8ba){return function(_0x324dfe){const _0x2df52a=a678_0x465d;if(_0x324dfe)return _0x324dfe[_0x2df52a('0x9')](_0x56f8ba)[_0x2df52a('0xc')](function(_0x1f3539){return _0x1f3539;});return null;};}function removeEntity(_0x19265a){return function(_0x315488){const _0x46ee09=a678_0x465d;if(_0x315488)return _0x315488[_0x46ee09('0x8')]()[_0x46ee09('0xc')](function(){const _0x22947a=_0x46ee09;_0x19265a[_0x22947a('0xe')](0xcc)[_0x22947a('0x18')]();});};}function handleEntityNotFound(_0x338a76){return function(_0x2c38a4){const _0x534150=a678_0x465d;return!_0x2c38a4&&_0x338a76[_0x534150('0x17')](0x194),_0x2c38a4;};}function handleError(_0xf4dd09,_0x3277eb){return _0x3277eb=_0x3277eb||0x1f4,function(_0x449167){const _0x48c49f=a678_0x465d;logger[_0x48c49f('0x27')](_0x449167[_0x48c49f('0x11')]),_0x449167[_0x48c49f('0x14')]&&delete _0x449167['name'],_0xf4dd09[_0x48c49f('0xe')](_0x3277eb)[_0x48c49f('0xf')](_0x449167);};}exports[_0x2750bc('0xb')]=function(_0xd4f624,_0x1ea481){const _0x43f7f2=_0x2750bc;let _0x2f095c={};const _0x1387ef={},_0x5319bd={'count':0x0,'rows':[]},_0x33bfb2=_[_0x43f7f2('0x2d')](db[_0x43f7f2('0x1d')][_0x43f7f2('0x36')],function(_0x559b05){const _0x2181b3=_0x43f7f2;return{'name':_0x559b05[_0x2181b3('0x13')],'type':_0x559b05[_0x2181b3('0xd')][_0x2181b3('0x4')]};});_0x1387ef['model']=_[_0x43f7f2('0x2d')](_0x33bfb2,'name'),_0x1387ef[_0x43f7f2('0x25')]=_[_0x43f7f2('0x12')](_0xd4f624[_0x43f7f2('0x25')]),_0x1387ef['filters']=_['intersection'](_0x1387ef[_0x43f7f2('0x16')],_0x1387ef[_0x43f7f2('0x25')]),_0x2f095c[_0x43f7f2('0x29')]=_[_0x43f7f2('0x24')](_0x1387ef[_0x43f7f2('0x16')],qs['fields'](_0xd4f624['query']['fields'])),_0x2f095c[_0x43f7f2('0x29')]=_0x2f095c['attributes'][_0x43f7f2('0x28')]?_0x2f095c[_0x43f7f2('0x29')]:_0x1387ef[_0x43f7f2('0x16')];typeof _0xd4f624[_0x43f7f2('0x25')][_0x43f7f2('0x35')]===_0x43f7f2('0x1')&&(_0x2f095c[_0x43f7f2('0x21')]=qs[_0x43f7f2('0x21')](_0xd4f624[_0x43f7f2('0x25')]['limit']),_0x2f095c['offset']=qs[_0x43f7f2('0x6')](_0xd4f624[_0x43f7f2('0x25')]['offset']));_0x2f095c[_0x43f7f2('0x1e')]=qs[_0x43f7f2('0x2')](_0xd4f624[_0x43f7f2('0x25')]['sort']),_0x2f095c[_0x43f7f2('0x32')]=qs[_0x43f7f2('0x2f')](_['pick'](_0xd4f624[_0x43f7f2('0x25')],_0x1387ef[_0x43f7f2('0x2f')]),_0x33bfb2);_0xd4f624[_0x43f7f2('0x25')][_0x43f7f2('0x1a')]&&(_0x2f095c[_0x43f7f2('0x32')]=_[_0x43f7f2('0x5')](_0x2f095c[_0x43f7f2('0x32')],{[Op['or']]:_['map'](_0x33bfb2,function(_0x3c9be4){const _0x581c0e=_0x43f7f2;if(_0x3c9be4[_0x581c0e('0xd')]!==_0x581c0e('0x23')){const _0x31f550={};return _0x31f550[_0x3c9be4[_0x581c0e('0x14')]]={[Op[_0x581c0e('0x7')]]:'%'+_0xd4f624[_0x581c0e('0x25')][_0x581c0e('0x1a')]+'%'},_0x31f550;}})}));_0x2f095c=_['merge']({},_0x2f095c,_0xd4f624[_0x43f7f2('0x2e')]);const _0x3d7a29={'where':_0x2f095c[_0x43f7f2('0x32')]};return db['UserProfileSection'][_0x43f7f2('0x15')](_0x3d7a29)[_0x43f7f2('0xc')](function(_0x3371da){const _0x40881c=_0x43f7f2;return _0x5319bd[_0x40881c('0x15')]=_0x3371da,_0xd4f624[_0x40881c('0x25')][_0x40881c('0x0')]&&(_0x2f095c['include']=[{'all':!![]}]),db[_0x40881c('0x1d')]['findAll'](_0x2f095c);})[_0x43f7f2('0xc')](function(_0x250bdc){const _0x50f840=_0x43f7f2;return _0x5319bd[_0x50f840('0x10')]=_0x250bdc,_0x5319bd;})[_0x43f7f2('0xc')](respondWithFilteredResult(_0x1ea481,_0x2f095c))[_0x43f7f2('0x20')](handleError(_0x1ea481,null));},exports[_0x2750bc('0x2a')]=function(_0xde8e6a,_0x322d4a){const _0x30621e=_0x2750bc;let _0x11f9ba={'raw':![],'where':{'id':_0xde8e6a[_0x30621e('0x2b')]['id']}};const _0x9157d={};return _0x9157d[_0x30621e('0x16')]=_[_0x30621e('0x12')](db[_0x30621e('0x1d')][_0x30621e('0x36')]),_0x9157d[_0x30621e('0x25')]=_[_0x30621e('0x12')](_0xde8e6a[_0x30621e('0x25')]),_0x9157d['filters']=_[_0x30621e('0x24')](_0x9157d[_0x30621e('0x16')],_0x9157d[_0x30621e('0x25')]),_0x11f9ba[_0x30621e('0x29')]=_['intersection'](_0x9157d[_0x30621e('0x16')],qs[_0x30621e('0x22')](_0xde8e6a['query'][_0x30621e('0x22')])),_0x11f9ba[_0x30621e('0x29')]=_0x11f9ba[_0x30621e('0x29')][_0x30621e('0x28')]?_0x11f9ba[_0x30621e('0x29')]:_0x9157d['model'],_0xde8e6a['query'][_0x30621e('0x0')]&&(_0x11f9ba[_0x30621e('0xa')]=[{'all':!![]}]),_0x11f9ba=_[_0x30621e('0x5')]({},_0x11f9ba,_0xde8e6a[_0x30621e('0x2e')]),db['UserProfileSection'][_0x30621e('0x1b')](_0x11f9ba)[_0x30621e('0xc')](handleEntityNotFound(_0x322d4a,null))[_0x30621e('0xc')](respondWithResult(_0x322d4a,null))[_0x30621e('0x20')](handleError(_0x322d4a,null));},exports[_0x2750bc('0x31')]=function(_0x23c248,_0x40a9d0){const _0x4848b3=_0x2750bc;return db[_0x4848b3('0x1d')]['create'](_0x23c248[_0x4848b3('0x30')],{})['then'](respondWithResult(_0x40a9d0,0xc9))['catch'](handleError(_0x40a9d0,null));},exports['update']=function(_0x546447,_0x4c0533){const _0x55ce4a=_0x2750bc;return _0x546447[_0x55ce4a('0x30')]['id']&&delete _0x546447[_0x55ce4a('0x30')]['id'],db['UserProfileSection'][_0x55ce4a('0x1b')]({'where':{'id':_0x546447[_0x55ce4a('0x2b')]['id']}})[_0x55ce4a('0xc')](handleEntityNotFound(_0x4c0533,null))[_0x55ce4a('0xc')](saveUpdates(_0x546447[_0x55ce4a('0x30')],null))[_0x55ce4a('0xc')](respondWithResult(_0x4c0533,null))[_0x55ce4a('0x20')](handleError(_0x4c0533,null));},exports[_0x2750bc('0x8')]=function(_0x1213f9,_0x3ff0b1){const _0x54daef=_0x2750bc;return db['UserProfileSection']['findOne']({'where':{'id':_0x1213f9[_0x54daef('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3ff0b1,null))[_0x54daef('0xc')](removeEntity(_0x3ff0b1,null))[_0x54daef('0x20')](handleError(_0x3ff0b1,null));},exports[_0x2750bc('0x1c')]=function(_0x3ca48b,_0x3158df){const _0x599f21=_0x2750bc;return db[_0x599f21('0x1d')][_0x599f21('0x1c')]()['then'](respondWithResult(_0x3158df,null))[_0x599f21('0x20')](handleError(_0x3158df,null));};