Built motion from commit (unavailable).|2.5.30
[motion2.git] / server / api / interval / interval.controller.js
index cf207a8..00c7055 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x12f1=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','destroy','UserProfileResource','then','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','where','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','sort','hasOwnProperty','addIntervals','sequelize','transaction','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x12f1,0xac));var _0x112f=function(_0x3d5729,_0x512321){_0x3d5729=_0x3d5729-0x0;var _0x45ac2d=_0x12f1[_0x3d5729];return _0x45ac2d;};'use strict';var emlformat=require(_0x112f('0x0'));var rimraf=require(_0x112f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x112f('0x2'));var rp=require('request-promise');var moment=require(_0x112f('0x3'));var BPromise=require(_0x112f('0x4'));var Mustache=require(_0x112f('0x5'));var util=require(_0x112f('0x6'));var path=require(_0x112f('0x7'));var sox=require(_0x112f('0x8'));var csv=require(_0x112f('0x9'));var ejs=require(_0x112f('0xa'));var fs=require('fs');var fs_extra=require(_0x112f('0xb'));var _=require(_0x112f('0xc'));var squel=require('squel');var crypto=require(_0x112f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x112f('0xe'));var toCsv=require(_0x112f('0x9'));var querystring=require(_0x112f('0xf'));var Papa=require(_0x112f('0x10'));var Redis=require(_0x112f('0x11'));var authService=require(_0x112f('0x12'));var qs=require(_0x112f('0x13'));var as=require(_0x112f('0x14'));var hardwareService=require(_0x112f('0x15'));var logger=require(_0x112f('0x16'))(_0x112f('0x17'));var utils=require('../../config/utils');var config=require(_0x112f('0x18'));var licenseUtil=require(_0x112f('0x19'));var db=require(_0x112f('0x1a'))['db'];var extensions=require(_0x112f('0x1b'));function respondWithStatusCode(_0x585fe1,_0x15711a){_0x15711a=_0x15711a||0xcc;return function(_0x1b4999){if(_0x1b4999){return _0x585fe1[_0x112f('0x1c')](_0x15711a);}return _0x585fe1[_0x112f('0x1d')](_0x15711a)[_0x112f('0x1e')]();};}function respondWithResult(_0x4f625a,_0x2a7962){_0x2a7962=_0x2a7962||0xc8;return function(_0x66af5e){if(_0x66af5e){return _0x4f625a[_0x112f('0x1d')](_0x2a7962)['json'](_0x66af5e);}};}function respondWithFilteredResult(_0x333720,_0x456d46){return function(_0x3e7e56){if(_0x3e7e56){var _0x1f6dd8=_0x3e7e56[_0x112f('0x1f')],_0x401e5d=_0x456d46['offset'],_0x484305=_0x456d46[_0x112f('0x20')]+_0x456d46[_0x112f('0x21')],_0x37730e;if(_0x484305>=_0x1f6dd8){_0x484305=_0x1f6dd8;_0x37730e=0xc8;}else{_0x37730e=0xce;}_0x333720[_0x112f('0x1d')](_0x37730e);return _0x333720[_0x112f('0x22')]('Content-Range',_0x401e5d+'-'+_0x484305+'/'+_0x1f6dd8)[_0x112f('0x23')](_0x3e7e56);}return null;};}function patchUpdates(_0x758993){return function(_0x1d54ed){try{jsonpatch[_0x112f('0x24')](_0x1d54ed,_0x758993,!![]);}catch(_0x539e36){return BPromise[_0x112f('0x25')](_0x539e36);}return _0x1d54ed[_0x112f('0x26')]();};}function saveUpdates(_0x5eb34e,_0x185d85){return function(_0x247ba9){if(_0x247ba9){return _0x247ba9[_0x112f('0x27')](_0x5eb34e)['then'](function(_0x15421c){return _0x15421c;});}return null;};}function removeEntity(_0x47b6fc,_0x5a77dc){return function(_0x140bd3){if(_0x140bd3){return _0x140bd3[_0x112f('0x28')]()['then'](function(){var _0x26041b=_0x140bd3['get']({'plain':!![]});var _0x29f3bc='Intervals';return db[_0x112f('0x29')][_0x112f('0x28')]({'where':{'type':_0x29f3bc,'resourceId':_0x26041b['id']}})[_0x112f('0x2a')](function(){return _0x140bd3;});})[_0x112f('0x2a')](function(){_0x47b6fc['status'](0xcc)[_0x112f('0x1e')]();});}};}function handleEntityNotFound(_0x5f23e7,_0x4d20e4){return function(_0x400474){if(!_0x400474){_0x5f23e7[_0x112f('0x1c')](0x194);}return _0x400474;};}function handleError(_0x59ade9,_0x20e861){_0x20e861=_0x20e861||0x1f4;return function(_0x740229){logger[_0x112f('0x2b')](_0x740229[_0x112f('0x2c')]);if(_0x740229[_0x112f('0x2d')]){delete _0x740229[_0x112f('0x2d')];}_0x59ade9[_0x112f('0x1d')](_0x20e861)[_0x112f('0x2e')](_0x740229);};}exports[_0x112f('0x2f')]=function(_0x1a75c3,_0x26e3c1){var _0x12f446={},_0x557c3a={},_0x21bb81={'count':0x0,'rows':[]};var _0x1a636a=_[_0x112f('0x30')](db[_0x112f('0x31')][_0x112f('0x32')],function(_0x2af834){return{'name':_0x2af834[_0x112f('0x33')],'type':_0x2af834['type'][_0x112f('0x34')]};});_0x557c3a[_0x112f('0x35')]=_[_0x112f('0x30')](_0x1a636a,_0x112f('0x2d'));_0x557c3a[_0x112f('0x36')]=_[_0x112f('0x37')](_0x1a75c3['query']);_0x557c3a[_0x112f('0x38')]=_[_0x112f('0x39')](_0x557c3a[_0x112f('0x35')],_0x557c3a['query']);_0x12f446[_0x112f('0x3a')]=_[_0x112f('0x39')](_0x557c3a[_0x112f('0x35')],qs[_0x112f('0x3b')](_0x1a75c3['query'][_0x112f('0x3b')]));_0x12f446[_0x112f('0x3a')]=_0x12f446['attributes']['length']?_0x12f446[_0x112f('0x3a')]:_0x557c3a[_0x112f('0x35')];if(!_0x1a75c3[_0x112f('0x36')]['hasOwnProperty'](_0x112f('0x3c'))){_0x12f446[_0x112f('0x21')]=qs[_0x112f('0x21')](_0x1a75c3[_0x112f('0x36')]['limit']);_0x12f446[_0x112f('0x20')]=qs['offset'](_0x1a75c3[_0x112f('0x36')]['offset']);}_0x12f446[_0x112f('0x3d')]=qs['sort'](_0x1a75c3[_0x112f('0x36')]['sort']);_0x12f446[_0x112f('0x3e')]=qs[_0x112f('0x38')](_['pick'](_0x1a75c3[_0x112f('0x36')],_0x557c3a[_0x112f('0x38')]),_0x1a636a);if(_0x1a75c3[_0x112f('0x36')][_0x112f('0x3f')]){_0x12f446['where']=_[_0x112f('0x40')](_0x12f446[_0x112f('0x3e')],{'$or':_['map'](_0x1a636a,function(_0x34fe85){if(_0x34fe85[_0x112f('0x41')]!=='VIRTUAL'){var _0x5f15a3={};_0x5f15a3[_0x34fe85[_0x112f('0x2d')]]={'$like':'%'+_0x1a75c3['query'][_0x112f('0x3f')]+'%'};return _0x5f15a3;}})});}_0x12f446=_[_0x112f('0x40')]({},_0x12f446,_0x1a75c3[_0x112f('0x42')]);var _0x5ad926={'where':_0x12f446['where']};return db[_0x112f('0x31')][_0x112f('0x1f')](_0x5ad926)[_0x112f('0x2a')](function(_0x578865){_0x21bb81['count']=_0x578865;if(_0x1a75c3[_0x112f('0x36')][_0x112f('0x43')]){_0x12f446[_0x112f('0x44')]=[{'all':!![]}];}return db[_0x112f('0x31')][_0x112f('0x45')](_0x12f446);})[_0x112f('0x2a')](function(_0x5a7b9e){_0x21bb81[_0x112f('0x46')]=_0x5a7b9e;return _0x21bb81;})[_0x112f('0x2a')](respondWithFilteredResult(_0x26e3c1,_0x12f446))[_0x112f('0x47')](handleError(_0x26e3c1,null));};exports[_0x112f('0x48')]=function(_0x468789,_0x5ec108){var _0x454657={'raw':!![],'where':{'id':_0x468789[_0x112f('0x49')]['id']}},_0x5061bd={};_0x5061bd[_0x112f('0x35')]=_[_0x112f('0x37')](db[_0x112f('0x31')]['rawAttributes']);_0x5061bd['query']=_['keys'](_0x468789[_0x112f('0x36')]);_0x5061bd[_0x112f('0x38')]=_[_0x112f('0x39')](_0x5061bd['model'],_0x5061bd[_0x112f('0x36')]);_0x454657[_0x112f('0x3a')]=_['intersection'](_0x5061bd[_0x112f('0x35')],qs[_0x112f('0x3b')](_0x468789[_0x112f('0x36')][_0x112f('0x3b')]));_0x454657[_0x112f('0x3a')]=_0x454657[_0x112f('0x3a')][_0x112f('0x4a')]?_0x454657[_0x112f('0x3a')]:_0x5061bd['model'];if(_0x468789['query']['includeAll']){_0x454657[_0x112f('0x44')]=[{'all':!![]}];}_0x454657=_[_0x112f('0x40')]({},_0x454657,_0x468789[_0x112f('0x42')]);return db[_0x112f('0x31')][_0x112f('0x4b')](_0x454657)['then'](handleEntityNotFound(_0x5ec108,null))[_0x112f('0x2a')](respondWithResult(_0x5ec108,null))[_0x112f('0x47')](handleError(_0x5ec108,null));};exports[_0x112f('0x4c')]=function(_0x361b57,_0x59f659){return db[_0x112f('0x31')][_0x112f('0x4c')](_0x361b57[_0x112f('0x4d')],{})['then'](function(_0x4841d7){var _0xf196f2=_0x361b57[_0x112f('0x4e')][_0x112f('0x4f')]({'plain':!![]});if(!_0xf196f2)throw new Error(_0x112f('0x50'));if(_0xf196f2[_0x112f('0x51')]===_0x112f('0x4e')){var _0x1a20b3=_0x4841d7['get']({'plain':!![]});var _0x353942=_0x112f('0x52');return db[_0x112f('0x53')][_0x112f('0x4b')]({'where':{'name':_0x353942,'userProfileId':_0xf196f2[_0x112f('0x54')]},'raw':!![]})['then'](function(_0x4349a1){if(_0x4349a1&&_0x4349a1[_0x112f('0x55')]===0x0){return db[_0x112f('0x29')]['create']({'name':_0x1a20b3[_0x112f('0x2d')],'resourceId':_0x1a20b3['id'],'type':_0x4349a1[_0x112f('0x2d')],'sectionId':_0x4349a1['id']},{})['then'](function(){return _0x4841d7;});}else{return _0x4841d7;}})[_0x112f('0x47')](function(_0x2d0260){logger['error'](_0x112f('0x56'),_0x2d0260);throw _0x2d0260;});}return _0x4841d7;})[_0x112f('0x2a')](respondWithResult(_0x59f659,0xc9))[_0x112f('0x47')](handleError(_0x59f659,null));};exports['update']=function(_0x11c9f8,_0x4293d6){if(_0x11c9f8[_0x112f('0x4d')]['id']){delete _0x11c9f8['body']['id'];}return db['Interval'][_0x112f('0x4b')]({'where':{'id':_0x11c9f8[_0x112f('0x49')]['id']}})[_0x112f('0x2a')](handleEntityNotFound(_0x4293d6,null))[_0x112f('0x2a')](saveUpdates(_0x11c9f8[_0x112f('0x4d')],null))[_0x112f('0x2a')](respondWithResult(_0x4293d6,null))['catch'](handleError(_0x4293d6,null));};exports[_0x112f('0x28')]=function(_0x58e4ef,_0x184ea7){return db['Interval'][_0x112f('0x4b')]({'where':{'id':_0x58e4ef['params']['id']}})['then'](handleEntityNotFound(_0x184ea7,null))[_0x112f('0x2a')](removeEntity(_0x184ea7,null))['catch'](handleError(_0x184ea7,null));};exports[_0x112f('0x57')]=function(_0x392305,_0x376879,_0x5a44d0){if(_0x392305[_0x112f('0x4d')]['id']){delete _0x392305[_0x112f('0x4d')]['id'];}return db['Interval']['find']({'where':{'id':_0x392305['params']['id']}})[_0x112f('0x2a')](handleEntityNotFound(_0x376879,null))[_0x112f('0x2a')](function(_0x5c4556){if(_0x5c4556){_0x392305[_0x112f('0x4d')]['IntervalId']=_0x5c4556['id'];return db[_0x112f('0x31')][_0x112f('0x4c')](_0x392305[_0x112f('0x4d')]);}})[_0x112f('0x2a')](respondWithResult(_0x376879,null))['catch'](handleError(_0x376879,null));};exports[_0x112f('0x58')]=function(_0x45d2c2,_0x302a09,_0x24279d){var _0x20fbbc={};var _0x290119={};var _0xe28c4d;var _0x462193;return db[_0x112f('0x31')][_0x112f('0x59')]({'where':{'id':_0x45d2c2[_0x112f('0x49')]['id']}})['then'](handleEntityNotFound(_0x302a09,null))[_0x112f('0x2a')](function(_0x5d89b4){if(_0x5d89b4){_0xe28c4d=_0x5d89b4;_0x290119[_0x112f('0x35')]=_[_0x112f('0x37')](db[_0x112f('0x31')][_0x112f('0x32')]);_0x290119[_0x112f('0x36')]=_[_0x112f('0x37')](_0x45d2c2[_0x112f('0x36')]);_0x290119[_0x112f('0x38')]=_['intersection'](_0x290119['model'],_0x290119[_0x112f('0x36')]);_0x20fbbc['attributes']=_[_0x112f('0x39')](_0x290119[_0x112f('0x35')],qs[_0x112f('0x3b')](_0x45d2c2[_0x112f('0x36')][_0x112f('0x3b')]));_0x20fbbc[_0x112f('0x3a')]=_0x20fbbc[_0x112f('0x3a')]['length']?_0x20fbbc['attributes']:_0x290119['model'];_0x20fbbc['order']=qs['sort'](_0x45d2c2[_0x112f('0x36')][_0x112f('0x5a')]);_0x20fbbc[_0x112f('0x3e')]=qs[_0x112f('0x38')](_['pick'](_0x45d2c2[_0x112f('0x36')],_0x290119[_0x112f('0x38')]));if(_0x45d2c2['query'][_0x112f('0x3f')]){_0x20fbbc['where']=_[_0x112f('0x40')](_0x20fbbc[_0x112f('0x3e')],{'$or':_['map'](_0x20fbbc[_0x112f('0x3a')],function(_0x3a59ea){var _0x5da963={};_0x5da963[_0x3a59ea]={'$like':'%'+_0x45d2c2['query']['filter']+'%'};return _0x5da963;})});}_0x20fbbc=_[_0x112f('0x40')]({},_0x20fbbc,_0x45d2c2[_0x112f('0x42')]);return _0xe28c4d[_0x112f('0x58')](_0x20fbbc);}})['then'](function(_0x41d215){if(_0x41d215){_0x462193=_0x41d215['length'];if(!_0x45d2c2['query'][_0x112f('0x5b')](_0x112f('0x3c'))){_0x20fbbc[_0x112f('0x21')]=qs[_0x112f('0x21')](_0x45d2c2[_0x112f('0x36')]['limit']);_0x20fbbc[_0x112f('0x20')]=qs[_0x112f('0x20')](_0x45d2c2[_0x112f('0x36')][_0x112f('0x20')]);}return _0xe28c4d[_0x112f('0x58')](_0x20fbbc);}})[_0x112f('0x2a')](function(_0x2f5e3e){if(_0x2f5e3e){return _0x2f5e3e?{'count':_0x462193,'rows':_0x2f5e3e}:null;}})[_0x112f('0x2a')](respondWithResult(_0x302a09,null))[_0x112f('0x47')](handleError(_0x302a09,null));};exports[_0x112f('0x5c')]=function(_0x39e233,_0x39bff9,_0x15ebc1){return db['Interval'][_0x112f('0x59')]({'where':{'id':_0x39e233[_0x112f('0x49')]['id']}})[_0x112f('0x2a')](handleEntityNotFound(_0x39bff9,null))['then'](function(_0x584db1){if(_0x584db1){return db[_0x112f('0x5d')][_0x112f('0x5e')](function(_0xfd6678){return db[_0x112f('0x31')][_0x112f('0x28')]({'where':{'IntervalId':_0x39e233[_0x112f('0x49')]['id']},'transaction':_0xfd6678})[_0x112f('0x2a')](function(_0x1619ae){var _0x26720b=_[_0x112f('0x30')](_0x39e233[_0x112f('0x4d')],function(_0x50126f){delete _0x50126f['id'];_0x50126f['IntervalId']=_0x39e233[_0x112f('0x49')]['id'];return _0x50126f;});return db[_0x112f('0x31')]['bulkCreate'](_0x26720b,{'transaction':_0xfd6678});});})[_0x112f('0x2a')](function(){return db[_0x112f('0x31')][_0x112f('0x45')]({'where':{'IntervalId':_0x39e233[_0x112f('0x49')]['id']}});});}})[_0x112f('0x2a')](respondWithResult(_0x39bff9,null))[_0x112f('0x47')](handleError(_0x39bff9,null));};
\ No newline at end of file
+var _0x76dc=['update','then','Intervals','UserProfileResource','destroy','stack','name','index','map','rawAttributes','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','Interval','findAll','rows','catch','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','params','IntervalId','getIntervals','order','addIntervals','findOne','sequelize','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save'];(function(_0x4734db,_0x21e908){var _0x175286=function(_0x2ff169){while(--_0x2ff169){_0x4734db['push'](_0x4734db['shift']());}};_0x175286(++_0x21e908);}(_0x76dc,0x1f2));var _0xc76d=function(_0x5a26b2,_0x125283){_0x5a26b2=_0x5a26b2-0x0;var _0x4d3e99=_0x76dc[_0x5a26b2];return _0x4d3e99;};'use strict';var emlformat=require(_0xc76d('0x0'));var rimraf=require(_0xc76d('0x1'));var zipdir=require(_0xc76d('0x2'));var jsonpatch=require(_0xc76d('0x3'));var rp=require('request-promise');var moment=require(_0xc76d('0x4'));var BPromise=require(_0xc76d('0x5'));var Mustache=require('mustache');var util=require(_0xc76d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc76d('0x7'));var ejs=require(_0xc76d('0x8'));var fs=require('fs');var fs_extra=require(_0xc76d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc76d('0xa'));var jsforce=require(_0xc76d('0xb'));var deskjs=require(_0xc76d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc76d('0xd'));var Redis=require(_0xc76d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc76d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc76d('0x10'));var logger=require(_0xc76d('0x11'))(_0xc76d('0x12'));var utils=require(_0xc76d('0x13'));var config=require(_0xc76d('0x14'));var licenseUtil=require(_0xc76d('0x15'));var db=require(_0xc76d('0x16'))['db'];var extensions=require(_0xc76d('0x17'));function respondWithStatusCode(_0x1722b3,_0x311814){_0x311814=_0x311814||0xcc;return function(_0x1a7b47){if(_0x1a7b47){return _0x1722b3[_0xc76d('0x18')](_0x311814);}return _0x1722b3[_0xc76d('0x19')](_0x311814)[_0xc76d('0x1a')]();};}function respondWithResult(_0x5cda20,_0x8696db){_0x8696db=_0x8696db||0xc8;return function(_0x2e9ec7){if(_0x2e9ec7){return _0x5cda20['status'](_0x8696db)[_0xc76d('0x1b')](_0x2e9ec7);}};}function respondWithFilteredResult(_0x2d23d2,_0x47a4ee){return function(_0x6f94e){if(_0x6f94e){var _0x5c680c=typeof _0x47a4ee[_0xc76d('0x1c')]==='undefined'&&typeof _0x47a4ee['limit']===_0xc76d('0x1d');var _0x31b032=_0x6f94e[_0xc76d('0x1e')];var _0x23f3ca=_0x5c680c?0x0:_0x47a4ee[_0xc76d('0x1c')];var _0x4b0402=_0x5c680c?_0x6f94e[_0xc76d('0x1e')]:_0x47a4ee[_0xc76d('0x1c')]+_0x47a4ee[_0xc76d('0x1f')];var _0x1c6d5b;if(_0x4b0402>=_0x31b032){_0x4b0402=_0x31b032;_0x1c6d5b=0xc8;}else{_0x1c6d5b=0xce;}_0x2d23d2[_0xc76d('0x19')](_0x1c6d5b);return _0x2d23d2['set'](_0xc76d('0x20'),_0x23f3ca+'-'+_0x4b0402+'/'+_0x31b032)[_0xc76d('0x1b')](_0x6f94e);}return null;};}function patchUpdates(_0x5dffde){return function(_0x455371){try{jsonpatch[_0xc76d('0x21')](_0x455371,_0x5dffde,!![]);}catch(_0x191e97){return BPromise[_0xc76d('0x22')](_0x191e97);}return _0x455371[_0xc76d('0x23')]();};}function saveUpdates(_0x3d357b,_0x42b89c){return function(_0x107fad){if(_0x107fad){return _0x107fad[_0xc76d('0x24')](_0x3d357b)[_0xc76d('0x25')](function(_0x15328d){return _0x15328d;});}return null;};}function removeEntity(_0x5de11f,_0x11b42f){return function(_0x17b46f){if(_0x17b46f){return _0x17b46f['destroy']()[_0xc76d('0x25')](function(){var _0x2f194b=_0x17b46f['get']({'plain':!![]});var _0x374b9e=_0xc76d('0x26');return db[_0xc76d('0x27')][_0xc76d('0x28')]({'where':{'type':_0x374b9e,'resourceId':_0x2f194b['id']}})[_0xc76d('0x25')](function(){return _0x17b46f;});})[_0xc76d('0x25')](function(){_0x5de11f[_0xc76d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59dabf,_0x285430){return function(_0x287ae4){if(!_0x287ae4){_0x59dabf['sendStatus'](0x194);}return _0x287ae4;};}function handleError(_0x31501a,_0x52a79a){_0x52a79a=_0x52a79a||0x1f4;return function(_0x64899f){logger['error'](_0x64899f[_0xc76d('0x29')]);if(_0x64899f['name']){delete _0x64899f[_0xc76d('0x2a')];}_0x31501a[_0xc76d('0x19')](_0x52a79a)['send'](_0x64899f);};}exports[_0xc76d('0x2b')]=function(_0x1c68f3,_0x9ab96c){var _0x2cf501={},_0x4feeda={},_0x283e16={'count':0x0,'rows':[]};var _0x4a7e4c=_[_0xc76d('0x2c')](db['Interval'][_0xc76d('0x2d')],function(_0x39127c){return{'name':_0x39127c['fieldName'],'type':_0x39127c['type']['key']};});_0x4feeda['model']=_[_0xc76d('0x2c')](_0x4a7e4c,_0xc76d('0x2a'));_0x4feeda[_0xc76d('0x2e')]=_[_0xc76d('0x2f')](_0x1c68f3[_0xc76d('0x2e')]);_0x4feeda['filters']=_[_0xc76d('0x30')](_0x4feeda['model'],_0x4feeda[_0xc76d('0x2e')]);_0x2cf501['attributes']=_[_0xc76d('0x30')](_0x4feeda[_0xc76d('0x31')],qs[_0xc76d('0x32')](_0x1c68f3[_0xc76d('0x2e')][_0xc76d('0x32')]));_0x2cf501['attributes']=_0x2cf501[_0xc76d('0x33')][_0xc76d('0x34')]?_0x2cf501[_0xc76d('0x33')]:_0x4feeda['model'];if(!_0x1c68f3[_0xc76d('0x2e')][_0xc76d('0x35')](_0xc76d('0x36'))){_0x2cf501['limit']=qs[_0xc76d('0x1f')](_0x1c68f3[_0xc76d('0x2e')][_0xc76d('0x1f')]);_0x2cf501[_0xc76d('0x1c')]=qs[_0xc76d('0x1c')](_0x1c68f3[_0xc76d('0x2e')]['offset']);}_0x2cf501['order']=qs[_0xc76d('0x37')](_0x1c68f3['query'][_0xc76d('0x37')]);_0x2cf501[_0xc76d('0x38')]=qs[_0xc76d('0x39')](_[_0xc76d('0x3a')](_0x1c68f3['query'],_0x4feeda['filters']),_0x4a7e4c);if(_0x1c68f3[_0xc76d('0x2e')][_0xc76d('0x3b')]){_0x2cf501[_0xc76d('0x38')]=_[_0xc76d('0x3c')](_0x2cf501[_0xc76d('0x38')],{'$or':_['map'](_0x4a7e4c,function(_0x42404c){if(_0x42404c[_0xc76d('0x3d')]!==_0xc76d('0x3e')){var _0x405bc5={};_0x405bc5[_0x42404c[_0xc76d('0x2a')]]={'$like':'%'+_0x1c68f3[_0xc76d('0x2e')][_0xc76d('0x3b')]+'%'};return _0x405bc5;}})});}_0x2cf501=_[_0xc76d('0x3c')]({},_0x2cf501,_0x1c68f3[_0xc76d('0x3f')]);var _0x2b0c41={'where':_0x2cf501['where']};return db['Interval'][_0xc76d('0x1e')](_0x2b0c41)[_0xc76d('0x25')](function(_0x1e5118){_0x283e16[_0xc76d('0x1e')]=_0x1e5118;if(_0x1c68f3['query']['includeAll']){_0x2cf501[_0xc76d('0x40')]=[{'all':!![]}];}return db[_0xc76d('0x41')][_0xc76d('0x42')](_0x2cf501);})[_0xc76d('0x25')](function(_0x21c18f){_0x283e16[_0xc76d('0x43')]=_0x21c18f;return _0x283e16;})[_0xc76d('0x25')](respondWithFilteredResult(_0x9ab96c,_0x2cf501))[_0xc76d('0x44')](handleError(_0x9ab96c,null));};exports['show']=function(_0x7bf0,_0x95193f){var _0x1bf8a0={'raw':!![],'where':{'id':_0x7bf0['params']['id']}},_0x243af5={};_0x243af5['model']=_['keys'](db['Interval']['rawAttributes']);_0x243af5['query']=_['keys'](_0x7bf0[_0xc76d('0x2e')]);_0x243af5[_0xc76d('0x39')]=_[_0xc76d('0x30')](_0x243af5[_0xc76d('0x31')],_0x243af5[_0xc76d('0x2e')]);_0x1bf8a0[_0xc76d('0x33')]=_[_0xc76d('0x30')](_0x243af5[_0xc76d('0x31')],qs['fields'](_0x7bf0[_0xc76d('0x2e')][_0xc76d('0x32')]));_0x1bf8a0[_0xc76d('0x33')]=_0x1bf8a0[_0xc76d('0x33')][_0xc76d('0x34')]?_0x1bf8a0[_0xc76d('0x33')]:_0x243af5[_0xc76d('0x31')];if(_0x7bf0[_0xc76d('0x2e')][_0xc76d('0x45')]){_0x1bf8a0['include']=[{'all':!![]}];}_0x1bf8a0=_['merge']({},_0x1bf8a0,_0x7bf0[_0xc76d('0x3f')]);return db[_0xc76d('0x41')][_0xc76d('0x46')](_0x1bf8a0)[_0xc76d('0x25')](handleEntityNotFound(_0x95193f,null))[_0xc76d('0x25')](respondWithResult(_0x95193f,null))['catch'](handleError(_0x95193f,null));};exports[_0xc76d('0x47')]=function(_0x1ede13,_0x5e48fe){return db['Interval'][_0xc76d('0x47')](_0x1ede13[_0xc76d('0x48')],{})['then'](function(_0xe44a25){var _0x2d267e=_0x1ede13[_0xc76d('0x49')][_0xc76d('0x4a')]({'plain':!![]});if(!_0x2d267e)throw new Error(_0xc76d('0x4b'));if(_0x2d267e[_0xc76d('0x4c')]===_0xc76d('0x49')){var _0x10b1b0=_0xe44a25[_0xc76d('0x4a')]({'plain':!![]});var _0x1c3d46='Intervals';return db[_0xc76d('0x4d')][_0xc76d('0x46')]({'where':{'name':_0x1c3d46,'userProfileId':_0x2d267e[_0xc76d('0x4e')]},'raw':!![]})['then'](function(_0xbb9ef3){if(_0xbb9ef3&&_0xbb9ef3[_0xc76d('0x4f')]===0x0){return db['UserProfileResource'][_0xc76d('0x47')]({'name':_0x10b1b0['name'],'resourceId':_0x10b1b0['id'],'type':_0xbb9ef3[_0xc76d('0x2a')],'sectionId':_0xbb9ef3['id']},{})[_0xc76d('0x25')](function(){return _0xe44a25;});}else{return _0xe44a25;}})[_0xc76d('0x44')](function(_0x409bb3){logger[_0xc76d('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x409bb3);throw _0x409bb3;});}return _0xe44a25;})['then'](respondWithResult(_0x5e48fe,0xc9))['catch'](handleError(_0x5e48fe,null));};exports[_0xc76d('0x24')]=function(_0x746759,_0xe72796){if(_0x746759[_0xc76d('0x48')]['id']){delete _0x746759[_0xc76d('0x48')]['id'];}return db[_0xc76d('0x41')]['find']({'where':{'id':_0x746759[_0xc76d('0x51')]['id']}})[_0xc76d('0x25')](handleEntityNotFound(_0xe72796,null))[_0xc76d('0x25')](saveUpdates(_0x746759[_0xc76d('0x48')],null))[_0xc76d('0x25')](respondWithResult(_0xe72796,null))['catch'](handleError(_0xe72796,null));};exports[_0xc76d('0x28')]=function(_0x463cbe,_0x444017){return db[_0xc76d('0x41')][_0xc76d('0x46')]({'where':{'id':_0x463cbe[_0xc76d('0x51')]['id']}})['then'](handleEntityNotFound(_0x444017,null))[_0xc76d('0x25')](removeEntity(_0x444017,null))[_0xc76d('0x44')](handleError(_0x444017,null));};exports['addInterval']=function(_0x5f3973,_0x1e9461,_0x5ddcc6){if(_0x5f3973[_0xc76d('0x48')]['id']){delete _0x5f3973[_0xc76d('0x48')]['id'];}return db[_0xc76d('0x41')][_0xc76d('0x46')]({'where':{'id':_0x5f3973[_0xc76d('0x51')]['id']}})[_0xc76d('0x25')](handleEntityNotFound(_0x1e9461,null))[_0xc76d('0x25')](function(_0x1db7bc){if(_0x1db7bc){_0x5f3973[_0xc76d('0x48')][_0xc76d('0x52')]=_0x1db7bc['id'];return db[_0xc76d('0x41')][_0xc76d('0x47')](_0x5f3973[_0xc76d('0x48')]);}})[_0xc76d('0x25')](respondWithResult(_0x1e9461,null))['catch'](handleError(_0x1e9461,null));};exports[_0xc76d('0x53')]=function(_0xa0aa45,_0x460bcd,_0x2bcf90){var _0x10fd77={};var _0x5ce99d={};var _0x40e866;var _0xed98b5;return db['Interval']['findOne']({'where':{'id':_0xa0aa45['params']['id']}})[_0xc76d('0x25')](handleEntityNotFound(_0x460bcd,null))[_0xc76d('0x25')](function(_0x3b4a22){if(_0x3b4a22){_0x40e866=_0x3b4a22;_0x5ce99d[_0xc76d('0x31')]=_[_0xc76d('0x2f')](db[_0xc76d('0x41')][_0xc76d('0x2d')]);_0x5ce99d[_0xc76d('0x2e')]=_['keys'](_0xa0aa45[_0xc76d('0x2e')]);_0x5ce99d['filters']=_['intersection'](_0x5ce99d[_0xc76d('0x31')],_0x5ce99d[_0xc76d('0x2e')]);_0x10fd77[_0xc76d('0x33')]=_['intersection'](_0x5ce99d[_0xc76d('0x31')],qs['fields'](_0xa0aa45['query']['fields']));_0x10fd77[_0xc76d('0x33')]=_0x10fd77[_0xc76d('0x33')]['length']?_0x10fd77[_0xc76d('0x33')]:_0x5ce99d[_0xc76d('0x31')];_0x10fd77[_0xc76d('0x54')]=qs[_0xc76d('0x37')](_0xa0aa45[_0xc76d('0x2e')][_0xc76d('0x37')]);_0x10fd77[_0xc76d('0x38')]=qs['filters'](_['pick'](_0xa0aa45['query'],_0x5ce99d[_0xc76d('0x39')]));if(_0xa0aa45[_0xc76d('0x2e')][_0xc76d('0x3b')]){_0x10fd77[_0xc76d('0x38')]=_[_0xc76d('0x3c')](_0x10fd77['where'],{'$or':_[_0xc76d('0x2c')](_0x10fd77[_0xc76d('0x33')],function(_0x1d26ca){var _0x4159a0={};_0x4159a0[_0x1d26ca]={'$like':'%'+_0xa0aa45[_0xc76d('0x2e')][_0xc76d('0x3b')]+'%'};return _0x4159a0;})});}_0x10fd77=_[_0xc76d('0x3c')]({},_0x10fd77,_0xa0aa45[_0xc76d('0x3f')]);return _0x40e866['getIntervals'](_0x10fd77);}})[_0xc76d('0x25')](function(_0x4998ca){if(_0x4998ca){_0xed98b5=_0x4998ca[_0xc76d('0x34')];if(!_0xa0aa45[_0xc76d('0x2e')][_0xc76d('0x35')](_0xc76d('0x36'))){_0x10fd77['limit']=qs[_0xc76d('0x1f')](_0xa0aa45['query']['limit']);_0x10fd77[_0xc76d('0x1c')]=qs[_0xc76d('0x1c')](_0xa0aa45['query'][_0xc76d('0x1c')]);}return _0x40e866[_0xc76d('0x53')](_0x10fd77);}})['then'](function(_0x2b6ea1){if(_0x2b6ea1){return _0x2b6ea1?{'count':_0xed98b5,'rows':_0x2b6ea1}:null;}})[_0xc76d('0x25')](respondWithResult(_0x460bcd,null))['catch'](handleError(_0x460bcd,null));};exports[_0xc76d('0x55')]=function(_0x5e01b3,_0x2c2e71,_0x310a85){return db['Interval'][_0xc76d('0x56')]({'where':{'id':_0x5e01b3[_0xc76d('0x51')]['id']}})['then'](handleEntityNotFound(_0x2c2e71,null))[_0xc76d('0x25')](function(_0xc3e996){if(_0xc3e996){return db[_0xc76d('0x57')]['transaction'](function(_0x38db2c){return db['Interval']['destroy']({'where':{'IntervalId':_0x5e01b3[_0xc76d('0x51')]['id']},'transaction':_0x38db2c})[_0xc76d('0x25')](function(_0x559541){var _0x3ad0df=_[_0xc76d('0x2c')](_0x5e01b3[_0xc76d('0x48')],function(_0x3f338d){delete _0x3f338d['id'];_0x3f338d[_0xc76d('0x52')]=_0x5e01b3[_0xc76d('0x51')]['id'];return _0x3f338d;});return db[_0xc76d('0x41')][_0xc76d('0x58')](_0x3ad0df,{'transaction':_0x38db2c});});})[_0xc76d('0x25')](function(){return db[_0xc76d('0x41')][_0xc76d('0x42')]({'where':{'IntervalId':_0x5e01b3[_0xc76d('0x51')]['id']}});});}})[_0xc76d('0x25')](respondWithResult(_0x2c2e71,null))[_0xc76d('0x44')](handleError(_0x2c2e71,null));};
\ No newline at end of file