Built motion from commit 4a18b36e645f5fa4a517d36f9783bde259878164. Version 3.0.0...
[motion-next.git] / server / api / interval / interval.controller.js
index 41cabdc..0a5660d 100644 (file)
@@ -1 +1 @@
-const a367_0x443d=['key','IntervalId','include','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','show','get','findAll','nolimit','transaction','type','undefined','getIntervals','attributes','Unable\x20to\x20retrieve\x20the\x20current\x20user','sendStatus','includeAll','like','catch','pick','name','end','body','options','Content-Range','UserProfileResource','model','create','then','api','autoAssociation','fieldName','../../components/parsers/qs','map','../../config/logger','params','where','fields','lodash','length','filter','findOne','intersection','query','Interval','json','destroy','UserProfileSection','Intervals','status','merge','offset','update','rawAttributes','keys','send','set','index','sequelize','error','limit','sort','addInterval','VIRTUAL','order','filters','rows','count'];(function(_0x4a039a,_0x443d51){const _0x207130=function(_0x3115e0){while(--_0x3115e0){_0x4a039a['push'](_0x4a039a['shift']());}};_0x207130(++_0x443d51);}(a367_0x443d,0xd8));const a367_0x2071=function(_0x4a039a,_0x443d51){_0x4a039a=_0x4a039a-0x0;let _0x207130=a367_0x443d[_0x4a039a];return _0x207130;};const _0x55404b=a367_0x2071;'use strict';const _=require(_0x55404b('0x16')),qs=require(_0x55404b('0x10')),logger=require(_0x55404b('0x12'))(_0x55404b('0xd')),db=require('../../mysqldb')['db'],{Op}=require(_0x55404b('0x2a'));function respondWithResult(_0x3115e0,_0x4bc235){return _0x4bc235=_0x4bc235||0xc8,function(_0x31575c){const _0x722615=a367_0x2071;if(_0x31575c)return _0x3115e0['status'](_0x4bc235)[_0x722615('0x1d')](_0x31575c);};}function respondWithFilteredResult(_0x3abf6a,_0x2645dc){return function(_0x333493){const _0x345e15=a367_0x2071;if(_0x333493){const _0x253a1c=_0x333493[_0x345e15('0x33')],_0x3170e7=_0x2645dc[_0x345e15('0x23')];let _0x2d6e39=_0x2645dc[_0x345e15('0x23')]+_0x2645dc[_0x345e15('0x2c')],_0x5c1fd1;return _0x2d6e39>=_0x253a1c?(_0x2d6e39=_0x253a1c,_0x5c1fd1=0xc8):_0x5c1fd1=0xce,_0x3abf6a['status'](_0x5c1fd1),_0x3abf6a[_0x345e15('0x28')](_0x345e15('0x8'),_0x3170e7+'-'+_0x2d6e39+'/'+_0x253a1c)['json'](_0x333493);}return null;};}function saveUpdates(_0x30ea60){return function(_0x3366fb){const _0x21da5=a367_0x2071;if(_0x3366fb)return _0x3366fb[_0x21da5('0x24')](_0x30ea60)[_0x21da5('0xc')](function(_0x4ac219){return _0x4ac219;});return null;};}function removeEntity(_0x28b8ed){return function(_0x206942){const _0x3b3a46=a367_0x2071;if(_0x206942)return _0x206942[_0x3b3a46('0x1e')]()[_0x3b3a46('0xc')](function(){const _0x4fff83=_0x3b3a46,_0x4fb120=_0x206942[_0x4fff83('0x39')]({'plain':!![]}),_0x270870='Intervals';return db[_0x4fff83('0x9')][_0x4fff83('0x1e')]({'where':{'type':_0x270870,'resourceId':_0x4fb120['id']}})['then'](function(){return _0x206942;});})['then'](function(){const _0x48a238=_0x3b3a46;_0x28b8ed['status'](0xcc)[_0x48a238('0x5')]();});};}function handleEntityNotFound(_0xbc996){return function(_0x418b34){const _0x2ec628=a367_0x2071;return!_0x418b34&&_0xbc996[_0x2ec628('0x42')](0x194),_0x418b34;};}function handleError(_0x584131,_0x267c9f){return _0x267c9f=_0x267c9f||0x1f4,function(_0x3ebd22){const _0x3315f1=a367_0x2071;logger[_0x3315f1('0x2b')](_0x3ebd22['stack']),_0x3ebd22[_0x3315f1('0x4')]&&delete _0x3ebd22[_0x3315f1('0x4')],_0x584131[_0x3315f1('0x21')](_0x267c9f)[_0x3315f1('0x27')](_0x3ebd22);};}exports[_0x55404b('0x29')]=function(_0xde27cf,_0x389dab){const _0x34bac5=_0x55404b;let _0x379d9a={};const _0x3bbb6b={},_0x155718={'count':0x0,'rows':[]},_0x489890=_[_0x34bac5('0x11')](db[_0x34bac5('0x1c')][_0x34bac5('0x25')],function(_0x1023b3){const _0x539481=_0x34bac5;return{'name':_0x1023b3[_0x539481('0xf')],'type':_0x1023b3['type'][_0x539481('0x34')]};});_0x3bbb6b[_0x34bac5('0xa')]=_[_0x34bac5('0x11')](_0x489890,'name'),_0x3bbb6b[_0x34bac5('0x1b')]=_[_0x34bac5('0x26')](_0xde27cf[_0x34bac5('0x1b')]),_0x3bbb6b[_0x34bac5('0x31')]=_[_0x34bac5('0x1a')](_0x3bbb6b[_0x34bac5('0xa')],_0x3bbb6b['query']),_0x379d9a[_0x34bac5('0x40')]=_[_0x34bac5('0x1a')](_0x3bbb6b['model'],qs[_0x34bac5('0x15')](_0xde27cf['query'][_0x34bac5('0x15')])),_0x379d9a[_0x34bac5('0x40')]=_0x379d9a[_0x34bac5('0x40')][_0x34bac5('0x17')]?_0x379d9a[_0x34bac5('0x40')]:_0x3bbb6b[_0x34bac5('0xa')];typeof _0xde27cf[_0x34bac5('0x1b')][_0x34bac5('0x3b')]===_0x34bac5('0x3e')&&(_0x379d9a[_0x34bac5('0x2c')]=qs['limit'](_0xde27cf['query'][_0x34bac5('0x2c')]),_0x379d9a[_0x34bac5('0x23')]=qs[_0x34bac5('0x23')](_0xde27cf[_0x34bac5('0x1b')][_0x34bac5('0x23')]));_0x379d9a[_0x34bac5('0x30')]=qs[_0x34bac5('0x2d')](_0xde27cf[_0x34bac5('0x1b')]['sort']),_0x379d9a['where']=qs[_0x34bac5('0x31')](_[_0x34bac5('0x3')](_0xde27cf[_0x34bac5('0x1b')],_0x3bbb6b['filters']),_0x489890);_0xde27cf[_0x34bac5('0x1b')][_0x34bac5('0x18')]&&(_0x379d9a['where']=_[_0x34bac5('0x22')](_0x379d9a[_0x34bac5('0x14')],{[Op['or']]:_[_0x34bac5('0x11')](_0x489890,function(_0x14b9dc){const _0x47b2b3=_0x34bac5;if(_0x14b9dc[_0x47b2b3('0x3d')]!==_0x47b2b3('0x2f')){const _0x12c986={};return _0x12c986[_0x14b9dc['name']]={[Op[_0x47b2b3('0x1')]]:'%'+_0xde27cf['query'][_0x47b2b3('0x18')]+'%'},_0x12c986;}})}));_0x379d9a=_[_0x34bac5('0x22')]({},_0x379d9a,_0xde27cf[_0x34bac5('0x7')]);const _0xd9fa6c={'where':_0x379d9a[_0x34bac5('0x14')]};return db[_0x34bac5('0x1c')][_0x34bac5('0x33')](_0xd9fa6c)[_0x34bac5('0xc')](function(_0x2d96f6){const _0x27c0c9=_0x34bac5;return _0x155718[_0x27c0c9('0x33')]=_0x2d96f6,_0xde27cf[_0x27c0c9('0x1b')][_0x27c0c9('0x0')]&&(_0x379d9a[_0x27c0c9('0x36')]=[{'all':!![]}]),db['Interval']['findAll'](_0x379d9a);})[_0x34bac5('0xc')](function(_0x5d5515){const _0x4e1fbb=_0x34bac5;return _0x155718[_0x4e1fbb('0x32')]=_0x5d5515,_0x155718;})['then'](respondWithFilteredResult(_0x389dab,_0x379d9a))[_0x34bac5('0x2')](handleError(_0x389dab,null));},exports[_0x55404b('0x38')]=function(_0x4cf725,_0x2bef3a){const _0x4c227c=_0x55404b;let _0x50dcdf={'raw':!![],'where':{'id':_0x4cf725[_0x4c227c('0x13')]['id']}};const _0x1ee821={};return _0x1ee821['model']=_[_0x4c227c('0x26')](db[_0x4c227c('0x1c')][_0x4c227c('0x25')]),_0x1ee821['query']=_[_0x4c227c('0x26')](_0x4cf725[_0x4c227c('0x1b')]),_0x1ee821['filters']=_[_0x4c227c('0x1a')](_0x1ee821[_0x4c227c('0xa')],_0x1ee821['query']),_0x50dcdf[_0x4c227c('0x40')]=_['intersection'](_0x1ee821['model'],qs['fields'](_0x4cf725['query'][_0x4c227c('0x15')])),_0x50dcdf['attributes']=_0x50dcdf[_0x4c227c('0x40')][_0x4c227c('0x17')]?_0x50dcdf['attributes']:_0x1ee821['model'],_0x4cf725['query'][_0x4c227c('0x0')]&&(_0x50dcdf[_0x4c227c('0x36')]=[{'all':!![]}]),_0x50dcdf=_['merge']({},_0x50dcdf,_0x4cf725[_0x4c227c('0x7')]),db[_0x4c227c('0x1c')]['findOne'](_0x50dcdf)[_0x4c227c('0xc')](handleEntityNotFound(_0x2bef3a,null))[_0x4c227c('0xc')](respondWithResult(_0x2bef3a,null))[_0x4c227c('0x2')](handleError(_0x2bef3a,null));},exports[_0x55404b('0xb')]=function(_0x5198c6,_0x49956d){const _0x51a412=_0x55404b;return db[_0x51a412('0x1c')]['create'](_0x5198c6['body'],{})['then'](function(_0x5a847f){const _0x10aeee=_0x51a412,_0x3f124e=_0x5198c6['user'][_0x10aeee('0x39')]({'plain':!![]});if(!_0x3f124e)throw new Error(_0x10aeee('0x41'));if(_0x3f124e['role']==='user'){const _0x93f106=_0x5a847f['get']({'plain':!![]}),_0x5dca32=_0x10aeee('0x20');return db[_0x10aeee('0x1f')][_0x10aeee('0x19')]({'where':{'name':_0x5dca32,'userProfileId':_0x3f124e['userProfileId']},'raw':!![]})[_0x10aeee('0xc')](function(_0x1ef4b7){const _0x450288=_0x10aeee;return _0x1ef4b7&&_0x1ef4b7[_0x450288('0xe')]===0x0?db['UserProfileResource'][_0x450288('0xb')]({'name':_0x93f106[_0x450288('0x4')],'resourceId':_0x93f106['id'],'type':_0x1ef4b7[_0x450288('0x4')],'sectionId':_0x1ef4b7['id']},{})['then'](function(){return _0x5a847f;}):_0x5a847f;})[_0x10aeee('0x2')](function(_0x2636e5){const _0x415e1e=_0x10aeee;logger[_0x415e1e('0x2b')](_0x415e1e('0x37'),_0x2636e5);throw _0x2636e5;});}return _0x5a847f;})[_0x51a412('0xc')](respondWithResult(_0x49956d,0xc9))[_0x51a412('0x2')](handleError(_0x49956d,null));},exports['update']=function(_0x575d39,_0x21295c){const _0x3c4bc9=_0x55404b;return _0x575d39[_0x3c4bc9('0x6')]['id']&&delete _0x575d39[_0x3c4bc9('0x6')]['id'],db[_0x3c4bc9('0x1c')][_0x3c4bc9('0x19')]({'where':{'id':_0x575d39[_0x3c4bc9('0x13')]['id']}})[_0x3c4bc9('0xc')](handleEntityNotFound(_0x21295c,null))[_0x3c4bc9('0xc')](saveUpdates(_0x575d39['body'],null))[_0x3c4bc9('0xc')](respondWithResult(_0x21295c,null))[_0x3c4bc9('0x2')](handleError(_0x21295c,null));},exports[_0x55404b('0x1e')]=function(_0x3e04f3,_0xe54fce){const _0x40b825=_0x55404b;return db[_0x40b825('0x1c')][_0x40b825('0x19')]({'where':{'id':_0x3e04f3[_0x40b825('0x13')]['id']}})['then'](handleEntityNotFound(_0xe54fce,null))[_0x40b825('0xc')](removeEntity(_0xe54fce,null))['catch'](handleError(_0xe54fce,null));},exports[_0x55404b('0x2e')]=function(_0x3c7592,_0x4c4c85){const _0x4dd307=_0x55404b;return _0x3c7592['body']['id']&&delete _0x3c7592[_0x4dd307('0x6')]['id'],db[_0x4dd307('0x1c')][_0x4dd307('0x19')]({'where':{'id':_0x3c7592[_0x4dd307('0x13')]['id']}})[_0x4dd307('0xc')](handleEntityNotFound(_0x4c4c85,null))[_0x4dd307('0xc')](function(_0x4f9097){const _0x45f5f7=_0x4dd307;if(_0x4f9097)return _0x3c7592['body'][_0x45f5f7('0x35')]=_0x4f9097['id'],db[_0x45f5f7('0x1c')][_0x45f5f7('0xb')](_0x3c7592[_0x45f5f7('0x6')]);})[_0x4dd307('0xc')](respondWithResult(_0x4c4c85,null))[_0x4dd307('0x2')](handleError(_0x4c4c85,null));},exports[_0x55404b('0x3f')]=function(_0x5fcbf,_0x2156cb){const _0x47e5b2=_0x55404b;let _0x25cede={};const _0x31fdc3={};let _0x50c116,_0x11301f;return db[_0x47e5b2('0x1c')][_0x47e5b2('0x19')]({'where':{'id':_0x5fcbf[_0x47e5b2('0x13')]['id']}})[_0x47e5b2('0xc')](handleEntityNotFound(_0x2156cb,null))[_0x47e5b2('0xc')](function(_0x40cac6){const _0x2d6940=_0x47e5b2;if(_0x40cac6)return _0x50c116=_0x40cac6,_0x31fdc3[_0x2d6940('0xa')]=_['keys'](db[_0x2d6940('0x1c')][_0x2d6940('0x25')]),_0x31fdc3[_0x2d6940('0x1b')]=_['keys'](_0x5fcbf['query']),_0x31fdc3['filters']=_[_0x2d6940('0x1a')](_0x31fdc3[_0x2d6940('0xa')],_0x31fdc3[_0x2d6940('0x1b')]),_0x25cede[_0x2d6940('0x40')]=_['intersection'](_0x31fdc3[_0x2d6940('0xa')],qs[_0x2d6940('0x15')](_0x5fcbf[_0x2d6940('0x1b')][_0x2d6940('0x15')])),_0x25cede[_0x2d6940('0x40')]=_0x25cede[_0x2d6940('0x40')][_0x2d6940('0x17')]?_0x25cede[_0x2d6940('0x40')]:_0x31fdc3[_0x2d6940('0xa')],_0x25cede[_0x2d6940('0x30')]=qs[_0x2d6940('0x2d')](_0x5fcbf[_0x2d6940('0x1b')]['sort']),_0x25cede[_0x2d6940('0x14')]=qs[_0x2d6940('0x31')](_[_0x2d6940('0x3')](_0x5fcbf[_0x2d6940('0x1b')],_0x31fdc3[_0x2d6940('0x31')])),_0x5fcbf[_0x2d6940('0x1b')][_0x2d6940('0x18')]&&(_0x25cede[_0x2d6940('0x14')]=_[_0x2d6940('0x22')](_0x25cede[_0x2d6940('0x14')],{[Op['or']]:_[_0x2d6940('0x11')](_0x25cede[_0x2d6940('0x40')],function(_0x1fb3d2){const _0x409763=_0x2d6940,_0x20f2eb={};return _0x20f2eb[_0x1fb3d2]={[Op['like']]:'%'+_0x5fcbf[_0x409763('0x1b')][_0x409763('0x18')]+'%'},_0x20f2eb;})})),_0x25cede=_[_0x2d6940('0x22')]({},_0x25cede,_0x5fcbf[_0x2d6940('0x7')]),_0x50c116[_0x2d6940('0x3f')](_0x25cede);})['then'](function(_0x1a1515){const _0x4e34ad=_0x47e5b2;if(_0x1a1515)return _0x11301f=_0x1a1515[_0x4e34ad('0x17')],typeof _0x5fcbf[_0x4e34ad('0x1b')][_0x4e34ad('0x3b')]===_0x4e34ad('0x3e')&&(_0x25cede[_0x4e34ad('0x2c')]=qs[_0x4e34ad('0x2c')](_0x5fcbf['query']['limit']),_0x25cede[_0x4e34ad('0x23')]=qs[_0x4e34ad('0x23')](_0x5fcbf[_0x4e34ad('0x1b')][_0x4e34ad('0x23')])),_0x50c116[_0x4e34ad('0x3f')](_0x25cede);})[_0x47e5b2('0xc')](function(_0x4a1c0e){if(_0x4a1c0e)return _0x4a1c0e?{'count':_0x11301f,'rows':_0x4a1c0e}:null;})[_0x47e5b2('0xc')](respondWithResult(_0x2156cb,null))[_0x47e5b2('0x2')](handleError(_0x2156cb,null));},exports['addIntervals']=function(_0x31dd23,_0x389594){const _0x36d3a1=_0x55404b;return db[_0x36d3a1('0x1c')][_0x36d3a1('0x19')]({'where':{'id':_0x31dd23['params']['id']}})[_0x36d3a1('0xc')](handleEntityNotFound(_0x389594,null))[_0x36d3a1('0xc')](function(_0xccb49e){const _0x34d5ef=_0x36d3a1;if(_0xccb49e)return db[_0x34d5ef('0x2a')][_0x34d5ef('0x3c')](function(_0x4b077b){const _0x405575=_0x34d5ef;return db[_0x405575('0x1c')][_0x405575('0x1e')]({'where':{'IntervalId':_0x31dd23[_0x405575('0x13')]['id']},'transaction':_0x4b077b})['then'](function(){const _0x2f87a8=_0x405575,_0x36cd5c=_[_0x2f87a8('0x11')](_0x31dd23[_0x2f87a8('0x6')],function(_0x903fbd){return delete _0x903fbd['id'],_0x903fbd['IntervalId']=_0x31dd23['params']['id'],_0x903fbd;});return db[_0x2f87a8('0x1c')]['bulkCreate'](_0x36cd5c,{'transaction':_0x4b077b});});})[_0x34d5ef('0xc')](function(){const _0x4e68d6=_0x34d5ef;return db[_0x4e68d6('0x1c')][_0x4e68d6('0x3a')]({'where':{'IntervalId':_0x31dd23['params']['id']}});});})[_0x36d3a1('0xc')](respondWithResult(_0x389594,null))[_0x36d3a1('0x2')](handleError(_0x389594,null));};
\ No newline at end of file
+const a367_0x17cd=['model','like','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','api','stack','intersection','../../components/parsers/qs','map','fieldName','error','include','user','../../config/logger','addInterval','name','rows','params','Intervals','offset','role','show','Interval','index','VIRTUAL','userProfileId','send','create','order','filter','options','keys','findAll','fields','sendStatus','attributes','includeAll','undefined','autoAssociation','length','bulkCreate','lodash','destroy','key','then','findOne','update','where','limit','pick','filters','IntervalId','Unable\x20to\x20retrieve\x20the\x20current\x20user','query','sort','UserProfileResource','catch','merge','type','rawAttributes','sequelize','count','json','getIntervals','get','status'];(function(_0x19ff9a,_0x17cd92){const _0x2c2e10=function(_0x588b0a){while(--_0x588b0a){_0x19ff9a['push'](_0x19ff9a['shift']());}};_0x2c2e10(++_0x17cd92);}(a367_0x17cd,0x115));const a367_0x2c2e=function(_0x19ff9a,_0x17cd92){_0x19ff9a=_0x19ff9a-0x0;let _0x2c2e10=a367_0x17cd[_0x19ff9a];return _0x2c2e10;};const _0x5a3dce=a367_0x2c2e;'use strict';const _=require(_0x5a3dce('0x1c')),qs=require(_0x5a3dce('0x3c')),logger=require(_0x5a3dce('0x0'))(_0x5a3dce('0x39')),db=require('../../mysqldb')['db'],{Op}=require(_0x5a3dce('0x2f'));function respondWithResult(_0x588b0a,_0x44c677){return _0x44c677=_0x44c677||0xc8,function(_0x4256ba){const _0x259b03=a367_0x2c2e;if(_0x4256ba)return _0x588b0a[_0x259b03('0x34')](_0x44c677)[_0x259b03('0x31')](_0x4256ba);};}function respondWithFilteredResult(_0x462db6,_0x21702d){return function(_0x57c82e){const _0x2a4164=a367_0x2c2e;if(_0x57c82e){const _0x25c32f=_0x57c82e[_0x2a4164('0x30')],_0x413d3e=_0x21702d['offset'];let _0xeaf274=_0x21702d[_0x2a4164('0x6')]+_0x21702d[_0x2a4164('0x23')],_0x413c1e;return _0xeaf274>=_0x25c32f?(_0xeaf274=_0x25c32f,_0x413c1e=0xc8):_0x413c1e=0xce,_0x462db6['status'](_0x413c1e),_0x462db6['set']('Content-Range',_0x413d3e+'-'+_0xeaf274+'/'+_0x25c32f)[_0x2a4164('0x31')](_0x57c82e);}return null;};}function saveUpdates(_0xcaaf61){return function(_0x43d1f1){const _0x404277=a367_0x2c2e;if(_0x43d1f1)return _0x43d1f1[_0x404277('0x21')](_0xcaaf61)[_0x404277('0x1f')](function(_0x43b7f5){return _0x43b7f5;});return null;};}function removeEntity(_0x26cda2){return function(_0xc1b9d9){const _0x25e3c7=a367_0x2c2e;if(_0xc1b9d9)return _0xc1b9d9['destroy']()[_0x25e3c7('0x1f')](function(){const _0x4c7df8=_0x25e3c7,_0x1f893d=_0xc1b9d9[_0x4c7df8('0x33')]({'plain':!![]}),_0x29ae0c='Intervals';return db[_0x4c7df8('0x2a')][_0x4c7df8('0x1d')]({'where':{'type':_0x29ae0c,'resourceId':_0x1f893d['id']}})[_0x4c7df8('0x1f')](function(){return _0xc1b9d9;});})[_0x25e3c7('0x1f')](function(){_0x26cda2['status'](0xcc)['end']();});};}function handleEntityNotFound(_0x4a5219){return function(_0xda8499){const _0x409c8a=a367_0x2c2e;return!_0xda8499&&_0x4a5219[_0x409c8a('0x15')](0x194),_0xda8499;};}function handleError(_0x1ceba7,_0x1591e1){return _0x1591e1=_0x1591e1||0x1f4,function(_0x5515e9){const _0x27facb=a367_0x2c2e;logger[_0x27facb('0x3f')](_0x5515e9[_0x27facb('0x3a')]),_0x5515e9[_0x27facb('0x2')]&&delete _0x5515e9[_0x27facb('0x2')],_0x1ceba7[_0x27facb('0x34')](_0x1591e1)[_0x27facb('0xd')](_0x5515e9);};}exports[_0x5a3dce('0xa')]=function(_0x5a8cb6,_0x4777fd){const _0x1e0059=_0x5a3dce;let _0x11ab2f={};const _0x2ff95c={},_0x3dc0c3={'count':0x0,'rows':[]},_0x4a1a96=_[_0x1e0059('0x3d')](db['Interval'][_0x1e0059('0x2e')],function(_0x45daca){const _0x4b69d5=_0x1e0059;return{'name':_0x45daca[_0x4b69d5('0x3e')],'type':_0x45daca['type'][_0x4b69d5('0x1e')]};});_0x2ff95c['model']=_[_0x1e0059('0x3d')](_0x4a1a96,_0x1e0059('0x2')),_0x2ff95c['query']=_[_0x1e0059('0x12')](_0x5a8cb6['query']),_0x2ff95c[_0x1e0059('0x25')]=_['intersection'](_0x2ff95c[_0x1e0059('0x35')],_0x2ff95c[_0x1e0059('0x28')]),_0x11ab2f[_0x1e0059('0x16')]=_[_0x1e0059('0x3b')](_0x2ff95c['model'],qs[_0x1e0059('0x14')](_0x5a8cb6['query'][_0x1e0059('0x14')])),_0x11ab2f[_0x1e0059('0x16')]=_0x11ab2f[_0x1e0059('0x16')][_0x1e0059('0x1a')]?_0x11ab2f[_0x1e0059('0x16')]:_0x2ff95c[_0x1e0059('0x35')];typeof _0x5a8cb6[_0x1e0059('0x28')]['nolimit']===_0x1e0059('0x18')&&(_0x11ab2f[_0x1e0059('0x23')]=qs[_0x1e0059('0x23')](_0x5a8cb6[_0x1e0059('0x28')][_0x1e0059('0x23')]),_0x11ab2f[_0x1e0059('0x6')]=qs['offset'](_0x5a8cb6[_0x1e0059('0x28')]['offset']));_0x11ab2f[_0x1e0059('0xf')]=qs['sort'](_0x5a8cb6[_0x1e0059('0x28')][_0x1e0059('0x29')]),_0x11ab2f[_0x1e0059('0x22')]=qs[_0x1e0059('0x25')](_[_0x1e0059('0x24')](_0x5a8cb6[_0x1e0059('0x28')],_0x2ff95c[_0x1e0059('0x25')]),_0x4a1a96);_0x5a8cb6['query'][_0x1e0059('0x10')]&&(_0x11ab2f['where']=_[_0x1e0059('0x2c')](_0x11ab2f[_0x1e0059('0x22')],{[Op['or']]:_[_0x1e0059('0x3d')](_0x4a1a96,function(_0x219127){const _0x43f7aa=_0x1e0059;if(_0x219127[_0x43f7aa('0x2d')]!==_0x43f7aa('0xb')){const _0x1ba5d2={};return _0x1ba5d2[_0x219127[_0x43f7aa('0x2')]]={[Op[_0x43f7aa('0x36')]]:'%'+_0x5a8cb6['query']['filter']+'%'},_0x1ba5d2;}})}));_0x11ab2f=_[_0x1e0059('0x2c')]({},_0x11ab2f,_0x5a8cb6['options']);const _0x29db64={'where':_0x11ab2f['where']};return db[_0x1e0059('0x9')][_0x1e0059('0x30')](_0x29db64)['then'](function(_0x2fead3){const _0x1d8a47=_0x1e0059;return _0x3dc0c3['count']=_0x2fead3,_0x5a8cb6[_0x1d8a47('0x28')][_0x1d8a47('0x17')]&&(_0x11ab2f['include']=[{'all':!![]}]),db[_0x1d8a47('0x9')][_0x1d8a47('0x13')](_0x11ab2f);})[_0x1e0059('0x1f')](function(_0x175dab){const _0x327bbe=_0x1e0059;return _0x3dc0c3[_0x327bbe('0x3')]=_0x175dab,_0x3dc0c3;})[_0x1e0059('0x1f')](respondWithFilteredResult(_0x4777fd,_0x11ab2f))[_0x1e0059('0x2b')](handleError(_0x4777fd,null));},exports[_0x5a3dce('0x8')]=function(_0x1b3cd2,_0x536cd5){const _0x11ad16=_0x5a3dce;let _0x24c58b={'raw':!![],'where':{'id':_0x1b3cd2[_0x11ad16('0x4')]['id']}};const _0x1995e1={};return _0x1995e1[_0x11ad16('0x35')]=_[_0x11ad16('0x12')](db[_0x11ad16('0x9')][_0x11ad16('0x2e')]),_0x1995e1[_0x11ad16('0x28')]=_[_0x11ad16('0x12')](_0x1b3cd2[_0x11ad16('0x28')]),_0x1995e1[_0x11ad16('0x25')]=_[_0x11ad16('0x3b')](_0x1995e1[_0x11ad16('0x35')],_0x1995e1[_0x11ad16('0x28')]),_0x24c58b['attributes']=_[_0x11ad16('0x3b')](_0x1995e1['model'],qs[_0x11ad16('0x14')](_0x1b3cd2[_0x11ad16('0x28')][_0x11ad16('0x14')])),_0x24c58b[_0x11ad16('0x16')]=_0x24c58b['attributes'][_0x11ad16('0x1a')]?_0x24c58b[_0x11ad16('0x16')]:_0x1995e1[_0x11ad16('0x35')],_0x1b3cd2[_0x11ad16('0x28')][_0x11ad16('0x17')]&&(_0x24c58b[_0x11ad16('0x40')]=[{'all':!![]}]),_0x24c58b=_['merge']({},_0x24c58b,_0x1b3cd2[_0x11ad16('0x11')]),db[_0x11ad16('0x9')]['findOne'](_0x24c58b)[_0x11ad16('0x1f')](handleEntityNotFound(_0x536cd5,null))['then'](respondWithResult(_0x536cd5,null))[_0x11ad16('0x2b')](handleError(_0x536cd5,null));},exports[_0x5a3dce('0xe')]=function(_0x19841b,_0x144c05){const _0x31f95a=_0x5a3dce;return db[_0x31f95a('0x9')][_0x31f95a('0xe')](_0x19841b['body'],{})[_0x31f95a('0x1f')](function(_0x48c5c4){const _0x6ad53f=_0x31f95a,_0x12e2aa=_0x19841b['user'][_0x6ad53f('0x33')]({'plain':!![]});if(!_0x12e2aa)throw new Error(_0x6ad53f('0x27'));if(_0x12e2aa[_0x6ad53f('0x7')]===_0x6ad53f('0x41')){const _0x4eb2d2=_0x48c5c4[_0x6ad53f('0x33')]({'plain':!![]}),_0x56381a=_0x6ad53f('0x5');return db['UserProfileSection'][_0x6ad53f('0x20')]({'where':{'name':_0x56381a,'userProfileId':_0x12e2aa[_0x6ad53f('0xc')]},'raw':!![]})[_0x6ad53f('0x1f')](function(_0x13ad83){const _0x449e9d=_0x6ad53f;return _0x13ad83&&_0x13ad83[_0x449e9d('0x19')]===0x0?db[_0x449e9d('0x2a')]['create']({'name':_0x4eb2d2[_0x449e9d('0x2')],'resourceId':_0x4eb2d2['id'],'type':_0x13ad83['name'],'sectionId':_0x13ad83['id']},{})[_0x449e9d('0x1f')](function(){return _0x48c5c4;}):_0x48c5c4;})[_0x6ad53f('0x2b')](function(_0x415fdc){const _0x59dbe0=_0x6ad53f;logger[_0x59dbe0('0x3f')](_0x59dbe0('0x38'),_0x415fdc);throw _0x415fdc;});}return _0x48c5c4;})['then'](respondWithResult(_0x144c05,0xc9))[_0x31f95a('0x2b')](handleError(_0x144c05,null));},exports[_0x5a3dce('0x21')]=function(_0x3f3678,_0x2d9edf){const _0x574267=_0x5a3dce;return _0x3f3678[_0x574267('0x37')]['id']&&delete _0x3f3678[_0x574267('0x37')]['id'],db[_0x574267('0x9')][_0x574267('0x20')]({'where':{'id':_0x3f3678[_0x574267('0x4')]['id']}})[_0x574267('0x1f')](handleEntityNotFound(_0x2d9edf,null))[_0x574267('0x1f')](saveUpdates(_0x3f3678[_0x574267('0x37')],null))[_0x574267('0x1f')](respondWithResult(_0x2d9edf,null))[_0x574267('0x2b')](handleError(_0x2d9edf,null));},exports[_0x5a3dce('0x1d')]=function(_0xe89169,_0x34f393){const _0x506294=_0x5a3dce;return db[_0x506294('0x9')]['findOne']({'where':{'id':_0xe89169['params']['id']}})[_0x506294('0x1f')](handleEntityNotFound(_0x34f393,null))['then'](removeEntity(_0x34f393,null))[_0x506294('0x2b')](handleError(_0x34f393,null));},exports[_0x5a3dce('0x1')]=function(_0x38641f,_0x291538){const _0x2ed888=_0x5a3dce;return _0x38641f[_0x2ed888('0x37')]['id']&&delete _0x38641f[_0x2ed888('0x37')]['id'],db[_0x2ed888('0x9')][_0x2ed888('0x20')]({'where':{'id':_0x38641f['params']['id']}})[_0x2ed888('0x1f')](handleEntityNotFound(_0x291538,null))[_0x2ed888('0x1f')](function(_0x415580){const _0x33d655=_0x2ed888;if(_0x415580)return _0x38641f[_0x33d655('0x37')][_0x33d655('0x26')]=_0x415580['id'],db[_0x33d655('0x9')][_0x33d655('0xe')](_0x38641f[_0x33d655('0x37')]);})[_0x2ed888('0x1f')](respondWithResult(_0x291538,null))[_0x2ed888('0x2b')](handleError(_0x291538,null));},exports[_0x5a3dce('0x32')]=function(_0x37e03d,_0x343ebb){const _0x544743=_0x5a3dce;let _0x47012b={};const _0x33dc66={};let _0x32b985,_0x3dcd1;return db[_0x544743('0x9')][_0x544743('0x20')]({'where':{'id':_0x37e03d[_0x544743('0x4')]['id']}})[_0x544743('0x1f')](handleEntityNotFound(_0x343ebb,null))[_0x544743('0x1f')](function(_0x5bdf93){const _0xeb4b78=_0x544743;if(_0x5bdf93)return _0x32b985=_0x5bdf93,_0x33dc66['model']=_[_0xeb4b78('0x12')](db['Interval'][_0xeb4b78('0x2e')]),_0x33dc66[_0xeb4b78('0x28')]=_[_0xeb4b78('0x12')](_0x37e03d['query']),_0x33dc66[_0xeb4b78('0x25')]=_[_0xeb4b78('0x3b')](_0x33dc66[_0xeb4b78('0x35')],_0x33dc66[_0xeb4b78('0x28')]),_0x47012b[_0xeb4b78('0x16')]=_[_0xeb4b78('0x3b')](_0x33dc66[_0xeb4b78('0x35')],qs['fields'](_0x37e03d[_0xeb4b78('0x28')]['fields'])),_0x47012b[_0xeb4b78('0x16')]=_0x47012b[_0xeb4b78('0x16')][_0xeb4b78('0x1a')]?_0x47012b[_0xeb4b78('0x16')]:_0x33dc66[_0xeb4b78('0x35')],_0x47012b['order']=qs[_0xeb4b78('0x29')](_0x37e03d['query'][_0xeb4b78('0x29')]),_0x47012b[_0xeb4b78('0x22')]=qs[_0xeb4b78('0x25')](_['pick'](_0x37e03d['query'],_0x33dc66[_0xeb4b78('0x25')])),_0x37e03d['query']['filter']&&(_0x47012b[_0xeb4b78('0x22')]=_[_0xeb4b78('0x2c')](_0x47012b[_0xeb4b78('0x22')],{[Op['or']]:_[_0xeb4b78('0x3d')](_0x47012b[_0xeb4b78('0x16')],function(_0x3235a4){const _0xdeb51a=_0xeb4b78,_0x49046d={};return _0x49046d[_0x3235a4]={[Op[_0xdeb51a('0x36')]]:'%'+_0x37e03d[_0xdeb51a('0x28')]['filter']+'%'},_0x49046d;})})),_0x47012b=_[_0xeb4b78('0x2c')]({},_0x47012b,_0x37e03d['options']),_0x32b985[_0xeb4b78('0x32')](_0x47012b);})[_0x544743('0x1f')](function(_0x774f58){const _0x2f4e92=_0x544743;if(_0x774f58)return _0x3dcd1=_0x774f58[_0x2f4e92('0x1a')],typeof _0x37e03d[_0x2f4e92('0x28')]['nolimit']==='undefined'&&(_0x47012b[_0x2f4e92('0x23')]=qs[_0x2f4e92('0x23')](_0x37e03d['query']['limit']),_0x47012b['offset']=qs[_0x2f4e92('0x6')](_0x37e03d[_0x2f4e92('0x28')][_0x2f4e92('0x6')])),_0x32b985[_0x2f4e92('0x32')](_0x47012b);})[_0x544743('0x1f')](function(_0x37449a){if(_0x37449a)return _0x37449a?{'count':_0x3dcd1,'rows':_0x37449a}:null;})[_0x544743('0x1f')](respondWithResult(_0x343ebb,null))[_0x544743('0x2b')](handleError(_0x343ebb,null));},exports['addIntervals']=function(_0x48bc83,_0x56d97f){const _0x2ce52d=_0x5a3dce;return db[_0x2ce52d('0x9')][_0x2ce52d('0x20')]({'where':{'id':_0x48bc83[_0x2ce52d('0x4')]['id']}})[_0x2ce52d('0x1f')](handleEntityNotFound(_0x56d97f,null))[_0x2ce52d('0x1f')](function(_0x379352){const _0x43f472=_0x2ce52d;if(_0x379352)return db[_0x43f472('0x2f')]['transaction'](function(_0x549c8d){const _0x428fa3=_0x43f472;return db[_0x428fa3('0x9')][_0x428fa3('0x1d')]({'where':{'IntervalId':_0x48bc83[_0x428fa3('0x4')]['id']},'transaction':_0x549c8d})[_0x428fa3('0x1f')](function(){const _0xc44aed=_0x428fa3,_0xc4fa2d=_['map'](_0x48bc83[_0xc44aed('0x37')],function(_0x202183){const _0x32172f=_0xc44aed;return delete _0x202183['id'],_0x202183[_0x32172f('0x26')]=_0x48bc83[_0x32172f('0x4')]['id'],_0x202183;});return db[_0xc44aed('0x9')][_0xc44aed('0x1b')](_0xc4fa2d,{'transaction':_0x549c8d});});})[_0x43f472('0x1f')](function(){const _0x5c60ce=_0x43f472;return db[_0x5c60ce('0x9')]['findAll']({'where':{'IntervalId':_0x48bc83[_0x5c60ce('0x4')]['id']}});});})[_0x2ce52d('0x1f')](respondWithResult(_0x56d97f,null))[_0x2ce52d('0x2b')](handleError(_0x56d97f,null));};
\ No newline at end of file