Built motion from commit c0cdc9d8.|2.6.28
[motion2.git] / server / api / interval / interval.controller.js
index 1d406c0..96ed94d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x896f=['lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','Intervals','destroy','name','send','index','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','Interval','includeAll','include','findAll','rows','show','rawAttributes','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addInterval','IntervalId','order','filter','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x2e4bb0,_0x282023){var _0x36a95d=function(_0x5a0367){while(--_0x5a0367){_0x2e4bb0['push'](_0x2e4bb0['shift']());}};_0x36a95d(++_0x282023);}(_0x896f,0x1b6));var _0xf896=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x896f[_0x24237f];return _0x48298e;};'use strict';var emlformat=require(_0xf896('0x0'));var rimraf=require(_0xf896('0x1'));var zipdir=require(_0xf896('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf896('0x3'));var moment=require(_0xf896('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf896('0x5'));var util=require(_0xf896('0x6'));var path=require(_0xf896('0x7'));var sox=require(_0xf896('0x8'));var csv=require(_0xf896('0x9'));var ejs=require(_0xf896('0xa'));var fs=require('fs');var fs_extra=require(_0xf896('0xb'));var _=require(_0xf896('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf896('0xd'));var deskjs=require(_0xf896('0xe'));var toCsv=require(_0xf896('0x9'));var querystring=require(_0xf896('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf896('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf896('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf896('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf896('0x13'));var licenseUtil=require(_0xf896('0x14'));var db=require('../../mysqldb')['db'];var extensions=require(_0xf896('0x15'));function respondWithStatusCode(_0x494de4,_0x52888f){_0x52888f=_0x52888f||0xcc;return function(_0x4214e1){if(_0x4214e1){return _0x494de4[_0xf896('0x16')](_0x52888f);}return _0x494de4[_0xf896('0x17')](_0x52888f)[_0xf896('0x18')]();};}function respondWithResult(_0x45c069,_0x54d54c){_0x54d54c=_0x54d54c||0xc8;return function(_0x59e49e){if(_0x59e49e){return _0x45c069[_0xf896('0x17')](_0x54d54c)['json'](_0x59e49e);}};}function respondWithFilteredResult(_0x5bf81e,_0xc94c48){return function(_0x2b6e51){if(_0x2b6e51){var _0x5f3b32=typeof _0xc94c48[_0xf896('0x19')]===_0xf896('0x1a')&&typeof _0xc94c48[_0xf896('0x1b')]===_0xf896('0x1a');var _0x5322e9=_0x2b6e51['count'];var _0x1caed3=_0x5f3b32?0x0:_0xc94c48['offset'];var _0x119fb6=_0x5f3b32?_0x2b6e51[_0xf896('0x1c')]:_0xc94c48[_0xf896('0x19')]+_0xc94c48['limit'];var _0x3ae247;if(_0x119fb6>=_0x5322e9){_0x119fb6=_0x5322e9;_0x3ae247=0xc8;}else{_0x3ae247=0xce;}_0x5bf81e[_0xf896('0x17')](_0x3ae247);return _0x5bf81e['set'](_0xf896('0x1d'),_0x1caed3+'-'+_0x119fb6+'/'+_0x5322e9)['json'](_0x2b6e51);}return null;};}function patchUpdates(_0x3e33f7){return function(_0x2169ec){try{jsonpatch[_0xf896('0x1e')](_0x2169ec,_0x3e33f7,!![]);}catch(_0x250257){return BPromise[_0xf896('0x1f')](_0x250257);}return _0x2169ec[_0xf896('0x20')]();};}function saveUpdates(_0x1b51cb,_0x5155c9){return function(_0x2981bf){if(_0x2981bf){return _0x2981bf[_0xf896('0x21')](_0x1b51cb)[_0xf896('0x22')](function(_0x1391c8){return _0x1391c8;});}return null;};}function removeEntity(_0x534689,_0x687457){return function(_0x4c1b25){if(_0x4c1b25){return _0x4c1b25['destroy']()['then'](function(){var _0x48461f=_0x4c1b25[_0xf896('0x23')]({'plain':!![]});var _0x3e0c33=_0xf896('0x24');return db['UserProfileResource'][_0xf896('0x25')]({'where':{'type':_0x3e0c33,'resourceId':_0x48461f['id']}})[_0xf896('0x22')](function(){return _0x4c1b25;});})[_0xf896('0x22')](function(){_0x534689[_0xf896('0x17')](0xcc)[_0xf896('0x18')]();});}};}function handleEntityNotFound(_0x52a843,_0x50dee7){return function(_0x44821b){if(!_0x44821b){_0x52a843[_0xf896('0x16')](0x194);}return _0x44821b;};}function handleError(_0x464267,_0x1f51b7){_0x1f51b7=_0x1f51b7||0x1f4;return function(_0x41a879){logger['error'](_0x41a879['stack']);if(_0x41a879['name']){delete _0x41a879[_0xf896('0x26')];}_0x464267[_0xf896('0x17')](_0x1f51b7)[_0xf896('0x27')](_0x41a879);};}exports[_0xf896('0x28')]=function(_0x400560,_0x386084){var _0x1a12a7={},_0x3f9494={},_0x4b3c46={'count':0x0,'rows':[]};var _0x4ebe68=_['map'](db['Interval']['rawAttributes'],function(_0x2b1877){return{'name':_0x2b1877[_0xf896('0x29')],'type':_0x2b1877[_0xf896('0x2a')]['key']};});_0x3f9494[_0xf896('0x2b')]=_[_0xf896('0x2c')](_0x4ebe68,_0xf896('0x26'));_0x3f9494[_0xf896('0x2d')]=_[_0xf896('0x2e')](_0x400560[_0xf896('0x2d')]);_0x3f9494[_0xf896('0x2f')]=_['intersection'](_0x3f9494[_0xf896('0x2b')],_0x3f9494[_0xf896('0x2d')]);_0x1a12a7[_0xf896('0x30')]=_[_0xf896('0x31')](_0x3f9494[_0xf896('0x2b')],qs[_0xf896('0x32')](_0x400560[_0xf896('0x2d')][_0xf896('0x32')]));_0x1a12a7['attributes']=_0x1a12a7[_0xf896('0x30')][_0xf896('0x33')]?_0x1a12a7['attributes']:_0x3f9494[_0xf896('0x2b')];if(!_0x400560['query'][_0xf896('0x34')](_0xf896('0x35'))){_0x1a12a7[_0xf896('0x1b')]=qs[_0xf896('0x1b')](_0x400560[_0xf896('0x2d')]['limit']);_0x1a12a7[_0xf896('0x19')]=qs[_0xf896('0x19')](_0x400560[_0xf896('0x2d')][_0xf896('0x19')]);}_0x1a12a7['order']=qs['sort'](_0x400560[_0xf896('0x2d')][_0xf896('0x36')]);_0x1a12a7[_0xf896('0x37')]=qs['filters'](_[_0xf896('0x38')](_0x400560[_0xf896('0x2d')],_0x3f9494[_0xf896('0x2f')]),_0x4ebe68);if(_0x400560[_0xf896('0x2d')]['filter']){_0x1a12a7[_0xf896('0x37')]=_[_0xf896('0x39')](_0x1a12a7['where'],{'$or':_['map'](_0x4ebe68,function(_0x226e47){if(_0x226e47[_0xf896('0x2a')]!==_0xf896('0x3a')){var _0x14745d={};_0x14745d[_0x226e47[_0xf896('0x26')]]={'$like':'%'+_0x400560[_0xf896('0x2d')]['filter']+'%'};return _0x14745d;}})});}_0x1a12a7=_[_0xf896('0x39')]({},_0x1a12a7,_0x400560['options']);var _0x41ba02={'where':_0x1a12a7[_0xf896('0x37')]};return db[_0xf896('0x3b')][_0xf896('0x1c')](_0x41ba02)[_0xf896('0x22')](function(_0x51d34a){_0x4b3c46[_0xf896('0x1c')]=_0x51d34a;if(_0x400560['query'][_0xf896('0x3c')]){_0x1a12a7[_0xf896('0x3d')]=[{'all':!![]}];}return db['Interval'][_0xf896('0x3e')](_0x1a12a7);})[_0xf896('0x22')](function(_0x1f7790){_0x4b3c46[_0xf896('0x3f')]=_0x1f7790;return _0x4b3c46;})['then'](respondWithFilteredResult(_0x386084,_0x1a12a7))['catch'](handleError(_0x386084,null));};exports[_0xf896('0x40')]=function(_0x410f13,_0x230947){var _0x431c4d={'raw':!![],'where':{'id':_0x410f13['params']['id']}},_0x3c819a={};_0x3c819a[_0xf896('0x2b')]=_[_0xf896('0x2e')](db[_0xf896('0x3b')][_0xf896('0x41')]);_0x3c819a['query']=_[_0xf896('0x2e')](_0x410f13[_0xf896('0x2d')]);_0x3c819a[_0xf896('0x2f')]=_['intersection'](_0x3c819a[_0xf896('0x2b')],_0x3c819a[_0xf896('0x2d')]);_0x431c4d[_0xf896('0x30')]=_[_0xf896('0x31')](_0x3c819a[_0xf896('0x2b')],qs[_0xf896('0x32')](_0x410f13[_0xf896('0x2d')][_0xf896('0x32')]));_0x431c4d['attributes']=_0x431c4d[_0xf896('0x30')][_0xf896('0x33')]?_0x431c4d[_0xf896('0x30')]:_0x3c819a[_0xf896('0x2b')];if(_0x410f13[_0xf896('0x2d')][_0xf896('0x3c')]){_0x431c4d[_0xf896('0x3d')]=[{'all':!![]}];}_0x431c4d=_['merge']({},_0x431c4d,_0x410f13[_0xf896('0x42')]);return db['Interval'][_0xf896('0x43')](_0x431c4d)['then'](handleEntityNotFound(_0x230947,null))['then'](respondWithResult(_0x230947,null))[_0xf896('0x44')](handleError(_0x230947,null));};exports['create']=function(_0x38e261,_0x431502){return db['Interval'][_0xf896('0x45')](_0x38e261['body'],{})['then'](function(_0x2369cd){var _0x2f48bd=_0x38e261['user'][_0xf896('0x23')]({'plain':!![]});if(!_0x2f48bd)throw new Error(_0xf896('0x46'));if(_0x2f48bd[_0xf896('0x47')]===_0xf896('0x48')){var _0x5b78d2=_0x2369cd[_0xf896('0x23')]({'plain':!![]});var _0x173854=_0xf896('0x24');return db[_0xf896('0x49')]['find']({'where':{'name':_0x173854,'userProfileId':_0x2f48bd[_0xf896('0x4a')]},'raw':!![]})[_0xf896('0x22')](function(_0x4d1306){if(_0x4d1306&&_0x4d1306[_0xf896('0x4b')]===0x0){return db[_0xf896('0x4c')][_0xf896('0x45')]({'name':_0x5b78d2['name'],'resourceId':_0x5b78d2['id'],'type':_0x4d1306[_0xf896('0x26')],'sectionId':_0x4d1306['id']},{})[_0xf896('0x22')](function(){return _0x2369cd;});}else{return _0x2369cd;}})[_0xf896('0x44')](function(_0x2dfa92){logger[_0xf896('0x4d')](_0xf896('0x4e'),_0x2dfa92);throw _0x2dfa92;});}return _0x2369cd;})['then'](respondWithResult(_0x431502,0xc9))[_0xf896('0x44')](handleError(_0x431502,null));};exports[_0xf896('0x21')]=function(_0x361853,_0x2be331){if(_0x361853[_0xf896('0x4f')]['id']){delete _0x361853[_0xf896('0x4f')]['id'];}return db[_0xf896('0x3b')][_0xf896('0x43')]({'where':{'id':_0x361853[_0xf896('0x50')]['id']}})[_0xf896('0x22')](handleEntityNotFound(_0x2be331,null))[_0xf896('0x22')](saveUpdates(_0x361853['body'],null))[_0xf896('0x22')](respondWithResult(_0x2be331,null))[_0xf896('0x44')](handleError(_0x2be331,null));};exports[_0xf896('0x25')]=function(_0xf33f6d,_0x4ddd13){return db[_0xf896('0x3b')][_0xf896('0x43')]({'where':{'id':_0xf33f6d[_0xf896('0x50')]['id']}})[_0xf896('0x22')](handleEntityNotFound(_0x4ddd13,null))[_0xf896('0x22')](removeEntity(_0x4ddd13,null))[_0xf896('0x44')](handleError(_0x4ddd13,null));};exports[_0xf896('0x51')]=function(_0x14e8c5,_0x750cc4,_0x167a07){if(_0x14e8c5[_0xf896('0x4f')]['id']){delete _0x14e8c5[_0xf896('0x4f')]['id'];}return db[_0xf896('0x3b')][_0xf896('0x43')]({'where':{'id':_0x14e8c5[_0xf896('0x50')]['id']}})[_0xf896('0x22')](handleEntityNotFound(_0x750cc4,null))[_0xf896('0x22')](function(_0x584b31){if(_0x584b31){_0x14e8c5[_0xf896('0x4f')][_0xf896('0x52')]=_0x584b31['id'];return db['Interval'][_0xf896('0x45')](_0x14e8c5[_0xf896('0x4f')]);}})[_0xf896('0x22')](respondWithResult(_0x750cc4,null))['catch'](handleError(_0x750cc4,null));};exports['getIntervals']=function(_0x2960a2,_0x248595,_0x4c2a1b){var _0x3b32c0={};var _0x4d3a82={};var _0x14e7f8;var _0x47b06f;return db[_0xf896('0x3b')]['findOne']({'where':{'id':_0x2960a2[_0xf896('0x50')]['id']}})[_0xf896('0x22')](handleEntityNotFound(_0x248595,null))['then'](function(_0x16e457){if(_0x16e457){_0x14e7f8=_0x16e457;_0x4d3a82['model']=_['keys'](db[_0xf896('0x3b')][_0xf896('0x41')]);_0x4d3a82[_0xf896('0x2d')]=_[_0xf896('0x2e')](_0x2960a2[_0xf896('0x2d')]);_0x4d3a82[_0xf896('0x2f')]=_[_0xf896('0x31')](_0x4d3a82[_0xf896('0x2b')],_0x4d3a82[_0xf896('0x2d')]);_0x3b32c0['attributes']=_[_0xf896('0x31')](_0x4d3a82[_0xf896('0x2b')],qs[_0xf896('0x32')](_0x2960a2[_0xf896('0x2d')][_0xf896('0x32')]));_0x3b32c0[_0xf896('0x30')]=_0x3b32c0['attributes'][_0xf896('0x33')]?_0x3b32c0[_0xf896('0x30')]:_0x4d3a82[_0xf896('0x2b')];_0x3b32c0[_0xf896('0x53')]=qs[_0xf896('0x36')](_0x2960a2[_0xf896('0x2d')][_0xf896('0x36')]);_0x3b32c0['where']=qs[_0xf896('0x2f')](_['pick'](_0x2960a2[_0xf896('0x2d')],_0x4d3a82[_0xf896('0x2f')]));if(_0x2960a2[_0xf896('0x2d')][_0xf896('0x54')]){_0x3b32c0[_0xf896('0x37')]=_[_0xf896('0x39')](_0x3b32c0[_0xf896('0x37')],{'$or':_[_0xf896('0x2c')](_0x3b32c0[_0xf896('0x30')],function(_0x3eef3b){var _0x4938d1={};_0x4938d1[_0x3eef3b]={'$like':'%'+_0x2960a2[_0xf896('0x2d')][_0xf896('0x54')]+'%'};return _0x4938d1;})});}_0x3b32c0=_[_0xf896('0x39')]({},_0x3b32c0,_0x2960a2[_0xf896('0x42')]);return _0x14e7f8[_0xf896('0x55')](_0x3b32c0);}})[_0xf896('0x22')](function(_0x1849e1){if(_0x1849e1){_0x47b06f=_0x1849e1[_0xf896('0x33')];if(!_0x2960a2['query'][_0xf896('0x34')](_0xf896('0x35'))){_0x3b32c0['limit']=qs[_0xf896('0x1b')](_0x2960a2[_0xf896('0x2d')][_0xf896('0x1b')]);_0x3b32c0[_0xf896('0x19')]=qs['offset'](_0x2960a2[_0xf896('0x2d')]['offset']);}return _0x14e7f8['getIntervals'](_0x3b32c0);}})[_0xf896('0x22')](function(_0x12ab22){if(_0x12ab22){return _0x12ab22?{'count':_0x47b06f,'rows':_0x12ab22}:null;}})['then'](respondWithResult(_0x248595,null))[_0xf896('0x44')](handleError(_0x248595,null));};exports[_0xf896('0x56')]=function(_0x76559b,_0x2e8fbd,_0x34376f){return db[_0xf896('0x3b')]['findOne']({'where':{'id':_0x76559b[_0xf896('0x50')]['id']}})[_0xf896('0x22')](handleEntityNotFound(_0x2e8fbd,null))[_0xf896('0x22')](function(_0x5d59e8){if(_0x5d59e8){return db[_0xf896('0x57')][_0xf896('0x58')](function(_0x4aaafe){return db[_0xf896('0x3b')]['destroy']({'where':{'IntervalId':_0x76559b[_0xf896('0x50')]['id']},'transaction':_0x4aaafe})[_0xf896('0x22')](function(_0x40c537){var _0x4c0b21=_[_0xf896('0x2c')](_0x76559b['body'],function(_0x54bde3){delete _0x54bde3['id'];_0x54bde3[_0xf896('0x52')]=_0x76559b[_0xf896('0x50')]['id'];return _0x54bde3;});return db[_0xf896('0x3b')][_0xf896('0x59')](_0x4c0b21,{'transaction':_0x4aaafe});});})[_0xf896('0x22')](function(){return db[_0xf896('0x3b')]['findAll']({'where':{'IntervalId':_0x76559b[_0xf896('0x50')]['id']}});});}})['then'](respondWithResult(_0x2e8fbd,null))['catch'](handleError(_0x2e8fbd,null));};
\ No newline at end of file
+var _0xfcf6=['addIntervals','findOne','transaction','IntervalId','bulkCreate','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','UserProfileResource','then','sendStatus','error','stack','send','index','map','Interval','rawAttributes','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals'];(function(_0x23a061,_0x503206){var _0x1371bd=function(_0x3c8b13){while(--_0x3c8b13){_0x23a061['push'](_0x23a061['shift']());}};_0x1371bd(++_0x503206);}(_0xfcf6,0x1bd));var _0x6fcf=function(_0x163db1,_0x1bd35a){_0x163db1=_0x163db1-0x0;var _0x5b105e=_0xfcf6[_0x163db1];return _0x5b105e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6fcf('0x0'));var zipdir=require(_0x6fcf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6fcf('0x2'));var moment=require('moment');var BPromise=require(_0x6fcf('0x3'));var Mustache=require(_0x6fcf('0x4'));var util=require(_0x6fcf('0x5'));var path=require(_0x6fcf('0x6'));var sox=require(_0x6fcf('0x7'));var csv=require(_0x6fcf('0x8'));var ejs=require(_0x6fcf('0x9'));var fs=require('fs');var fs_extra=require(_0x6fcf('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6fcf('0xb'));var jsforce=require(_0x6fcf('0xc'));var deskjs=require(_0x6fcf('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6fcf('0xe'));var Papa=require(_0x6fcf('0xf'));var Redis=require('ioredis');var authService=require(_0x6fcf('0x10'));var qs=require(_0x6fcf('0x11'));var as=require(_0x6fcf('0x12'));var hardwareService=require(_0x6fcf('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6fcf('0x14'));var licenseUtil=require(_0x6fcf('0x15'));var db=require(_0x6fcf('0x16'))['db'];var extensions=require(_0x6fcf('0x17'));function respondWithStatusCode(_0x4e06df,_0x3513ae){_0x3513ae=_0x3513ae||0xcc;return function(_0x200c0b){if(_0x200c0b){return _0x4e06df['sendStatus'](_0x3513ae);}return _0x4e06df[_0x6fcf('0x18')](_0x3513ae)[_0x6fcf('0x19')]();};}function respondWithResult(_0x265698,_0x30ec76){_0x30ec76=_0x30ec76||0xc8;return function(_0x2597ec){if(_0x2597ec){return _0x265698[_0x6fcf('0x18')](_0x30ec76)[_0x6fcf('0x1a')](_0x2597ec);}};}function respondWithFilteredResult(_0x38a2f8,_0x1cab4d){return function(_0x45bcb2){if(_0x45bcb2){var _0x580bdc=typeof _0x1cab4d['offset']==='undefined'&&typeof _0x1cab4d['limit']==='undefined';var _0xd43057=_0x45bcb2[_0x6fcf('0x1b')];var _0x40d356=_0x580bdc?0x0:_0x1cab4d['offset'];var _0x1ec427=_0x580bdc?_0x45bcb2[_0x6fcf('0x1b')]:_0x1cab4d[_0x6fcf('0x1c')]+_0x1cab4d[_0x6fcf('0x1d')];var _0x484a9b;if(_0x1ec427>=_0xd43057){_0x1ec427=_0xd43057;_0x484a9b=0xc8;}else{_0x484a9b=0xce;}_0x38a2f8[_0x6fcf('0x18')](_0x484a9b);return _0x38a2f8[_0x6fcf('0x1e')](_0x6fcf('0x1f'),_0x40d356+'-'+_0x1ec427+'/'+_0xd43057)[_0x6fcf('0x1a')](_0x45bcb2);}return null;};}function patchUpdates(_0x18c823){return function(_0x423e3a){try{jsonpatch[_0x6fcf('0x20')](_0x423e3a,_0x18c823,!![]);}catch(_0x17f1e3){return BPromise[_0x6fcf('0x21')](_0x17f1e3);}return _0x423e3a[_0x6fcf('0x22')]();};}function saveUpdates(_0xc650e8,_0x1ec4b5){return function(_0x49a91b){if(_0x49a91b){return _0x49a91b['update'](_0xc650e8)['then'](function(_0x12dc0a){return _0x12dc0a;});}return null;};}function removeEntity(_0x2a0749,_0x1d50e4){return function(_0xe4e204){if(_0xe4e204){return _0xe4e204[_0x6fcf('0x23')]()['then'](function(){var _0x35f80b=_0xe4e204[_0x6fcf('0x24')]({'plain':!![]});var _0x463be0='Intervals';return db[_0x6fcf('0x25')][_0x6fcf('0x23')]({'where':{'type':_0x463be0,'resourceId':_0x35f80b['id']}})['then'](function(){return _0xe4e204;});})[_0x6fcf('0x26')](function(){_0x2a0749[_0x6fcf('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b9dbe,_0x5b1761){return function(_0x53e3ff){if(!_0x53e3ff){_0x3b9dbe[_0x6fcf('0x27')](0x194);}return _0x53e3ff;};}function handleError(_0x2fd23a,_0x33fdda){_0x33fdda=_0x33fdda||0x1f4;return function(_0x36f52f){logger[_0x6fcf('0x28')](_0x36f52f[_0x6fcf('0x29')]);if(_0x36f52f['name']){delete _0x36f52f['name'];}_0x2fd23a[_0x6fcf('0x18')](_0x33fdda)[_0x6fcf('0x2a')](_0x36f52f);};}exports[_0x6fcf('0x2b')]=function(_0x4a4297,_0x3ad87c){var _0x145cc4={},_0x31fa12={},_0x3e6ef6={'count':0x0,'rows':[]};var _0x1a4155=_[_0x6fcf('0x2c')](db[_0x6fcf('0x2d')][_0x6fcf('0x2e')],function(_0x123b57){return{'name':_0x123b57['fieldName'],'type':_0x123b57[_0x6fcf('0x2f')][_0x6fcf('0x30')]};});_0x31fa12[_0x6fcf('0x31')]=_[_0x6fcf('0x2c')](_0x1a4155,_0x6fcf('0x32'));_0x31fa12[_0x6fcf('0x33')]=_[_0x6fcf('0x34')](_0x4a4297[_0x6fcf('0x33')]);_0x31fa12[_0x6fcf('0x35')]=_['intersection'](_0x31fa12[_0x6fcf('0x31')],_0x31fa12[_0x6fcf('0x33')]);_0x145cc4[_0x6fcf('0x36')]=_[_0x6fcf('0x37')](_0x31fa12['model'],qs[_0x6fcf('0x38')](_0x4a4297[_0x6fcf('0x33')][_0x6fcf('0x38')]));_0x145cc4['attributes']=_0x145cc4[_0x6fcf('0x36')][_0x6fcf('0x39')]?_0x145cc4[_0x6fcf('0x36')]:_0x31fa12[_0x6fcf('0x31')];if(!_0x4a4297[_0x6fcf('0x33')][_0x6fcf('0x3a')](_0x6fcf('0x3b'))){_0x145cc4[_0x6fcf('0x1d')]=qs['limit'](_0x4a4297[_0x6fcf('0x33')][_0x6fcf('0x1d')]);_0x145cc4[_0x6fcf('0x1c')]=qs['offset'](_0x4a4297[_0x6fcf('0x33')][_0x6fcf('0x1c')]);}_0x145cc4['order']=qs[_0x6fcf('0x3c')](_0x4a4297['query'][_0x6fcf('0x3c')]);_0x145cc4[_0x6fcf('0x3d')]=qs[_0x6fcf('0x35')](_[_0x6fcf('0x3e')](_0x4a4297['query'],_0x31fa12[_0x6fcf('0x35')]),_0x1a4155);if(_0x4a4297[_0x6fcf('0x33')][_0x6fcf('0x3f')]){_0x145cc4['where']=_[_0x6fcf('0x40')](_0x145cc4['where'],{'$or':_['map'](_0x1a4155,function(_0x1e2780){if(_0x1e2780['type']!==_0x6fcf('0x41')){var _0x23c0b2={};_0x23c0b2[_0x1e2780['name']]={'$like':'%'+_0x4a4297[_0x6fcf('0x33')][_0x6fcf('0x3f')]+'%'};return _0x23c0b2;}})});}_0x145cc4=_[_0x6fcf('0x40')]({},_0x145cc4,_0x4a4297[_0x6fcf('0x42')]);var _0x5be435={'where':_0x145cc4['where']};return db[_0x6fcf('0x2d')]['count'](_0x5be435)['then'](function(_0x15e1fb){_0x3e6ef6[_0x6fcf('0x1b')]=_0x15e1fb;if(_0x4a4297[_0x6fcf('0x33')]['includeAll']){_0x145cc4[_0x6fcf('0x43')]=[{'all':!![]}];}return db['Interval'][_0x6fcf('0x44')](_0x145cc4);})[_0x6fcf('0x26')](function(_0x4af3b1){_0x3e6ef6['rows']=_0x4af3b1;return _0x3e6ef6;})[_0x6fcf('0x26')](respondWithFilteredResult(_0x3ad87c,_0x145cc4))[_0x6fcf('0x45')](handleError(_0x3ad87c,null));};exports[_0x6fcf('0x46')]=function(_0x433583,_0x196eb0){var _0x3b3bc7={'raw':!![],'where':{'id':_0x433583[_0x6fcf('0x47')]['id']}},_0x21f7e1={};_0x21f7e1[_0x6fcf('0x31')]=_[_0x6fcf('0x34')](db[_0x6fcf('0x2d')]['rawAttributes']);_0x21f7e1['query']=_[_0x6fcf('0x34')](_0x433583[_0x6fcf('0x33')]);_0x21f7e1['filters']=_[_0x6fcf('0x37')](_0x21f7e1[_0x6fcf('0x31')],_0x21f7e1[_0x6fcf('0x33')]);_0x3b3bc7[_0x6fcf('0x36')]=_[_0x6fcf('0x37')](_0x21f7e1[_0x6fcf('0x31')],qs[_0x6fcf('0x38')](_0x433583[_0x6fcf('0x33')][_0x6fcf('0x38')]));_0x3b3bc7[_0x6fcf('0x36')]=_0x3b3bc7[_0x6fcf('0x36')][_0x6fcf('0x39')]?_0x3b3bc7['attributes']:_0x21f7e1['model'];if(_0x433583[_0x6fcf('0x33')][_0x6fcf('0x48')]){_0x3b3bc7[_0x6fcf('0x43')]=[{'all':!![]}];}_0x3b3bc7=_[_0x6fcf('0x40')]({},_0x3b3bc7,_0x433583[_0x6fcf('0x42')]);return db[_0x6fcf('0x2d')][_0x6fcf('0x49')](_0x3b3bc7)[_0x6fcf('0x26')](handleEntityNotFound(_0x196eb0,null))[_0x6fcf('0x26')](respondWithResult(_0x196eb0,null))[_0x6fcf('0x45')](handleError(_0x196eb0,null));};exports[_0x6fcf('0x4a')]=function(_0x563c2d,_0x1e1d9b){return db[_0x6fcf('0x2d')][_0x6fcf('0x4a')](_0x563c2d[_0x6fcf('0x4b')],{})[_0x6fcf('0x26')](function(_0x42c778){var _0x1a5a76=_0x563c2d['user'][_0x6fcf('0x24')]({'plain':!![]});if(!_0x1a5a76)throw new Error(_0x6fcf('0x4c'));if(_0x1a5a76[_0x6fcf('0x4d')]===_0x6fcf('0x4e')){var _0x404a71=_0x42c778[_0x6fcf('0x24')]({'plain':!![]});var _0x3f06ff='Intervals';return db['UserProfileSection']['find']({'where':{'name':_0x3f06ff,'userProfileId':_0x1a5a76['userProfileId']},'raw':!![]})[_0x6fcf('0x26')](function(_0xeba3b6){if(_0xeba3b6&&_0xeba3b6[_0x6fcf('0x4f')]===0x0){return db[_0x6fcf('0x25')][_0x6fcf('0x4a')]({'name':_0x404a71[_0x6fcf('0x32')],'resourceId':_0x404a71['id'],'type':_0xeba3b6['name'],'sectionId':_0xeba3b6['id']},{})[_0x6fcf('0x26')](function(){return _0x42c778;});}else{return _0x42c778;}})[_0x6fcf('0x45')](function(_0x769821){logger[_0x6fcf('0x28')](_0x6fcf('0x50'),_0x769821);throw _0x769821;});}return _0x42c778;})[_0x6fcf('0x26')](respondWithResult(_0x1e1d9b,0xc9))[_0x6fcf('0x45')](handleError(_0x1e1d9b,null));};exports['update']=function(_0x2284af,_0x54d6c7){if(_0x2284af[_0x6fcf('0x4b')]['id']){delete _0x2284af[_0x6fcf('0x4b')]['id'];}return db[_0x6fcf('0x2d')][_0x6fcf('0x49')]({'where':{'id':_0x2284af[_0x6fcf('0x47')]['id']}})['then'](handleEntityNotFound(_0x54d6c7,null))['then'](saveUpdates(_0x2284af[_0x6fcf('0x4b')],null))[_0x6fcf('0x26')](respondWithResult(_0x54d6c7,null))['catch'](handleError(_0x54d6c7,null));};exports[_0x6fcf('0x23')]=function(_0x341493,_0x25f550){return db[_0x6fcf('0x2d')]['find']({'where':{'id':_0x341493[_0x6fcf('0x47')]['id']}})[_0x6fcf('0x26')](handleEntityNotFound(_0x25f550,null))[_0x6fcf('0x26')](removeEntity(_0x25f550,null))['catch'](handleError(_0x25f550,null));};exports[_0x6fcf('0x51')]=function(_0x3e7f27,_0x479cbd,_0x538882){if(_0x3e7f27[_0x6fcf('0x4b')]['id']){delete _0x3e7f27[_0x6fcf('0x4b')]['id'];}return db[_0x6fcf('0x2d')]['find']({'where':{'id':_0x3e7f27['params']['id']}})[_0x6fcf('0x26')](handleEntityNotFound(_0x479cbd,null))['then'](function(_0x49e305){if(_0x49e305){_0x3e7f27[_0x6fcf('0x4b')]['IntervalId']=_0x49e305['id'];return db[_0x6fcf('0x2d')][_0x6fcf('0x4a')](_0x3e7f27[_0x6fcf('0x4b')]);}})[_0x6fcf('0x26')](respondWithResult(_0x479cbd,null))['catch'](handleError(_0x479cbd,null));};exports['getIntervals']=function(_0x5d610b,_0x53c5de,_0x580c50){var _0x1eee21={};var _0x44386a={};var _0xe7e4cd;var _0x5dd282;return db[_0x6fcf('0x2d')]['findOne']({'where':{'id':_0x5d610b['params']['id']}})[_0x6fcf('0x26')](handleEntityNotFound(_0x53c5de,null))[_0x6fcf('0x26')](function(_0x44d0e6){if(_0x44d0e6){_0xe7e4cd=_0x44d0e6;_0x44386a['model']=_['keys'](db[_0x6fcf('0x2d')][_0x6fcf('0x2e')]);_0x44386a[_0x6fcf('0x33')]=_['keys'](_0x5d610b[_0x6fcf('0x33')]);_0x44386a[_0x6fcf('0x35')]=_['intersection'](_0x44386a[_0x6fcf('0x31')],_0x44386a['query']);_0x1eee21[_0x6fcf('0x36')]=_[_0x6fcf('0x37')](_0x44386a['model'],qs[_0x6fcf('0x38')](_0x5d610b['query'][_0x6fcf('0x38')]));_0x1eee21[_0x6fcf('0x36')]=_0x1eee21[_0x6fcf('0x36')][_0x6fcf('0x39')]?_0x1eee21['attributes']:_0x44386a[_0x6fcf('0x31')];_0x1eee21['order']=qs['sort'](_0x5d610b['query'][_0x6fcf('0x3c')]);_0x1eee21[_0x6fcf('0x3d')]=qs[_0x6fcf('0x35')](_['pick'](_0x5d610b['query'],_0x44386a[_0x6fcf('0x35')]));if(_0x5d610b[_0x6fcf('0x33')][_0x6fcf('0x3f')]){_0x1eee21[_0x6fcf('0x3d')]=_[_0x6fcf('0x40')](_0x1eee21[_0x6fcf('0x3d')],{'$or':_[_0x6fcf('0x2c')](_0x1eee21[_0x6fcf('0x36')],function(_0xcba8c0){var _0x20389e={};_0x20389e[_0xcba8c0]={'$like':'%'+_0x5d610b[_0x6fcf('0x33')][_0x6fcf('0x3f')]+'%'};return _0x20389e;})});}_0x1eee21=_[_0x6fcf('0x40')]({},_0x1eee21,_0x5d610b[_0x6fcf('0x42')]);return _0xe7e4cd[_0x6fcf('0x52')](_0x1eee21);}})[_0x6fcf('0x26')](function(_0x42eccc){if(_0x42eccc){_0x5dd282=_0x42eccc['length'];if(!_0x5d610b[_0x6fcf('0x33')][_0x6fcf('0x3a')]('nolimit')){_0x1eee21[_0x6fcf('0x1d')]=qs['limit'](_0x5d610b['query'][_0x6fcf('0x1d')]);_0x1eee21[_0x6fcf('0x1c')]=qs['offset'](_0x5d610b[_0x6fcf('0x33')][_0x6fcf('0x1c')]);}return _0xe7e4cd[_0x6fcf('0x52')](_0x1eee21);}})[_0x6fcf('0x26')](function(_0x4d8d9a){if(_0x4d8d9a){return _0x4d8d9a?{'count':_0x5dd282,'rows':_0x4d8d9a}:null;}})['then'](respondWithResult(_0x53c5de,null))[_0x6fcf('0x45')](handleError(_0x53c5de,null));};exports[_0x6fcf('0x53')]=function(_0x3844ca,_0x4309bc,_0x571de2){return db[_0x6fcf('0x2d')][_0x6fcf('0x54')]({'where':{'id':_0x3844ca[_0x6fcf('0x47')]['id']}})[_0x6fcf('0x26')](handleEntityNotFound(_0x4309bc,null))[_0x6fcf('0x26')](function(_0x33681f){if(_0x33681f){return db['sequelize'][_0x6fcf('0x55')](function(_0x4fac17){return db[_0x6fcf('0x2d')][_0x6fcf('0x23')]({'where':{'IntervalId':_0x3844ca[_0x6fcf('0x47')]['id']},'transaction':_0x4fac17})[_0x6fcf('0x26')](function(_0x229c18){var _0x59eb27=_[_0x6fcf('0x2c')](_0x3844ca[_0x6fcf('0x4b')],function(_0x3df18a){delete _0x3df18a['id'];_0x3df18a[_0x6fcf('0x56')]=_0x3844ca[_0x6fcf('0x47')]['id'];return _0x3df18a;});return db[_0x6fcf('0x2d')][_0x6fcf('0x57')](_0x59eb27,{'transaction':_0x4fac17});});})[_0x6fcf('0x26')](function(){return db[_0x6fcf('0x2d')][_0x6fcf('0x44')]({'where':{'IntervalId':_0x3844ca[_0x6fcf('0x47')]['id']}});});}})['then'](respondWithResult(_0x4309bc,null))[_0x6fcf('0x45')](handleError(_0x4309bc,null));};
\ No newline at end of file