Built motion from commit (unavailable).|2.3.3
[motion2.git] / server / api / interval / interval.controller.js
index 89d743e..ff0a3ba 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2462=['status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','stack','name','send','index','Interval','rawAttributes','keys','query','filters','model','attributes','intersection','fields','length','order','sort','pick','filter','where','merge','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Intervals','UserProfileSection','autoAssociation','error','params','destroy','addInterval','IntervalId','getIntervals','findOne','map','nolimit','sequelize','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','../../components/extensions/rewrite','sendStatus'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x2462,0x196));var _0x2246=function(_0x1b3797,_0x500d3d){_0x1b3797=_0x1b3797-0x0;var _0x484a75=_0x2462[_0x1b3797];return _0x484a75;};'use strict';var pdf=require(_0x2246('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2246('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2246('0x2'));var rp=require(_0x2246('0x3'));var moment=require(_0x2246('0x4'));var BPromise=require(_0x2246('0x5'));var Mustache=require(_0x2246('0x6'));var util=require('util');var path=require(_0x2246('0x7'));var sox=require(_0x2246('0x8'));var csv=require(_0x2246('0x9'));var ejs=require(_0x2246('0xa'));var fs=require('fs');var _=require(_0x2246('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2246('0xc'));var toCsv=require(_0x2246('0x9'));var querystring=require(_0x2246('0xd'));var Papa=require('papaparse');var authService=require(_0x2246('0xe'));var hardwareService=require(_0x2246('0xf'));var Redis=require(_0x2246('0x10'));var qs=require(_0x2246('0x11'));var logger=require(_0x2246('0x12'))(_0x2246('0x13'));var utils=require(_0x2246('0x14'));var config=require('../../config/environment');var db=require(_0x2246('0x15'))['db'];var extensions=require(_0x2246('0x16'));function respondWithStatusCode(_0x40b41f,_0x404c5b){_0x404c5b=_0x404c5b||0xcc;return function(_0x56cfc3){if(_0x56cfc3){return _0x40b41f[_0x2246('0x17')](_0x404c5b);}return _0x40b41f[_0x2246('0x18')](_0x404c5b)[_0x2246('0x19')]();};}function respondWithResult(_0x39b06e,_0x4b0d36){_0x4b0d36=_0x4b0d36||0xc8;return function(_0x3b2d95){if(_0x3b2d95){return _0x39b06e[_0x2246('0x18')](_0x4b0d36)[_0x2246('0x1a')](_0x3b2d95);}};}function respondWithFilteredResult(_0x3011b3,_0x45d78e){return function(_0x311143){if(_0x311143){var _0x31f4b4=_0x311143[_0x2246('0x1b')],_0x55a4f9=_0x45d78e[_0x2246('0x1c')],_0x2b8cfc=_0x45d78e[_0x2246('0x1c')]+_0x45d78e[_0x2246('0x1d')],_0xb46b93;if(_0x2b8cfc>=_0x31f4b4){_0x2b8cfc=_0x31f4b4;_0xb46b93=0xc8;}else{_0xb46b93=0xce;}_0x3011b3['status'](_0xb46b93);return _0x3011b3[_0x2246('0x1e')](_0x2246('0x1f'),_0x55a4f9+'-'+_0x2b8cfc+'/'+_0x31f4b4)[_0x2246('0x1a')](_0x311143);}return null;};}function patchUpdates(_0x12f189){return function(_0x10bcd1){try{jsonpatch[_0x2246('0x20')](_0x10bcd1,_0x12f189,!![]);}catch(_0x20d5f3){return BPromise[_0x2246('0x21')](_0x20d5f3);}return _0x10bcd1[_0x2246('0x22')]();};}function saveUpdates(_0x49a181,_0x40f5cd){return function(_0x51d785){if(_0x51d785){return _0x51d785[_0x2246('0x23')](_0x49a181)[_0x2246('0x24')](function(_0x2fe237){return _0x2fe237;});}return null;};}function removeEntity(_0x4196c9,_0x1645ae){return function(_0x3890ef){if(_0x3890ef){return _0x3890ef['destroy']()[_0x2246('0x24')](function(){var _0x3d0e2c=_0x3890ef[_0x2246('0x25')]({'plain':!![]});var _0x236ec4='Intervals';return db[_0x2246('0x26')]['destroy']({'where':{'type':_0x236ec4,'resourceId':_0x3d0e2c['id']}})['then'](function(){return _0x3890ef;});})[_0x2246('0x24')](function(){_0x4196c9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c0c7e,_0xc1b3af){return function(_0xd0a36c){if(!_0xd0a36c){_0x1c0c7e['sendStatus'](0x194);}return _0xd0a36c;};}function handleError(_0x5882e5,_0x2b7bab){_0x2b7bab=_0x2b7bab||0x1f4;return function(_0x113055){logger['error'](_0x113055[_0x2246('0x27')]);if(_0x113055[_0x2246('0x28')]){delete _0x113055[_0x2246('0x28')];}_0x5882e5[_0x2246('0x18')](_0x2b7bab)[_0x2246('0x29')](_0x113055);};}exports[_0x2246('0x2a')]=function(_0x129470,_0x27a6a2){var _0x18058b={},_0x313562={},_0x3bc2f6={'count':0x0,'rows':[]};var _0x1b48bd=db[_0x2246('0x2b')][_0x2246('0x2c')];_0x313562['model']=_[_0x2246('0x2d')](_0x1b48bd);_0x313562['query']=_[_0x2246('0x2d')](_0x129470[_0x2246('0x2e')]);_0x313562[_0x2246('0x2f')]=_['intersection'](_0x313562[_0x2246('0x30')],_0x313562[_0x2246('0x2e')]);_0x18058b[_0x2246('0x31')]=_[_0x2246('0x32')](_0x313562[_0x2246('0x30')],qs[_0x2246('0x33')](_0x129470[_0x2246('0x2e')][_0x2246('0x33')]));_0x18058b[_0x2246('0x31')]=_0x18058b[_0x2246('0x31')][_0x2246('0x34')]?_0x18058b[_0x2246('0x31')]:_0x313562[_0x2246('0x30')];if(!_0x129470[_0x2246('0x2e')]['hasOwnProperty']('nolimit')){_0x18058b['limit']=qs[_0x2246('0x1d')](_0x129470[_0x2246('0x2e')][_0x2246('0x1d')]);_0x18058b[_0x2246('0x1c')]=qs['offset'](_0x129470[_0x2246('0x2e')]['offset']);}_0x18058b[_0x2246('0x35')]=qs[_0x2246('0x36')](_0x129470['query'][_0x2246('0x36')]);_0x18058b['where']=qs[_0x2246('0x2f')](_[_0x2246('0x37')](_0x129470[_0x2246('0x2e')],_0x313562[_0x2246('0x2f')]));if(_0x129470['query'][_0x2246('0x38')]){_0x18058b[_0x2246('0x39')]=_[_0x2246('0x3a')](_0x18058b[_0x2246('0x39')],{'$or':_['map'](_0x1b48bd,function(_0x592de1){if(_0x592de1[_0x2246('0x3b')][_0x2246('0x3c')]!==_0x2246('0x3d')){var _0xd59bc={};_0xd59bc[_0x592de1[_0x2246('0x3e')]]={'$like':'%'+_0x129470[_0x2246('0x2e')][_0x2246('0x38')]+'%'};return _0xd59bc;}})});}_0x18058b=_[_0x2246('0x3a')]({},_0x18058b,_0x129470[_0x2246('0x3f')]);var _0x2d9fa3={'where':_0x18058b[_0x2246('0x39')]};return db[_0x2246('0x2b')][_0x2246('0x1b')](_0x2d9fa3)[_0x2246('0x24')](function(_0x1656ee){_0x3bc2f6['count']=_0x1656ee;if(_0x129470[_0x2246('0x2e')][_0x2246('0x40')]){_0x18058b[_0x2246('0x41')]=[{'all':!![]}];}return db[_0x2246('0x2b')][_0x2246('0x42')](_0x18058b);})[_0x2246('0x24')](function(_0x54396f){_0x3bc2f6[_0x2246('0x43')]=_0x54396f;return _0x3bc2f6;})['then'](respondWithFilteredResult(_0x27a6a2,_0x18058b))[_0x2246('0x44')](handleError(_0x27a6a2,null));};exports['show']=function(_0x4497e5,_0x126504){var _0x1b0ed6={'raw':!![],'where':{'id':_0x4497e5['params']['id']}},_0x24eafe={};_0x24eafe[_0x2246('0x30')]=_['keys'](db[_0x2246('0x2b')][_0x2246('0x2c')]);_0x24eafe[_0x2246('0x2e')]=_[_0x2246('0x2d')](_0x4497e5['query']);_0x24eafe['filters']=_[_0x2246('0x32')](_0x24eafe[_0x2246('0x30')],_0x24eafe['query']);_0x1b0ed6[_0x2246('0x31')]=_[_0x2246('0x32')](_0x24eafe[_0x2246('0x30')],qs[_0x2246('0x33')](_0x4497e5[_0x2246('0x2e')]['fields']));_0x1b0ed6[_0x2246('0x31')]=_0x1b0ed6[_0x2246('0x31')][_0x2246('0x34')]?_0x1b0ed6[_0x2246('0x31')]:_0x24eafe[_0x2246('0x30')];if(_0x4497e5[_0x2246('0x2e')][_0x2246('0x40')]){_0x1b0ed6[_0x2246('0x41')]=[{'all':!![]}];}_0x1b0ed6=_['merge']({},_0x1b0ed6,_0x4497e5['options']);return db[_0x2246('0x2b')][_0x2246('0x45')](_0x1b0ed6)[_0x2246('0x24')](handleEntityNotFound(_0x126504,null))[_0x2246('0x24')](respondWithResult(_0x126504,null))['catch'](handleError(_0x126504,null));};exports[_0x2246('0x46')]=function(_0xef2115,_0x370d0b){return db[_0x2246('0x2b')][_0x2246('0x46')](_0xef2115[_0x2246('0x47')],{})[_0x2246('0x24')](function(_0x3d30ed){var _0x5ee6de=_0xef2115['user'][_0x2246('0x25')]({'plain':!![]});if(!_0x5ee6de)throw new Error(_0x2246('0x48'));if(_0x5ee6de['role']==='user'){var _0x2a2644=_0x3d30ed[_0x2246('0x25')]({'plain':!![]});var _0x5d5fd3=_0x2246('0x49');return db[_0x2246('0x4a')][_0x2246('0x45')]({'where':{'name':_0x5d5fd3,'userProfileId':_0x5ee6de['userProfileId']},'raw':!![]})[_0x2246('0x24')](function(_0xc7b9b1){if(_0xc7b9b1&&_0xc7b9b1[_0x2246('0x4b')]===0x0){return db[_0x2246('0x26')]['create']({'name':_0x2a2644['name'],'resourceId':_0x2a2644['id'],'type':_0xc7b9b1[_0x2246('0x28')],'sectionId':_0xc7b9b1['id']},{})['then'](function(){return _0x3d30ed;});}else{return _0x3d30ed;}})[_0x2246('0x44')](function(_0x3fa796){logger[_0x2246('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fa796);throw _0x3fa796;});}return _0x3d30ed;})[_0x2246('0x24')](respondWithResult(_0x370d0b,0xc9))[_0x2246('0x44')](handleError(_0x370d0b,null));};exports[_0x2246('0x23')]=function(_0x1d6fb2,_0x1cedee){if(_0x1d6fb2[_0x2246('0x47')]['id']){delete _0x1d6fb2[_0x2246('0x47')]['id'];}return db['Interval']['find']({'where':{'id':_0x1d6fb2[_0x2246('0x4d')]['id']}})[_0x2246('0x24')](handleEntityNotFound(_0x1cedee,null))[_0x2246('0x24')](saveUpdates(_0x1d6fb2['body'],null))[_0x2246('0x24')](respondWithResult(_0x1cedee,null))['catch'](handleError(_0x1cedee,null));};exports[_0x2246('0x4e')]=function(_0x1b3ff7,_0xd275a3){return db[_0x2246('0x2b')][_0x2246('0x45')]({'where':{'id':_0x1b3ff7['params']['id']}})[_0x2246('0x24')](handleEntityNotFound(_0xd275a3,null))[_0x2246('0x24')](removeEntity(_0xd275a3,null))[_0x2246('0x44')](handleError(_0xd275a3,null));};exports[_0x2246('0x4f')]=function(_0xe495b2,_0x32e1bc,_0x107001){if(_0xe495b2['body']['id']){delete _0xe495b2[_0x2246('0x47')]['id'];}return db[_0x2246('0x2b')][_0x2246('0x45')]({'where':{'id':_0xe495b2[_0x2246('0x4d')]['id']}})[_0x2246('0x24')](handleEntityNotFound(_0x32e1bc,null))[_0x2246('0x24')](function(_0x1dda0f){if(_0x1dda0f){_0xe495b2[_0x2246('0x47')][_0x2246('0x50')]=_0x1dda0f['id'];return db[_0x2246('0x2b')]['create'](_0xe495b2[_0x2246('0x47')]);}})['then'](respondWithResult(_0x32e1bc,null))[_0x2246('0x44')](handleError(_0x32e1bc,null));};exports[_0x2246('0x51')]=function(_0xa8be67,_0x478f09,_0x682d36){var _0x29cc6b={};var _0x44cf39={};var _0x1317dd;var _0x3d2492;return db[_0x2246('0x2b')][_0x2246('0x52')]({'where':{'id':_0xa8be67[_0x2246('0x4d')]['id']}})[_0x2246('0x24')](handleEntityNotFound(_0x478f09,null))[_0x2246('0x24')](function(_0x5de7db){if(_0x5de7db){_0x1317dd=_0x5de7db;_0x44cf39[_0x2246('0x30')]=_[_0x2246('0x2d')](db[_0x2246('0x2b')][_0x2246('0x2c')]);_0x44cf39[_0x2246('0x2e')]=_[_0x2246('0x2d')](_0xa8be67[_0x2246('0x2e')]);_0x44cf39[_0x2246('0x2f')]=_[_0x2246('0x32')](_0x44cf39[_0x2246('0x30')],_0x44cf39['query']);_0x29cc6b[_0x2246('0x31')]=_[_0x2246('0x32')](_0x44cf39[_0x2246('0x30')],qs[_0x2246('0x33')](_0xa8be67[_0x2246('0x2e')][_0x2246('0x33')]));_0x29cc6b[_0x2246('0x31')]=_0x29cc6b[_0x2246('0x31')][_0x2246('0x34')]?_0x29cc6b[_0x2246('0x31')]:_0x44cf39[_0x2246('0x30')];_0x29cc6b[_0x2246('0x35')]=qs[_0x2246('0x36')](_0xa8be67[_0x2246('0x2e')][_0x2246('0x36')]);_0x29cc6b[_0x2246('0x39')]=qs['filters'](_[_0x2246('0x37')](_0xa8be67[_0x2246('0x2e')],_0x44cf39[_0x2246('0x2f')]));if(_0xa8be67[_0x2246('0x2e')][_0x2246('0x38')]){_0x29cc6b[_0x2246('0x39')]=_[_0x2246('0x3a')](_0x29cc6b[_0x2246('0x39')],{'$or':_[_0x2246('0x53')](_0x29cc6b[_0x2246('0x31')],function(_0x46c08e){var _0x4f020a={};_0x4f020a[_0x46c08e]={'$like':'%'+_0xa8be67[_0x2246('0x2e')][_0x2246('0x38')]+'%'};return _0x4f020a;})});}_0x29cc6b=_[_0x2246('0x3a')]({},_0x29cc6b,_0xa8be67[_0x2246('0x3f')]);return _0x1317dd[_0x2246('0x51')](_0x29cc6b);}})[_0x2246('0x24')](function(_0x7efc3b){if(_0x7efc3b){_0x3d2492=_0x7efc3b[_0x2246('0x34')];if(!_0xa8be67[_0x2246('0x2e')]['hasOwnProperty'](_0x2246('0x54'))){_0x29cc6b['limit']=qs['limit'](_0xa8be67[_0x2246('0x2e')][_0x2246('0x1d')]);_0x29cc6b[_0x2246('0x1c')]=qs[_0x2246('0x1c')](_0xa8be67['query'][_0x2246('0x1c')]);}return _0x1317dd[_0x2246('0x51')](_0x29cc6b);}})[_0x2246('0x24')](function(_0x54da5e){if(_0x54da5e){return _0x54da5e?{'count':_0x3d2492,'rows':_0x54da5e}:null;}})[_0x2246('0x24')](respondWithResult(_0x478f09,null))[_0x2246('0x44')](handleError(_0x478f09,null));};exports['addIntervals']=function(_0x227286,_0x1c0952,_0xbe9063){return db[_0x2246('0x2b')]['findOne']({'where':{'id':_0x227286[_0x2246('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1c0952,null))['then'](function(_0x595f3b){if(_0x595f3b){return db[_0x2246('0x55')]['transaction'](function(_0x3fd9be){return db['Interval']['destroy']({'where':{'IntervalId':_0x227286[_0x2246('0x4d')]['id']},'transaction':_0x3fd9be})[_0x2246('0x24')](function(_0x2e7e60){var _0x43ff23=_[_0x2246('0x53')](_0x227286['body'],function(_0x1a5dcd){delete _0x1a5dcd['id'];_0x1a5dcd[_0x2246('0x50')]=_0x227286['params']['id'];return _0x1a5dcd;});return db['Interval']['bulkCreate'](_0x43ff23,{'transaction':_0x3fd9be});});})[_0x2246('0x24')](function(){return db['Interval'][_0x2246('0x42')]({'where':{'IntervalId':_0x227286['params']['id']}});});}})[_0x2246('0x24')](respondWithResult(_0x1c0952,null))[_0x2246('0x44')](handleError(_0x1c0952,null));};
\ No newline at end of file
+var _0xf271=['ioredis','../../config/logger','api','../../config/utils','../../components/extensions/rewrite','end','status','json','count','offset','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','sendStatus','error','name','index','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','merge','map','type','key','field','filter','Interval','rows','show','params','rawAttributes','includeAll','include','options','find','create','body','user','role','Intervals','UserProfileSection','userProfileId','autoAssociation','catch','addInterval','findOne','length','getIntervals','nolimit','addIntervals','transaction','IntervalId','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../config/license/hardware'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0xf271,0x9c));var _0x1f27=function(_0x350132,_0x31283d){_0x350132=_0x350132-0x0;var _0xf3e713=_0xf271[_0x350132];return _0xf3e713;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1f27('0x0'));var rimraf=require(_0x1f27('0x1'));var zipdir=require(_0x1f27('0x2'));var jsonpatch=require(_0x1f27('0x3'));var rp=require(_0x1f27('0x4'));var moment=require(_0x1f27('0x5'));var BPromise=require(_0x1f27('0x6'));var Mustache=require(_0x1f27('0x7'));var util=require(_0x1f27('0x8'));var path=require(_0x1f27('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1f27('0xa'));var fs=require('fs');var _=require(_0x1f27('0xb'));var squel=require(_0x1f27('0xc'));var crypto=require(_0x1f27('0xd'));var jsforce=require(_0x1f27('0xe'));var deskjs=require(_0x1f27('0xf'));var toCsv=require(_0x1f27('0x10'));var querystring=require('querystring');var Papa=require(_0x1f27('0x11'));var authService=require(_0x1f27('0x12'));var hardwareService=require(_0x1f27('0x13'));var Redis=require(_0x1f27('0x14'));var qs=require('../../components/parsers/qs');var logger=require(_0x1f27('0x15'))(_0x1f27('0x16'));var utils=require(_0x1f27('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var extensions=require(_0x1f27('0x18'));function respondWithStatusCode(_0x41808e,_0x1f7ae4){_0x1f7ae4=_0x1f7ae4||0xcc;return function(_0x9714a9){if(_0x9714a9){return _0x41808e['sendStatus'](_0x1f7ae4);}return _0x41808e['status'](_0x1f7ae4)[_0x1f27('0x19')]();};}function respondWithResult(_0x58b543,_0x53291f){_0x53291f=_0x53291f||0xc8;return function(_0x232239){if(_0x232239){return _0x58b543[_0x1f27('0x1a')](_0x53291f)[_0x1f27('0x1b')](_0x232239);}};}function respondWithFilteredResult(_0x207b12,_0x3b6bb7){return function(_0x583eb4){if(_0x583eb4){var _0xc5ebf9=_0x583eb4[_0x1f27('0x1c')],_0x134af6=_0x3b6bb7[_0x1f27('0x1d')],_0x1809a0=_0x3b6bb7[_0x1f27('0x1d')]+_0x3b6bb7['limit'],_0x38b95c;if(_0x1809a0>=_0xc5ebf9){_0x1809a0=_0xc5ebf9;_0x38b95c=0xc8;}else{_0x38b95c=0xce;}_0x207b12[_0x1f27('0x1a')](_0x38b95c);return _0x207b12['set'](_0x1f27('0x1e'),_0x134af6+'-'+_0x1809a0+'/'+_0xc5ebf9)[_0x1f27('0x1b')](_0x583eb4);}return null;};}function patchUpdates(_0x375ff7){return function(_0x565e06){try{jsonpatch[_0x1f27('0x1f')](_0x565e06,_0x375ff7,!![]);}catch(_0x284ad9){return BPromise[_0x1f27('0x20')](_0x284ad9);}return _0x565e06[_0x1f27('0x21')]();};}function saveUpdates(_0x403824,_0x294c12){return function(_0x53f282){if(_0x53f282){return _0x53f282['update'](_0x403824)[_0x1f27('0x22')](function(_0x46aedf){return _0x46aedf;});}return null;};}function removeEntity(_0x2c4371,_0x137edb){return function(_0x386a9b){if(_0x386a9b){return _0x386a9b[_0x1f27('0x23')]()[_0x1f27('0x22')](function(){var _0x54f781=_0x386a9b[_0x1f27('0x24')]({'plain':!![]});var _0x1bc80d='Intervals';return db[_0x1f27('0x25')][_0x1f27('0x23')]({'where':{'type':_0x1bc80d,'resourceId':_0x54f781['id']}})[_0x1f27('0x22')](function(){return _0x386a9b;});})[_0x1f27('0x22')](function(){_0x2c4371[_0x1f27('0x1a')](0xcc)[_0x1f27('0x19')]();});}};}function handleEntityNotFound(_0x729fb2,_0x320e5d){return function(_0x184696){if(!_0x184696){_0x729fb2[_0x1f27('0x26')](0x194);}return _0x184696;};}function handleError(_0x47d7c5,_0xf49d63){_0xf49d63=_0xf49d63||0x1f4;return function(_0x5ede80){logger[_0x1f27('0x27')](_0x5ede80['stack']);if(_0x5ede80[_0x1f27('0x28')]){delete _0x5ede80['name'];}_0x47d7c5['status'](_0xf49d63)['send'](_0x5ede80);};}exports[_0x1f27('0x29')]=function(_0x9430ef,_0xefa154){var _0x5a4f38={},_0x1fb8aa={},_0x30e92a={'count':0x0,'rows':[]};var _0x1f8b48=db['Interval']['rawAttributes'];_0x1fb8aa[_0x1f27('0x2a')]=_[_0x1f27('0x2b')](_0x1f8b48);_0x1fb8aa[_0x1f27('0x2c')]=_[_0x1f27('0x2b')](_0x9430ef['query']);_0x1fb8aa[_0x1f27('0x2d')]=_['intersection'](_0x1fb8aa[_0x1f27('0x2a')],_0x1fb8aa[_0x1f27('0x2c')]);_0x5a4f38[_0x1f27('0x2e')]=_[_0x1f27('0x2f')](_0x1fb8aa[_0x1f27('0x2a')],qs['fields'](_0x9430ef[_0x1f27('0x2c')][_0x1f27('0x30')]));_0x5a4f38[_0x1f27('0x2e')]=_0x5a4f38[_0x1f27('0x2e')]['length']?_0x5a4f38[_0x1f27('0x2e')]:_0x1fb8aa[_0x1f27('0x2a')];if(!_0x9430ef['query'][_0x1f27('0x31')]('nolimit')){_0x5a4f38[_0x1f27('0x32')]=qs['limit'](_0x9430ef['query'][_0x1f27('0x32')]);_0x5a4f38[_0x1f27('0x1d')]=qs[_0x1f27('0x1d')](_0x9430ef['query'][_0x1f27('0x1d')]);}_0x5a4f38[_0x1f27('0x33')]=qs[_0x1f27('0x34')](_0x9430ef['query'][_0x1f27('0x34')]);_0x5a4f38[_0x1f27('0x35')]=qs[_0x1f27('0x2d')](_['pick'](_0x9430ef[_0x1f27('0x2c')],_0x1fb8aa[_0x1f27('0x2d')]));if(_0x9430ef[_0x1f27('0x2c')]['filter']){_0x5a4f38[_0x1f27('0x35')]=_[_0x1f27('0x36')](_0x5a4f38[_0x1f27('0x35')],{'$or':_[_0x1f27('0x37')](_0x1f8b48,function(_0x29df2f){if(_0x29df2f[_0x1f27('0x38')][_0x1f27('0x39')]!=='VIRTUAL'){var _0x24e02c={};_0x24e02c[_0x29df2f[_0x1f27('0x3a')]]={'$like':'%'+_0x9430ef[_0x1f27('0x2c')][_0x1f27('0x3b')]+'%'};return _0x24e02c;}})});}_0x5a4f38=_['merge']({},_0x5a4f38,_0x9430ef['options']);var _0x3b8eaf={'where':_0x5a4f38[_0x1f27('0x35')]};return db[_0x1f27('0x3c')][_0x1f27('0x1c')](_0x3b8eaf)[_0x1f27('0x22')](function(_0x598236){_0x30e92a[_0x1f27('0x1c')]=_0x598236;if(_0x9430ef[_0x1f27('0x2c')]['includeAll']){_0x5a4f38['include']=[{'all':!![]}];}return db['Interval']['findAll'](_0x5a4f38);})[_0x1f27('0x22')](function(_0x4266d1){_0x30e92a[_0x1f27('0x3d')]=_0x4266d1;return _0x30e92a;})['then'](respondWithFilteredResult(_0xefa154,_0x5a4f38))['catch'](handleError(_0xefa154,null));};exports[_0x1f27('0x3e')]=function(_0x2c1dda,_0x11e5db){var _0x34802b={'raw':!![],'where':{'id':_0x2c1dda[_0x1f27('0x3f')]['id']}},_0x4f64c8={};_0x4f64c8[_0x1f27('0x2a')]=_[_0x1f27('0x2b')](db[_0x1f27('0x3c')][_0x1f27('0x40')]);_0x4f64c8[_0x1f27('0x2c')]=_[_0x1f27('0x2b')](_0x2c1dda[_0x1f27('0x2c')]);_0x4f64c8[_0x1f27('0x2d')]=_['intersection'](_0x4f64c8[_0x1f27('0x2a')],_0x4f64c8[_0x1f27('0x2c')]);_0x34802b[_0x1f27('0x2e')]=_[_0x1f27('0x2f')](_0x4f64c8['model'],qs['fields'](_0x2c1dda[_0x1f27('0x2c')][_0x1f27('0x30')]));_0x34802b[_0x1f27('0x2e')]=_0x34802b['attributes']['length']?_0x34802b[_0x1f27('0x2e')]:_0x4f64c8[_0x1f27('0x2a')];if(_0x2c1dda['query'][_0x1f27('0x41')]){_0x34802b[_0x1f27('0x42')]=[{'all':!![]}];}_0x34802b=_[_0x1f27('0x36')]({},_0x34802b,_0x2c1dda[_0x1f27('0x43')]);return db[_0x1f27('0x3c')][_0x1f27('0x44')](_0x34802b)[_0x1f27('0x22')](handleEntityNotFound(_0x11e5db,null))[_0x1f27('0x22')](respondWithResult(_0x11e5db,null))['catch'](handleError(_0x11e5db,null));};exports[_0x1f27('0x45')]=function(_0x2e138d,_0x4f00da){return db['Interval'][_0x1f27('0x45')](_0x2e138d[_0x1f27('0x46')],{})[_0x1f27('0x22')](function(_0x3bc497){var _0xd47bcb=_0x2e138d[_0x1f27('0x47')][_0x1f27('0x24')]({'plain':!![]});if(!_0xd47bcb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd47bcb[_0x1f27('0x48')]===_0x1f27('0x47')){var _0x1db7fc=_0x3bc497[_0x1f27('0x24')]({'plain':!![]});var _0x2fbb32=_0x1f27('0x49');return db[_0x1f27('0x4a')][_0x1f27('0x44')]({'where':{'name':_0x2fbb32,'userProfileId':_0xd47bcb[_0x1f27('0x4b')]},'raw':!![]})[_0x1f27('0x22')](function(_0x35eb33){if(_0x35eb33&&_0x35eb33[_0x1f27('0x4c')]===0x0){return db[_0x1f27('0x25')][_0x1f27('0x45')]({'name':_0x1db7fc[_0x1f27('0x28')],'resourceId':_0x1db7fc['id'],'type':_0x35eb33[_0x1f27('0x28')],'sectionId':_0x35eb33['id']},{})[_0x1f27('0x22')](function(){return _0x3bc497;});}else{return _0x3bc497;}})['catch'](function(_0x2cccf3){logger[_0x1f27('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cccf3);throw _0x2cccf3;});}return _0x3bc497;})['then'](respondWithResult(_0x4f00da,0xc9))[_0x1f27('0x4d')](handleError(_0x4f00da,null));};exports['update']=function(_0x422796,_0x1f15c7){if(_0x422796[_0x1f27('0x46')]['id']){delete _0x422796[_0x1f27('0x46')]['id'];}return db[_0x1f27('0x3c')][_0x1f27('0x44')]({'where':{'id':_0x422796['params']['id']}})[_0x1f27('0x22')](handleEntityNotFound(_0x1f15c7,null))[_0x1f27('0x22')](saveUpdates(_0x422796['body'],null))['then'](respondWithResult(_0x1f15c7,null))['catch'](handleError(_0x1f15c7,null));};exports[_0x1f27('0x23')]=function(_0x33c2f2,_0x44d0e2){return db[_0x1f27('0x3c')][_0x1f27('0x44')]({'where':{'id':_0x33c2f2[_0x1f27('0x3f')]['id']}})[_0x1f27('0x22')](handleEntityNotFound(_0x44d0e2,null))['then'](removeEntity(_0x44d0e2,null))[_0x1f27('0x4d')](handleError(_0x44d0e2,null));};exports[_0x1f27('0x4e')]=function(_0x362089,_0x10063f,_0x44999e){if(_0x362089[_0x1f27('0x46')]['id']){delete _0x362089['body']['id'];}return db['Interval'][_0x1f27('0x44')]({'where':{'id':_0x362089[_0x1f27('0x3f')]['id']}})['then'](handleEntityNotFound(_0x10063f,null))['then'](function(_0x541e32){if(_0x541e32){_0x362089['body']['IntervalId']=_0x541e32['id'];return db[_0x1f27('0x3c')][_0x1f27('0x45')](_0x362089[_0x1f27('0x46')]);}})[_0x1f27('0x22')](respondWithResult(_0x10063f,null))['catch'](handleError(_0x10063f,null));};exports['getIntervals']=function(_0x29c143,_0x1e565a,_0x3dfbac){var _0x245c13={};var _0x56dc22={};var _0x5b07eb;var _0x5da99b;return db[_0x1f27('0x3c')][_0x1f27('0x4f')]({'where':{'id':_0x29c143[_0x1f27('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1e565a,null))[_0x1f27('0x22')](function(_0x41fef6){if(_0x41fef6){_0x5b07eb=_0x41fef6;_0x56dc22[_0x1f27('0x2a')]=_['keys'](db['Interval'][_0x1f27('0x40')]);_0x56dc22[_0x1f27('0x2c')]=_[_0x1f27('0x2b')](_0x29c143[_0x1f27('0x2c')]);_0x56dc22[_0x1f27('0x2d')]=_[_0x1f27('0x2f')](_0x56dc22[_0x1f27('0x2a')],_0x56dc22[_0x1f27('0x2c')]);_0x245c13['attributes']=_[_0x1f27('0x2f')](_0x56dc22['model'],qs['fields'](_0x29c143[_0x1f27('0x2c')][_0x1f27('0x30')]));_0x245c13[_0x1f27('0x2e')]=_0x245c13['attributes'][_0x1f27('0x50')]?_0x245c13['attributes']:_0x56dc22[_0x1f27('0x2a')];_0x245c13['order']=qs['sort'](_0x29c143['query'][_0x1f27('0x34')]);_0x245c13[_0x1f27('0x35')]=qs[_0x1f27('0x2d')](_['pick'](_0x29c143[_0x1f27('0x2c')],_0x56dc22['filters']));if(_0x29c143[_0x1f27('0x2c')][_0x1f27('0x3b')]){_0x245c13[_0x1f27('0x35')]=_[_0x1f27('0x36')](_0x245c13[_0x1f27('0x35')],{'$or':_[_0x1f27('0x37')](_0x245c13[_0x1f27('0x2e')],function(_0x5f3f94){var _0x1b5327={};_0x1b5327[_0x5f3f94]={'$like':'%'+_0x29c143['query'][_0x1f27('0x3b')]+'%'};return _0x1b5327;})});}_0x245c13=_[_0x1f27('0x36')]({},_0x245c13,_0x29c143[_0x1f27('0x43')]);return _0x5b07eb[_0x1f27('0x51')](_0x245c13);}})['then'](function(_0x163c8b){if(_0x163c8b){_0x5da99b=_0x163c8b[_0x1f27('0x50')];if(!_0x29c143['query']['hasOwnProperty'](_0x1f27('0x52'))){_0x245c13[_0x1f27('0x32')]=qs['limit'](_0x29c143[_0x1f27('0x2c')][_0x1f27('0x32')]);_0x245c13[_0x1f27('0x1d')]=qs[_0x1f27('0x1d')](_0x29c143[_0x1f27('0x2c')][_0x1f27('0x1d')]);}return _0x5b07eb[_0x1f27('0x51')](_0x245c13);}})['then'](function(_0x272630){if(_0x272630){return _0x272630?{'count':_0x5da99b,'rows':_0x272630}:null;}})['then'](respondWithResult(_0x1e565a,null))['catch'](handleError(_0x1e565a,null));};exports[_0x1f27('0x53')]=function(_0x43a05e,_0x518eab,_0x1dead7){return db[_0x1f27('0x3c')][_0x1f27('0x4f')]({'where':{'id':_0x43a05e[_0x1f27('0x3f')]['id']}})[_0x1f27('0x22')](handleEntityNotFound(_0x518eab,null))['then'](function(_0xfaf2cd){if(_0xfaf2cd){return db['sequelize'][_0x1f27('0x54')](function(_0x1de2f2){return db[_0x1f27('0x3c')][_0x1f27('0x23')]({'where':{'IntervalId':_0x43a05e[_0x1f27('0x3f')]['id']},'transaction':_0x1de2f2})[_0x1f27('0x22')](function(_0x4ab65f){var _0x31917d=_[_0x1f27('0x37')](_0x43a05e[_0x1f27('0x46')],function(_0x157067){delete _0x157067['id'];_0x157067[_0x1f27('0x55')]=_0x43a05e['params']['id'];return _0x157067;});return db[_0x1f27('0x3c')][_0x1f27('0x56')](_0x31917d,{'transaction':_0x1de2f2});});})['then'](function(){return db[_0x1f27('0x3c')][_0x1f27('0x57')]({'where':{'IntervalId':_0x43a05e[_0x1f27('0x3f')]['id']}});});}})['then'](respondWithResult(_0x518eab,null))[_0x1f27('0x4d')](handleError(_0x518eab,null));};
\ No newline at end of file