Built motion from commit 14588770.|2.5.38
[motion2.git] / server / api / interval / interval.controller.js
index 8f2b685..cddc153 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4f66=['../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','sendStatus','error','send','index','rawAttributes','fieldName','type','model','name','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','Interval','findAll','rows','show','params','keys','includeAll','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','map','hasOwnProperty','addIntervals','findOne','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x43459b,_0x220fae){var _0x557c66=function(_0xc4fd96){while(--_0xc4fd96){_0x43459b['push'](_0x43459b['shift']());}};_0x557c66(++_0x220fae);}(_0x4f66,0x1b9));var _0x64f6=function(_0x111ce3,_0x5e12aa){_0x111ce3=_0x111ce3-0x0;var _0xd0c223=_0x4f66[_0x111ce3];return _0xd0c223;};'use strict';var pdf=require(_0x64f6('0x0'));var emlformat=require(_0x64f6('0x1'));var rimraf=require(_0x64f6('0x2'));var zipdir=require(_0x64f6('0x3'));var jsonpatch=require(_0x64f6('0x4'));var rp=require(_0x64f6('0x5'));var moment=require(_0x64f6('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x64f6('0x7'));var path=require(_0x64f6('0x8'));var sox=require(_0x64f6('0x9'));var csv=require(_0x64f6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x64f6('0xb'));var squel=require('squel');var crypto=require(_0x64f6('0xc'));var jsforce=require(_0x64f6('0xd'));var deskjs=require(_0x64f6('0xe'));var toCsv=require(_0x64f6('0xa'));var querystring=require(_0x64f6('0xf'));var Papa=require(_0x64f6('0x10'));var Redis=require(_0x64f6('0x11'));var authService=require(_0x64f6('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64f6('0x13'));var logger=require(_0x64f6('0x14'))(_0x64f6('0x15'));var utils=require(_0x64f6('0x16'));var config=require(_0x64f6('0x17'));var db=require(_0x64f6('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x38776f,_0x54c587){_0x54c587=_0x54c587||0xcc;return function(_0x3a24fd){if(_0x3a24fd){return _0x38776f['sendStatus'](_0x54c587);}return _0x38776f[_0x64f6('0x19')](_0x54c587)[_0x64f6('0x1a')]();};}function respondWithResult(_0x1e2e34,_0x20c973){_0x20c973=_0x20c973||0xc8;return function(_0x3b23d0){if(_0x3b23d0){return _0x1e2e34[_0x64f6('0x19')](_0x20c973)[_0x64f6('0x1b')](_0x3b23d0);}};}function respondWithFilteredResult(_0x316597,_0x3a8883){return function(_0x13c658){if(_0x13c658){var _0x18515f=_0x13c658[_0x64f6('0x1c')],_0x36cd81=_0x3a8883[_0x64f6('0x1d')],_0x576aeb=_0x3a8883[_0x64f6('0x1d')]+_0x3a8883[_0x64f6('0x1e')],_0x545d2a;if(_0x576aeb>=_0x18515f){_0x576aeb=_0x18515f;_0x545d2a=0xc8;}else{_0x545d2a=0xce;}_0x316597[_0x64f6('0x19')](_0x545d2a);return _0x316597[_0x64f6('0x1f')](_0x64f6('0x20'),_0x36cd81+'-'+_0x576aeb+'/'+_0x18515f)['json'](_0x13c658);}return null;};}function patchUpdates(_0x238e88){return function(_0x534bfe){try{jsonpatch['apply'](_0x534bfe,_0x238e88,!![]);}catch(_0x4b627a){return BPromise[_0x64f6('0x21')](_0x4b627a);}return _0x534bfe[_0x64f6('0x22')]();};}function saveUpdates(_0x773318,_0x3566d4){return function(_0x385d0f){if(_0x385d0f){return _0x385d0f[_0x64f6('0x23')](_0x773318)[_0x64f6('0x24')](function(_0x2fd208){return _0x2fd208;});}return null;};}function removeEntity(_0x28b974,_0x4eff98){return function(_0x9c950c){if(_0x9c950c){return _0x9c950c[_0x64f6('0x25')]()[_0x64f6('0x24')](function(){var _0x5cd616=_0x9c950c[_0x64f6('0x26')]({'plain':!![]});var _0x391483=_0x64f6('0x27');return db[_0x64f6('0x28')][_0x64f6('0x25')]({'where':{'type':_0x391483,'resourceId':_0x5cd616['id']}})['then'](function(){return _0x9c950c;});})['then'](function(){_0x28b974[_0x64f6('0x19')](0xcc)[_0x64f6('0x1a')]();});}};}function handleEntityNotFound(_0x24359f,_0x160255){return function(_0xea95a3){if(!_0xea95a3){_0x24359f[_0x64f6('0x29')](0x194);}return _0xea95a3;};}function handleError(_0x6952ea,_0x1774bb){_0x1774bb=_0x1774bb||0x1f4;return function(_0x5daf28){logger[_0x64f6('0x2a')](_0x5daf28['stack']);if(_0x5daf28['name']){delete _0x5daf28['name'];}_0x6952ea['status'](_0x1774bb)[_0x64f6('0x2b')](_0x5daf28);};}exports[_0x64f6('0x2c')]=function(_0x58dcbc,_0xc80291){var _0x23df17={},_0x45f0cb={},_0x348b97={'count':0x0,'rows':[]};var _0x147b38=_['map'](db['Interval'][_0x64f6('0x2d')],function(_0xaca904){return{'name':_0xaca904[_0x64f6('0x2e')],'type':_0xaca904[_0x64f6('0x2f')]['key']};});_0x45f0cb[_0x64f6('0x30')]=_['map'](_0x147b38,_0x64f6('0x31'));_0x45f0cb['query']=_['keys'](_0x58dcbc[_0x64f6('0x32')]);_0x45f0cb[_0x64f6('0x33')]=_['intersection'](_0x45f0cb[_0x64f6('0x30')],_0x45f0cb[_0x64f6('0x32')]);_0x23df17[_0x64f6('0x34')]=_[_0x64f6('0x35')](_0x45f0cb[_0x64f6('0x30')],qs[_0x64f6('0x36')](_0x58dcbc[_0x64f6('0x32')][_0x64f6('0x36')]));_0x23df17[_0x64f6('0x34')]=_0x23df17[_0x64f6('0x34')][_0x64f6('0x37')]?_0x23df17[_0x64f6('0x34')]:_0x45f0cb['model'];if(!_0x58dcbc[_0x64f6('0x32')]['hasOwnProperty'](_0x64f6('0x38'))){_0x23df17['limit']=qs[_0x64f6('0x1e')](_0x58dcbc[_0x64f6('0x32')]['limit']);_0x23df17[_0x64f6('0x1d')]=qs[_0x64f6('0x1d')](_0x58dcbc[_0x64f6('0x32')][_0x64f6('0x1d')]);}_0x23df17[_0x64f6('0x39')]=qs[_0x64f6('0x3a')](_0x58dcbc[_0x64f6('0x32')][_0x64f6('0x3a')]);_0x23df17[_0x64f6('0x3b')]=qs[_0x64f6('0x33')](_[_0x64f6('0x3c')](_0x58dcbc[_0x64f6('0x32')],_0x45f0cb[_0x64f6('0x33')]),_0x147b38);if(_0x58dcbc['query'][_0x64f6('0x3d')]){_0x23df17[_0x64f6('0x3b')]=_[_0x64f6('0x3e')](_0x23df17[_0x64f6('0x3b')],{'$or':_['map'](_0x147b38,function(_0x36693b){if(_0x36693b[_0x64f6('0x2f')]!=='VIRTUAL'){var _0x2a6131={};_0x2a6131[_0x36693b[_0x64f6('0x31')]]={'$like':'%'+_0x58dcbc[_0x64f6('0x32')]['filter']+'%'};return _0x2a6131;}})});}_0x23df17=_[_0x64f6('0x3e')]({},_0x23df17,_0x58dcbc[_0x64f6('0x3f')]);var _0x246c76={'where':_0x23df17[_0x64f6('0x3b')]};return db['Interval']['count'](_0x246c76)[_0x64f6('0x24')](function(_0x3cda9d){_0x348b97[_0x64f6('0x1c')]=_0x3cda9d;if(_0x58dcbc[_0x64f6('0x32')]['includeAll']){_0x23df17['include']=[{'all':!![]}];}return db[_0x64f6('0x40')][_0x64f6('0x41')](_0x23df17);})[_0x64f6('0x24')](function(_0x491266){_0x348b97[_0x64f6('0x42')]=_0x491266;return _0x348b97;})[_0x64f6('0x24')](respondWithFilteredResult(_0xc80291,_0x23df17))['catch'](handleError(_0xc80291,null));};exports[_0x64f6('0x43')]=function(_0x24a7e9,_0x3c81e7){var _0x3d45ad={'raw':!![],'where':{'id':_0x24a7e9[_0x64f6('0x44')]['id']}},_0x24d2a0={};_0x24d2a0['model']=_[_0x64f6('0x45')](db[_0x64f6('0x40')][_0x64f6('0x2d')]);_0x24d2a0['query']=_[_0x64f6('0x45')](_0x24a7e9[_0x64f6('0x32')]);_0x24d2a0[_0x64f6('0x33')]=_['intersection'](_0x24d2a0[_0x64f6('0x30')],_0x24d2a0[_0x64f6('0x32')]);_0x3d45ad[_0x64f6('0x34')]=_[_0x64f6('0x35')](_0x24d2a0[_0x64f6('0x30')],qs['fields'](_0x24a7e9[_0x64f6('0x32')]['fields']));_0x3d45ad[_0x64f6('0x34')]=_0x3d45ad[_0x64f6('0x34')][_0x64f6('0x37')]?_0x3d45ad['attributes']:_0x24d2a0[_0x64f6('0x30')];if(_0x24a7e9[_0x64f6('0x32')][_0x64f6('0x46')]){_0x3d45ad[_0x64f6('0x47')]=[{'all':!![]}];}_0x3d45ad=_[_0x64f6('0x3e')]({},_0x3d45ad,_0x24a7e9[_0x64f6('0x3f')]);return db[_0x64f6('0x40')]['find'](_0x3d45ad)[_0x64f6('0x24')](handleEntityNotFound(_0x3c81e7,null))[_0x64f6('0x24')](respondWithResult(_0x3c81e7,null))[_0x64f6('0x48')](handleError(_0x3c81e7,null));};exports[_0x64f6('0x49')]=function(_0x5c3b35,_0xa0126e){return db['Interval']['create'](_0x5c3b35[_0x64f6('0x4a')],{})[_0x64f6('0x24')](function(_0x967f71){var _0x5d53b3=_0x5c3b35[_0x64f6('0x4b')][_0x64f6('0x26')]({'plain':!![]});if(!_0x5d53b3)throw new Error(_0x64f6('0x4c'));if(_0x5d53b3[_0x64f6('0x4d')]==='user'){var _0x8b7298=_0x967f71['get']({'plain':!![]});var _0x5dda07='Intervals';return db[_0x64f6('0x4e')][_0x64f6('0x4f')]({'where':{'name':_0x5dda07,'userProfileId':_0x5d53b3[_0x64f6('0x50')]},'raw':!![]})[_0x64f6('0x24')](function(_0x5a5a53){if(_0x5a5a53&&_0x5a5a53[_0x64f6('0x51')]===0x0){return db[_0x64f6('0x28')][_0x64f6('0x49')]({'name':_0x8b7298[_0x64f6('0x31')],'resourceId':_0x8b7298['id'],'type':_0x5a5a53[_0x64f6('0x31')],'sectionId':_0x5a5a53['id']},{})[_0x64f6('0x24')](function(){return _0x967f71;});}else{return _0x967f71;}})[_0x64f6('0x48')](function(_0x549621){logger[_0x64f6('0x2a')](_0x64f6('0x52'),_0x549621);throw _0x549621;});}return _0x967f71;})[_0x64f6('0x24')](respondWithResult(_0xa0126e,0xc9))[_0x64f6('0x48')](handleError(_0xa0126e,null));};exports[_0x64f6('0x23')]=function(_0x47aa3e,_0x469f23){if(_0x47aa3e['body']['id']){delete _0x47aa3e[_0x64f6('0x4a')]['id'];}return db[_0x64f6('0x40')][_0x64f6('0x4f')]({'where':{'id':_0x47aa3e[_0x64f6('0x44')]['id']}})[_0x64f6('0x24')](handleEntityNotFound(_0x469f23,null))[_0x64f6('0x24')](saveUpdates(_0x47aa3e[_0x64f6('0x4a')],null))[_0x64f6('0x24')](respondWithResult(_0x469f23,null))[_0x64f6('0x48')](handleError(_0x469f23,null));};exports[_0x64f6('0x25')]=function(_0x55f720,_0x6624ce){return db[_0x64f6('0x40')][_0x64f6('0x4f')]({'where':{'id':_0x55f720[_0x64f6('0x44')]['id']}})[_0x64f6('0x24')](handleEntityNotFound(_0x6624ce,null))[_0x64f6('0x24')](removeEntity(_0x6624ce,null))[_0x64f6('0x48')](handleError(_0x6624ce,null));};exports[_0x64f6('0x53')]=function(_0x493b47,_0x15ef12,_0x135ad4){if(_0x493b47[_0x64f6('0x4a')]['id']){delete _0x493b47[_0x64f6('0x4a')]['id'];}return db[_0x64f6('0x40')][_0x64f6('0x4f')]({'where':{'id':_0x493b47[_0x64f6('0x44')]['id']}})[_0x64f6('0x24')](handleEntityNotFound(_0x15ef12,null))[_0x64f6('0x24')](function(_0x2fe582){if(_0x2fe582){_0x493b47[_0x64f6('0x4a')][_0x64f6('0x54')]=_0x2fe582['id'];return db['Interval'][_0x64f6('0x49')](_0x493b47[_0x64f6('0x4a')]);}})[_0x64f6('0x24')](respondWithResult(_0x15ef12,null))['catch'](handleError(_0x15ef12,null));};exports[_0x64f6('0x55')]=function(_0x351802,_0x22f946,_0x76e5a6){var _0x4ecf1f={};var _0x3bd22b={};var _0x5d172d;var _0x39e742;return db[_0x64f6('0x40')]['findOne']({'where':{'id':_0x351802['params']['id']}})[_0x64f6('0x24')](handleEntityNotFound(_0x22f946,null))['then'](function(_0x54c0ec){if(_0x54c0ec){_0x5d172d=_0x54c0ec;_0x3bd22b[_0x64f6('0x30')]=_['keys'](db[_0x64f6('0x40')]['rawAttributes']);_0x3bd22b[_0x64f6('0x32')]=_[_0x64f6('0x45')](_0x351802[_0x64f6('0x32')]);_0x3bd22b[_0x64f6('0x33')]=_[_0x64f6('0x35')](_0x3bd22b['model'],_0x3bd22b[_0x64f6('0x32')]);_0x4ecf1f[_0x64f6('0x34')]=_[_0x64f6('0x35')](_0x3bd22b[_0x64f6('0x30')],qs[_0x64f6('0x36')](_0x351802[_0x64f6('0x32')][_0x64f6('0x36')]));_0x4ecf1f['attributes']=_0x4ecf1f[_0x64f6('0x34')][_0x64f6('0x37')]?_0x4ecf1f[_0x64f6('0x34')]:_0x3bd22b[_0x64f6('0x30')];_0x4ecf1f['order']=qs[_0x64f6('0x3a')](_0x351802[_0x64f6('0x32')][_0x64f6('0x3a')]);_0x4ecf1f['where']=qs[_0x64f6('0x33')](_['pick'](_0x351802[_0x64f6('0x32')],_0x3bd22b[_0x64f6('0x33')]));if(_0x351802[_0x64f6('0x32')][_0x64f6('0x3d')]){_0x4ecf1f['where']=_[_0x64f6('0x3e')](_0x4ecf1f[_0x64f6('0x3b')],{'$or':_[_0x64f6('0x56')](_0x4ecf1f[_0x64f6('0x34')],function(_0x98bcb){var _0x3fbf34={};_0x3fbf34[_0x98bcb]={'$like':'%'+_0x351802['query'][_0x64f6('0x3d')]+'%'};return _0x3fbf34;})});}_0x4ecf1f=_['merge']({},_0x4ecf1f,_0x351802[_0x64f6('0x3f')]);return _0x5d172d['getIntervals'](_0x4ecf1f);}})[_0x64f6('0x24')](function(_0x382a93){if(_0x382a93){_0x39e742=_0x382a93['length'];if(!_0x351802[_0x64f6('0x32')][_0x64f6('0x57')](_0x64f6('0x38'))){_0x4ecf1f['limit']=qs[_0x64f6('0x1e')](_0x351802[_0x64f6('0x32')][_0x64f6('0x1e')]);_0x4ecf1f[_0x64f6('0x1d')]=qs[_0x64f6('0x1d')](_0x351802[_0x64f6('0x32')][_0x64f6('0x1d')]);}return _0x5d172d[_0x64f6('0x55')](_0x4ecf1f);}})['then'](function(_0x2d0bf9){if(_0x2d0bf9){return _0x2d0bf9?{'count':_0x39e742,'rows':_0x2d0bf9}:null;}})['then'](respondWithResult(_0x22f946,null))[_0x64f6('0x48')](handleError(_0x22f946,null));};exports[_0x64f6('0x58')]=function(_0x27fe94,_0x4c6113,_0x561de3){return db['Interval'][_0x64f6('0x59')]({'where':{'id':_0x27fe94['params']['id']}})[_0x64f6('0x24')](handleEntityNotFound(_0x4c6113,null))[_0x64f6('0x24')](function(_0x56fb40){if(_0x56fb40){return db[_0x64f6('0x5a')][_0x64f6('0x5b')](function(_0x50a9c8){return db[_0x64f6('0x40')][_0x64f6('0x25')]({'where':{'IntervalId':_0x27fe94[_0x64f6('0x44')]['id']},'transaction':_0x50a9c8})[_0x64f6('0x24')](function(_0xe41c96){var _0x3c26b5=_['map'](_0x27fe94[_0x64f6('0x4a')],function(_0x1659d5){delete _0x1659d5['id'];_0x1659d5[_0x64f6('0x54')]=_0x27fe94[_0x64f6('0x44')]['id'];return _0x1659d5;});return db['Interval'][_0x64f6('0x5c')](_0x3c26b5,{'transaction':_0x50a9c8});});})[_0x64f6('0x24')](function(){return db[_0x64f6('0x40')][_0x64f6('0x41')]({'where':{'IntervalId':_0x27fe94['params']['id']}});});}})[_0x64f6('0x24')](respondWithResult(_0x4c6113,null))[_0x64f6('0x48')](handleError(_0x4c6113,null));};
\ No newline at end of file
+var _0xfb69=['addIntervals','sequelize','transaction','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','Intervals','UserProfileResource','sendStatus','error','name','send','index','map','Interval','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','getIntervals','findOne','hasOwnProperty'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xfb69,0x67));var _0x9fb6=function(_0x22edd1,_0x2e37ef){_0x22edd1=_0x22edd1-0x0;var _0xf7cbb9=_0xfb69[_0x22edd1];return _0xf7cbb9;};'use strict';var emlformat=require(_0x9fb6('0x0'));var rimraf=require(_0x9fb6('0x1'));var zipdir=require(_0x9fb6('0x2'));var jsonpatch=require(_0x9fb6('0x3'));var rp=require(_0x9fb6('0x4'));var moment=require(_0x9fb6('0x5'));var BPromise=require(_0x9fb6('0x6'));var Mustache=require(_0x9fb6('0x7'));var util=require(_0x9fb6('0x8'));var path=require(_0x9fb6('0x9'));var sox=require(_0x9fb6('0xa'));var csv=require(_0x9fb6('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9fb6('0xc'));var _=require(_0x9fb6('0xd'));var squel=require(_0x9fb6('0xe'));var crypto=require(_0x9fb6('0xf'));var jsforce=require(_0x9fb6('0x10'));var deskjs=require(_0x9fb6('0x11'));var toCsv=require(_0x9fb6('0xb'));var querystring=require(_0x9fb6('0x12'));var Papa=require(_0x9fb6('0x13'));var Redis=require('ioredis');var authService=require(_0x9fb6('0x14'));var qs=require(_0x9fb6('0x15'));var as=require(_0x9fb6('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fb6('0x17'))('api');var utils=require(_0x9fb6('0x18'));var config=require(_0x9fb6('0x19'));var licenseUtil=require(_0x9fb6('0x1a'));var db=require(_0x9fb6('0x1b'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x3433e6,_0x398e27){_0x398e27=_0x398e27||0xcc;return function(_0x25c720){if(_0x25c720){return _0x3433e6['sendStatus'](_0x398e27);}return _0x3433e6['status'](_0x398e27)[_0x9fb6('0x1c')]();};}function respondWithResult(_0x3b3a4a,_0x42ec5d){_0x42ec5d=_0x42ec5d||0xc8;return function(_0x2bd335){if(_0x2bd335){return _0x3b3a4a[_0x9fb6('0x1d')](_0x42ec5d)[_0x9fb6('0x1e')](_0x2bd335);}};}function respondWithFilteredResult(_0x37d6e9,_0x2ae6d8){return function(_0x8cdf81){if(_0x8cdf81){var _0x2441bf=typeof _0x2ae6d8[_0x9fb6('0x1f')]===_0x9fb6('0x20')&&typeof _0x2ae6d8[_0x9fb6('0x21')]===_0x9fb6('0x20');var _0x5b21d9=_0x8cdf81['count'];var _0x1c8039=_0x2441bf?0x0:_0x2ae6d8['offset'];var _0x10e869=_0x2441bf?_0x8cdf81[_0x9fb6('0x22')]:_0x2ae6d8[_0x9fb6('0x1f')]+_0x2ae6d8['limit'];var _0x582048;if(_0x10e869>=_0x5b21d9){_0x10e869=_0x5b21d9;_0x582048=0xc8;}else{_0x582048=0xce;}_0x37d6e9[_0x9fb6('0x1d')](_0x582048);return _0x37d6e9[_0x9fb6('0x23')]('Content-Range',_0x1c8039+'-'+_0x10e869+'/'+_0x5b21d9)[_0x9fb6('0x1e')](_0x8cdf81);}return null;};}function patchUpdates(_0x592803){return function(_0x1349ad){try{jsonpatch[_0x9fb6('0x24')](_0x1349ad,_0x592803,!![]);}catch(_0x351b80){return BPromise[_0x9fb6('0x25')](_0x351b80);}return _0x1349ad[_0x9fb6('0x26')]();};}function saveUpdates(_0x3fd2cf,_0x1acbdc){return function(_0xa34d5c){if(_0xa34d5c){return _0xa34d5c[_0x9fb6('0x27')](_0x3fd2cf)[_0x9fb6('0x28')](function(_0x1fdea5){return _0x1fdea5;});}return null;};}function removeEntity(_0x80944b,_0xddd88c){return function(_0x447603){if(_0x447603){return _0x447603[_0x9fb6('0x29')]()[_0x9fb6('0x28')](function(){var _0x2988c4=_0x447603['get']({'plain':!![]});var _0x1eb6fa=_0x9fb6('0x2a');return db[_0x9fb6('0x2b')][_0x9fb6('0x29')]({'where':{'type':_0x1eb6fa,'resourceId':_0x2988c4['id']}})[_0x9fb6('0x28')](function(){return _0x447603;});})['then'](function(){_0x80944b[_0x9fb6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53fb34,_0x6a95e2){return function(_0x56a9be){if(!_0x56a9be){_0x53fb34[_0x9fb6('0x2c')](0x194);}return _0x56a9be;};}function handleError(_0xd57795,_0x1cfa11){_0x1cfa11=_0x1cfa11||0x1f4;return function(_0x56916d){logger[_0x9fb6('0x2d')](_0x56916d['stack']);if(_0x56916d[_0x9fb6('0x2e')]){delete _0x56916d[_0x9fb6('0x2e')];}_0xd57795[_0x9fb6('0x1d')](_0x1cfa11)[_0x9fb6('0x2f')](_0x56916d);};}exports[_0x9fb6('0x30')]=function(_0x381369,_0x229db8){var _0x5c8665={},_0x4acb1c={},_0x346fa1={'count':0x0,'rows':[]};var _0x4b6a35=_[_0x9fb6('0x31')](db[_0x9fb6('0x32')]['rawAttributes'],function(_0x1afe19){return{'name':_0x1afe19[_0x9fb6('0x33')],'type':_0x1afe19[_0x9fb6('0x34')]['key']};});_0x4acb1c[_0x9fb6('0x35')]=_[_0x9fb6('0x31')](_0x4b6a35,_0x9fb6('0x2e'));_0x4acb1c[_0x9fb6('0x36')]=_[_0x9fb6('0x37')](_0x381369[_0x9fb6('0x36')]);_0x4acb1c[_0x9fb6('0x38')]=_['intersection'](_0x4acb1c[_0x9fb6('0x35')],_0x4acb1c['query']);_0x5c8665['attributes']=_[_0x9fb6('0x39')](_0x4acb1c[_0x9fb6('0x35')],qs[_0x9fb6('0x3a')](_0x381369['query'][_0x9fb6('0x3a')]));_0x5c8665[_0x9fb6('0x3b')]=_0x5c8665[_0x9fb6('0x3b')][_0x9fb6('0x3c')]?_0x5c8665[_0x9fb6('0x3b')]:_0x4acb1c['model'];if(!_0x381369[_0x9fb6('0x36')]['hasOwnProperty'](_0x9fb6('0x3d'))){_0x5c8665[_0x9fb6('0x21')]=qs[_0x9fb6('0x21')](_0x381369[_0x9fb6('0x36')][_0x9fb6('0x21')]);_0x5c8665['offset']=qs[_0x9fb6('0x1f')](_0x381369['query'][_0x9fb6('0x1f')]);}_0x5c8665[_0x9fb6('0x3e')]=qs[_0x9fb6('0x3f')](_0x381369[_0x9fb6('0x36')][_0x9fb6('0x3f')]);_0x5c8665['where']=qs['filters'](_[_0x9fb6('0x40')](_0x381369[_0x9fb6('0x36')],_0x4acb1c[_0x9fb6('0x38')]),_0x4b6a35);if(_0x381369[_0x9fb6('0x36')]['filter']){_0x5c8665[_0x9fb6('0x41')]=_[_0x9fb6('0x42')](_0x5c8665[_0x9fb6('0x41')],{'$or':_[_0x9fb6('0x31')](_0x4b6a35,function(_0x3ac0d7){if(_0x3ac0d7[_0x9fb6('0x34')]!==_0x9fb6('0x43')){var _0xbc515={};_0xbc515[_0x3ac0d7[_0x9fb6('0x2e')]]={'$like':'%'+_0x381369['query'][_0x9fb6('0x44')]+'%'};return _0xbc515;}})});}_0x5c8665=_[_0x9fb6('0x42')]({},_0x5c8665,_0x381369[_0x9fb6('0x45')]);var _0x4609dd={'where':_0x5c8665[_0x9fb6('0x41')]};return db[_0x9fb6('0x32')][_0x9fb6('0x22')](_0x4609dd)[_0x9fb6('0x28')](function(_0x2f5a37){_0x346fa1[_0x9fb6('0x22')]=_0x2f5a37;if(_0x381369['query'][_0x9fb6('0x46')]){_0x5c8665[_0x9fb6('0x47')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x5c8665);})[_0x9fb6('0x28')](function(_0x567b75){_0x346fa1[_0x9fb6('0x48')]=_0x567b75;return _0x346fa1;})[_0x9fb6('0x28')](respondWithFilteredResult(_0x229db8,_0x5c8665))[_0x9fb6('0x49')](handleError(_0x229db8,null));};exports[_0x9fb6('0x4a')]=function(_0x3896c5,_0x416b3e){var _0x5eca1d={'raw':!![],'where':{'id':_0x3896c5['params']['id']}},_0x5495b3={};_0x5495b3[_0x9fb6('0x35')]=_[_0x9fb6('0x37')](db['Interval'][_0x9fb6('0x4b')]);_0x5495b3[_0x9fb6('0x36')]=_['keys'](_0x3896c5[_0x9fb6('0x36')]);_0x5495b3[_0x9fb6('0x38')]=_[_0x9fb6('0x39')](_0x5495b3[_0x9fb6('0x35')],_0x5495b3[_0x9fb6('0x36')]);_0x5eca1d['attributes']=_[_0x9fb6('0x39')](_0x5495b3[_0x9fb6('0x35')],qs[_0x9fb6('0x3a')](_0x3896c5[_0x9fb6('0x36')]['fields']));_0x5eca1d['attributes']=_0x5eca1d[_0x9fb6('0x3b')][_0x9fb6('0x3c')]?_0x5eca1d['attributes']:_0x5495b3['model'];if(_0x3896c5[_0x9fb6('0x36')][_0x9fb6('0x46')]){_0x5eca1d['include']=[{'all':!![]}];}_0x5eca1d=_[_0x9fb6('0x42')]({},_0x5eca1d,_0x3896c5[_0x9fb6('0x45')]);return db[_0x9fb6('0x32')][_0x9fb6('0x4c')](_0x5eca1d)[_0x9fb6('0x28')](handleEntityNotFound(_0x416b3e,null))['then'](respondWithResult(_0x416b3e,null))[_0x9fb6('0x49')](handleError(_0x416b3e,null));};exports[_0x9fb6('0x4d')]=function(_0x2df490,_0x2af7da){return db[_0x9fb6('0x32')][_0x9fb6('0x4d')](_0x2df490[_0x9fb6('0x4e')],{})['then'](function(_0x5e1bd3){var _0x3d96d1=_0x2df490[_0x9fb6('0x4f')][_0x9fb6('0x50')]({'plain':!![]});if(!_0x3d96d1)throw new Error(_0x9fb6('0x51'));if(_0x3d96d1[_0x9fb6('0x52')]===_0x9fb6('0x4f')){var _0x18ac52=_0x5e1bd3[_0x9fb6('0x50')]({'plain':!![]});var _0x17502e='Intervals';return db[_0x9fb6('0x53')][_0x9fb6('0x4c')]({'where':{'name':_0x17502e,'userProfileId':_0x3d96d1[_0x9fb6('0x54')]},'raw':!![]})[_0x9fb6('0x28')](function(_0x51362d){if(_0x51362d&&_0x51362d[_0x9fb6('0x55')]===0x0){return db[_0x9fb6('0x2b')][_0x9fb6('0x4d')]({'name':_0x18ac52[_0x9fb6('0x2e')],'resourceId':_0x18ac52['id'],'type':_0x51362d['name'],'sectionId':_0x51362d['id']},{})[_0x9fb6('0x28')](function(){return _0x5e1bd3;});}else{return _0x5e1bd3;}})[_0x9fb6('0x49')](function(_0x7db6dd){logger[_0x9fb6('0x2d')](_0x9fb6('0x56'),_0x7db6dd);throw _0x7db6dd;});}return _0x5e1bd3;})['then'](respondWithResult(_0x2af7da,0xc9))[_0x9fb6('0x49')](handleError(_0x2af7da,null));};exports[_0x9fb6('0x27')]=function(_0x2632e1,_0x279f9f){if(_0x2632e1[_0x9fb6('0x4e')]['id']){delete _0x2632e1[_0x9fb6('0x4e')]['id'];}return db['Interval'][_0x9fb6('0x4c')]({'where':{'id':_0x2632e1[_0x9fb6('0x57')]['id']}})[_0x9fb6('0x28')](handleEntityNotFound(_0x279f9f,null))['then'](saveUpdates(_0x2632e1[_0x9fb6('0x4e')],null))[_0x9fb6('0x28')](respondWithResult(_0x279f9f,null))['catch'](handleError(_0x279f9f,null));};exports[_0x9fb6('0x29')]=function(_0x2e4dc0,_0x695ac1){return db[_0x9fb6('0x32')][_0x9fb6('0x4c')]({'where':{'id':_0x2e4dc0[_0x9fb6('0x57')]['id']}})['then'](handleEntityNotFound(_0x695ac1,null))[_0x9fb6('0x28')](removeEntity(_0x695ac1,null))[_0x9fb6('0x49')](handleError(_0x695ac1,null));};exports[_0x9fb6('0x58')]=function(_0x3f682c,_0x4f5b09,_0x59f58c){if(_0x3f682c[_0x9fb6('0x4e')]['id']){delete _0x3f682c[_0x9fb6('0x4e')]['id'];}return db[_0x9fb6('0x32')]['find']({'where':{'id':_0x3f682c[_0x9fb6('0x57')]['id']}})[_0x9fb6('0x28')](handleEntityNotFound(_0x4f5b09,null))[_0x9fb6('0x28')](function(_0x737963){if(_0x737963){_0x3f682c[_0x9fb6('0x4e')][_0x9fb6('0x59')]=_0x737963['id'];return db['Interval'][_0x9fb6('0x4d')](_0x3f682c['body']);}})[_0x9fb6('0x28')](respondWithResult(_0x4f5b09,null))[_0x9fb6('0x49')](handleError(_0x4f5b09,null));};exports[_0x9fb6('0x5a')]=function(_0x46c473,_0x315cd0,_0xd26d16){var _0x407a61={};var _0x14e34d={};var _0x374080;var _0x2d9dd5;return db['Interval'][_0x9fb6('0x5b')]({'where':{'id':_0x46c473['params']['id']}})[_0x9fb6('0x28')](handleEntityNotFound(_0x315cd0,null))[_0x9fb6('0x28')](function(_0x231995){if(_0x231995){_0x374080=_0x231995;_0x14e34d[_0x9fb6('0x35')]=_[_0x9fb6('0x37')](db[_0x9fb6('0x32')][_0x9fb6('0x4b')]);_0x14e34d['query']=_['keys'](_0x46c473['query']);_0x14e34d[_0x9fb6('0x38')]=_[_0x9fb6('0x39')](_0x14e34d[_0x9fb6('0x35')],_0x14e34d[_0x9fb6('0x36')]);_0x407a61['attributes']=_[_0x9fb6('0x39')](_0x14e34d[_0x9fb6('0x35')],qs['fields'](_0x46c473[_0x9fb6('0x36')]['fields']));_0x407a61[_0x9fb6('0x3b')]=_0x407a61[_0x9fb6('0x3b')]['length']?_0x407a61['attributes']:_0x14e34d['model'];_0x407a61[_0x9fb6('0x3e')]=qs[_0x9fb6('0x3f')](_0x46c473[_0x9fb6('0x36')][_0x9fb6('0x3f')]);_0x407a61['where']=qs['filters'](_[_0x9fb6('0x40')](_0x46c473[_0x9fb6('0x36')],_0x14e34d[_0x9fb6('0x38')]));if(_0x46c473[_0x9fb6('0x36')][_0x9fb6('0x44')]){_0x407a61[_0x9fb6('0x41')]=_['merge'](_0x407a61[_0x9fb6('0x41')],{'$or':_['map'](_0x407a61[_0x9fb6('0x3b')],function(_0x55edd0){var _0x30abc7={};_0x30abc7[_0x55edd0]={'$like':'%'+_0x46c473[_0x9fb6('0x36')]['filter']+'%'};return _0x30abc7;})});}_0x407a61=_['merge']({},_0x407a61,_0x46c473['options']);return _0x374080[_0x9fb6('0x5a')](_0x407a61);}})['then'](function(_0x55dfa0){if(_0x55dfa0){_0x2d9dd5=_0x55dfa0[_0x9fb6('0x3c')];if(!_0x46c473[_0x9fb6('0x36')][_0x9fb6('0x5c')](_0x9fb6('0x3d'))){_0x407a61['limit']=qs['limit'](_0x46c473[_0x9fb6('0x36')]['limit']);_0x407a61[_0x9fb6('0x1f')]=qs[_0x9fb6('0x1f')](_0x46c473[_0x9fb6('0x36')][_0x9fb6('0x1f')]);}return _0x374080[_0x9fb6('0x5a')](_0x407a61);}})[_0x9fb6('0x28')](function(_0x235f17){if(_0x235f17){return _0x235f17?{'count':_0x2d9dd5,'rows':_0x235f17}:null;}})[_0x9fb6('0x28')](respondWithResult(_0x315cd0,null))[_0x9fb6('0x49')](handleError(_0x315cd0,null));};exports[_0x9fb6('0x5d')]=function(_0x20e2ed,_0x2ba33f,_0x2c2bf2){return db[_0x9fb6('0x32')][_0x9fb6('0x5b')]({'where':{'id':_0x20e2ed[_0x9fb6('0x57')]['id']}})[_0x9fb6('0x28')](handleEntityNotFound(_0x2ba33f,null))['then'](function(_0x47c510){if(_0x47c510){return db[_0x9fb6('0x5e')][_0x9fb6('0x5f')](function(_0x77f57d){return db[_0x9fb6('0x32')][_0x9fb6('0x29')]({'where':{'IntervalId':_0x20e2ed[_0x9fb6('0x57')]['id']},'transaction':_0x77f57d})[_0x9fb6('0x28')](function(_0x1443df){var _0x798348=_[_0x9fb6('0x31')](_0x20e2ed[_0x9fb6('0x4e')],function(_0x2130e5){delete _0x2130e5['id'];_0x2130e5[_0x9fb6('0x59')]=_0x20e2ed['params']['id'];return _0x2130e5;});return db[_0x9fb6('0x32')][_0x9fb6('0x60')](_0x798348,{'transaction':_0x77f57d});});})[_0x9fb6('0x28')](function(){return db[_0x9fb6('0x32')][_0x9fb6('0x61')]({'where':{'IntervalId':_0x20e2ed[_0x9fb6('0x57')]['id']}});});}})[_0x9fb6('0x28')](respondWithResult(_0x2ba33f,null))[_0x9fb6('0x49')](handleError(_0x2ba33f,null));};
\ No newline at end of file