Built motion from commit 87cd5f02.|2.5.48
[motion2.git] / server / api / interval / interval.controller.js
index 784787c..417124b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xabf8=['addIntervals','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','addInterval','IntervalId','getIntervals','findOne','options','hasOwnProperty','nolimit'];(function(_0x5156bc,_0x1f909c){var _0x132f75=function(_0x4bd3a2){while(--_0x4bd3a2){_0x5156bc['push'](_0x5156bc['shift']());}};_0x132f75(++_0x1f909c);}(_0xabf8,0x11e));var _0x8abf=function(_0x2cb6cf,_0x35aeaf){_0x2cb6cf=_0x2cb6cf-0x0;var _0x14acc5=_0xabf8[_0x2cb6cf];return _0x14acc5;};'use strict';var pdf=require(_0x8abf('0x0'));var emlformat=require(_0x8abf('0x1'));var rimraf=require(_0x8abf('0x2'));var zipdir=require(_0x8abf('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8abf('0x4'));var moment=require('moment');var BPromise=require(_0x8abf('0x5'));var Mustache=require(_0x8abf('0x6'));var util=require(_0x8abf('0x7'));var path=require(_0x8abf('0x8'));var sox=require(_0x8abf('0x9'));var csv=require('to-csv');var ejs=require(_0x8abf('0xa'));var fs=require('fs');var _=require(_0x8abf('0xb'));var squel=require(_0x8abf('0xc'));var crypto=require(_0x8abf('0xd'));var jsforce=require(_0x8abf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8abf('0xf'));var querystring=require('querystring');var Papa=require(_0x8abf('0x10'));var Redis=require(_0x8abf('0x11'));var authService=require(_0x8abf('0x12'));var qs=require(_0x8abf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8abf('0x14'));var logger=require('../../config/logger')(_0x8abf('0x15'));var utils=require(_0x8abf('0x16'));var config=require(_0x8abf('0x17'));var licenseUtil=require(_0x8abf('0x18'));var db=require(_0x8abf('0x19'))['db'];var extensions=require(_0x8abf('0x1a'));function respondWithStatusCode(_0x49291b,_0x20dd14){_0x20dd14=_0x20dd14||0xcc;return function(_0x37b140){if(_0x37b140){return _0x49291b['sendStatus'](_0x20dd14);}return _0x49291b[_0x8abf('0x1b')](_0x20dd14)[_0x8abf('0x1c')]();};}function respondWithResult(_0x1c0649,_0x274ed4){_0x274ed4=_0x274ed4||0xc8;return function(_0x3bb35a){if(_0x3bb35a){return _0x1c0649[_0x8abf('0x1b')](_0x274ed4)[_0x8abf('0x1d')](_0x3bb35a);}};}function respondWithFilteredResult(_0x462150,_0xe5081b){return function(_0x30f833){if(_0x30f833){var _0x55e4ac=_0x30f833[_0x8abf('0x1e')],_0x5a3576=_0xe5081b[_0x8abf('0x1f')],_0xdb0e8e=_0xe5081b[_0x8abf('0x1f')]+_0xe5081b[_0x8abf('0x20')],_0x4a9dca;if(_0xdb0e8e>=_0x55e4ac){_0xdb0e8e=_0x55e4ac;_0x4a9dca=0xc8;}else{_0x4a9dca=0xce;}_0x462150[_0x8abf('0x1b')](_0x4a9dca);return _0x462150[_0x8abf('0x21')](_0x8abf('0x22'),_0x5a3576+'-'+_0xdb0e8e+'/'+_0x55e4ac)[_0x8abf('0x1d')](_0x30f833);}return null;};}function patchUpdates(_0x3889f7){return function(_0xaae1b9){try{jsonpatch['apply'](_0xaae1b9,_0x3889f7,!![]);}catch(_0x57d54a){return BPromise['reject'](_0x57d54a);}return _0xaae1b9[_0x8abf('0x23')]();};}function saveUpdates(_0x53a9a4,_0x7ee9a1){return function(_0x44e00f){if(_0x44e00f){return _0x44e00f[_0x8abf('0x24')](_0x53a9a4)[_0x8abf('0x25')](function(_0x1c3b55){return _0x1c3b55;});}return null;};}function removeEntity(_0x1db45b,_0x5061f8){return function(_0x2af71d){if(_0x2af71d){return _0x2af71d[_0x8abf('0x26')]()[_0x8abf('0x25')](function(){var _0x598d15=_0x2af71d[_0x8abf('0x27')]({'plain':!![]});var _0x5e6b89=_0x8abf('0x28');return db[_0x8abf('0x29')][_0x8abf('0x26')]({'where':{'type':_0x5e6b89,'resourceId':_0x598d15['id']}})['then'](function(){return _0x2af71d;});})[_0x8abf('0x25')](function(){_0x1db45b[_0x8abf('0x1b')](0xcc)[_0x8abf('0x1c')]();});}};}function handleEntityNotFound(_0xbe6de,_0x5e18c3){return function(_0x9934dd){if(!_0x9934dd){_0xbe6de['sendStatus'](0x194);}return _0x9934dd;};}function handleError(_0x302a57,_0xca7954){_0xca7954=_0xca7954||0x1f4;return function(_0x257e7e){logger[_0x8abf('0x2a')](_0x257e7e[_0x8abf('0x2b')]);if(_0x257e7e['name']){delete _0x257e7e[_0x8abf('0x2c')];}_0x302a57[_0x8abf('0x1b')](_0xca7954)[_0x8abf('0x2d')](_0x257e7e);};}exports[_0x8abf('0x2e')]=function(_0x4e2eaa,_0x9b7baf){var _0x161c04={},_0x55f496={},_0x46f29e={'count':0x0,'rows':[]};var _0x3e7722=_[_0x8abf('0x2f')](db[_0x8abf('0x30')][_0x8abf('0x31')],function(_0x2f6c02){return{'name':_0x2f6c02[_0x8abf('0x32')],'type':_0x2f6c02[_0x8abf('0x33')]['key']};});_0x55f496[_0x8abf('0x34')]=_[_0x8abf('0x2f')](_0x3e7722,'name');_0x55f496[_0x8abf('0x35')]=_[_0x8abf('0x36')](_0x4e2eaa[_0x8abf('0x35')]);_0x55f496[_0x8abf('0x37')]=_[_0x8abf('0x38')](_0x55f496[_0x8abf('0x34')],_0x55f496[_0x8abf('0x35')]);_0x161c04[_0x8abf('0x39')]=_['intersection'](_0x55f496[_0x8abf('0x34')],qs['fields'](_0x4e2eaa['query'][_0x8abf('0x3a')]));_0x161c04['attributes']=_0x161c04[_0x8abf('0x39')][_0x8abf('0x3b')]?_0x161c04[_0x8abf('0x39')]:_0x55f496[_0x8abf('0x34')];if(!_0x4e2eaa[_0x8abf('0x35')]['hasOwnProperty']('nolimit')){_0x161c04[_0x8abf('0x20')]=qs['limit'](_0x4e2eaa[_0x8abf('0x35')][_0x8abf('0x20')]);_0x161c04['offset']=qs[_0x8abf('0x1f')](_0x4e2eaa[_0x8abf('0x35')][_0x8abf('0x1f')]);}_0x161c04[_0x8abf('0x3c')]=qs[_0x8abf('0x3d')](_0x4e2eaa[_0x8abf('0x35')][_0x8abf('0x3d')]);_0x161c04[_0x8abf('0x3e')]=qs[_0x8abf('0x37')](_[_0x8abf('0x3f')](_0x4e2eaa[_0x8abf('0x35')],_0x55f496['filters']),_0x3e7722);if(_0x4e2eaa[_0x8abf('0x35')][_0x8abf('0x40')]){_0x161c04['where']=_[_0x8abf('0x41')](_0x161c04[_0x8abf('0x3e')],{'$or':_[_0x8abf('0x2f')](_0x3e7722,function(_0x13b75f){if(_0x13b75f[_0x8abf('0x33')]!==_0x8abf('0x42')){var _0x2d3820={};_0x2d3820[_0x13b75f[_0x8abf('0x2c')]]={'$like':'%'+_0x4e2eaa[_0x8abf('0x35')][_0x8abf('0x40')]+'%'};return _0x2d3820;}})});}_0x161c04=_[_0x8abf('0x41')]({},_0x161c04,_0x4e2eaa['options']);var _0xfd3ba6={'where':_0x161c04[_0x8abf('0x3e')]};return db['Interval']['count'](_0xfd3ba6)['then'](function(_0x138fb2){_0x46f29e[_0x8abf('0x1e')]=_0x138fb2;if(_0x4e2eaa[_0x8abf('0x35')][_0x8abf('0x43')]){_0x161c04[_0x8abf('0x44')]=[{'all':!![]}];}return db[_0x8abf('0x30')][_0x8abf('0x45')](_0x161c04);})[_0x8abf('0x25')](function(_0x9a0d3d){_0x46f29e[_0x8abf('0x46')]=_0x9a0d3d;return _0x46f29e;})[_0x8abf('0x25')](respondWithFilteredResult(_0x9b7baf,_0x161c04))['catch'](handleError(_0x9b7baf,null));};exports[_0x8abf('0x47')]=function(_0x141f88,_0x3a8495){var _0x30f520={'raw':!![],'where':{'id':_0x141f88[_0x8abf('0x48')]['id']}},_0x103b94={};_0x103b94[_0x8abf('0x34')]=_[_0x8abf('0x36')](db[_0x8abf('0x30')][_0x8abf('0x31')]);_0x103b94[_0x8abf('0x35')]=_[_0x8abf('0x36')](_0x141f88['query']);_0x103b94[_0x8abf('0x37')]=_['intersection'](_0x103b94['model'],_0x103b94[_0x8abf('0x35')]);_0x30f520[_0x8abf('0x39')]=_[_0x8abf('0x38')](_0x103b94['model'],qs[_0x8abf('0x3a')](_0x141f88['query']['fields']));_0x30f520[_0x8abf('0x39')]=_0x30f520[_0x8abf('0x39')][_0x8abf('0x3b')]?_0x30f520[_0x8abf('0x39')]:_0x103b94['model'];if(_0x141f88[_0x8abf('0x35')][_0x8abf('0x43')]){_0x30f520[_0x8abf('0x44')]=[{'all':!![]}];}_0x30f520=_[_0x8abf('0x41')]({},_0x30f520,_0x141f88['options']);return db[_0x8abf('0x30')]['find'](_0x30f520)[_0x8abf('0x25')](handleEntityNotFound(_0x3a8495,null))[_0x8abf('0x25')](respondWithResult(_0x3a8495,null))['catch'](handleError(_0x3a8495,null));};exports[_0x8abf('0x49')]=function(_0x14d86c,_0x205000){return db[_0x8abf('0x30')][_0x8abf('0x49')](_0x14d86c[_0x8abf('0x4a')],{})[_0x8abf('0x25')](function(_0x3a5990){var _0x4dcbd0=_0x14d86c[_0x8abf('0x4b')][_0x8abf('0x27')]({'plain':!![]});if(!_0x4dcbd0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4dcbd0[_0x8abf('0x4c')]===_0x8abf('0x4b')){var _0x157fd4=_0x3a5990[_0x8abf('0x27')]({'plain':!![]});var _0x14014c=_0x8abf('0x28');return db[_0x8abf('0x4d')][_0x8abf('0x4e')]({'where':{'name':_0x14014c,'userProfileId':_0x4dcbd0[_0x8abf('0x4f')]},'raw':!![]})[_0x8abf('0x25')](function(_0x439cc2){if(_0x439cc2&&_0x439cc2[_0x8abf('0x50')]===0x0){return db[_0x8abf('0x29')]['create']({'name':_0x157fd4[_0x8abf('0x2c')],'resourceId':_0x157fd4['id'],'type':_0x439cc2[_0x8abf('0x2c')],'sectionId':_0x439cc2['id']},{})[_0x8abf('0x25')](function(){return _0x3a5990;});}else{return _0x3a5990;}})['catch'](function(_0xe146a8){logger[_0x8abf('0x2a')](_0x8abf('0x51'),_0xe146a8);throw _0xe146a8;});}return _0x3a5990;})[_0x8abf('0x25')](respondWithResult(_0x205000,0xc9))['catch'](handleError(_0x205000,null));};exports['update']=function(_0x5c599b,_0x1dd027){if(_0x5c599b[_0x8abf('0x4a')]['id']){delete _0x5c599b[_0x8abf('0x4a')]['id'];}return db['Interval'][_0x8abf('0x4e')]({'where':{'id':_0x5c599b[_0x8abf('0x48')]['id']}})['then'](handleEntityNotFound(_0x1dd027,null))['then'](saveUpdates(_0x5c599b[_0x8abf('0x4a')],null))[_0x8abf('0x25')](respondWithResult(_0x1dd027,null))[_0x8abf('0x52')](handleError(_0x1dd027,null));};exports[_0x8abf('0x26')]=function(_0x4ca4fd,_0x1b6efb){return db[_0x8abf('0x30')]['find']({'where':{'id':_0x4ca4fd[_0x8abf('0x48')]['id']}})[_0x8abf('0x25')](handleEntityNotFound(_0x1b6efb,null))['then'](removeEntity(_0x1b6efb,null))[_0x8abf('0x52')](handleError(_0x1b6efb,null));};exports[_0x8abf('0x53')]=function(_0xf438d2,_0x48aaea,_0x309a67){if(_0xf438d2['body']['id']){delete _0xf438d2[_0x8abf('0x4a')]['id'];}return db[_0x8abf('0x30')]['find']({'where':{'id':_0xf438d2[_0x8abf('0x48')]['id']}})[_0x8abf('0x25')](handleEntityNotFound(_0x48aaea,null))[_0x8abf('0x25')](function(_0xf82e5b){if(_0xf82e5b){_0xf438d2['body'][_0x8abf('0x54')]=_0xf82e5b['id'];return db[_0x8abf('0x30')][_0x8abf('0x49')](_0xf438d2[_0x8abf('0x4a')]);}})['then'](respondWithResult(_0x48aaea,null))['catch'](handleError(_0x48aaea,null));};exports[_0x8abf('0x55')]=function(_0x17613b,_0x285b6f,_0x43874e){var _0x26a90d={};var _0x5e4e3e={};var _0x12f3e0;var _0x481247;return db['Interval'][_0x8abf('0x56')]({'where':{'id':_0x17613b[_0x8abf('0x48')]['id']}})[_0x8abf('0x25')](handleEntityNotFound(_0x285b6f,null))[_0x8abf('0x25')](function(_0x1a6bbc){if(_0x1a6bbc){_0x12f3e0=_0x1a6bbc;_0x5e4e3e[_0x8abf('0x34')]=_[_0x8abf('0x36')](db[_0x8abf('0x30')][_0x8abf('0x31')]);_0x5e4e3e[_0x8abf('0x35')]=_[_0x8abf('0x36')](_0x17613b[_0x8abf('0x35')]);_0x5e4e3e['filters']=_[_0x8abf('0x38')](_0x5e4e3e[_0x8abf('0x34')],_0x5e4e3e[_0x8abf('0x35')]);_0x26a90d[_0x8abf('0x39')]=_[_0x8abf('0x38')](_0x5e4e3e[_0x8abf('0x34')],qs[_0x8abf('0x3a')](_0x17613b[_0x8abf('0x35')][_0x8abf('0x3a')]));_0x26a90d[_0x8abf('0x39')]=_0x26a90d[_0x8abf('0x39')][_0x8abf('0x3b')]?_0x26a90d[_0x8abf('0x39')]:_0x5e4e3e[_0x8abf('0x34')];_0x26a90d[_0x8abf('0x3c')]=qs[_0x8abf('0x3d')](_0x17613b['query'][_0x8abf('0x3d')]);_0x26a90d[_0x8abf('0x3e')]=qs['filters'](_['pick'](_0x17613b[_0x8abf('0x35')],_0x5e4e3e[_0x8abf('0x37')]));if(_0x17613b[_0x8abf('0x35')][_0x8abf('0x40')]){_0x26a90d[_0x8abf('0x3e')]=_[_0x8abf('0x41')](_0x26a90d[_0x8abf('0x3e')],{'$or':_['map'](_0x26a90d[_0x8abf('0x39')],function(_0x3f94e1){var _0x10285a={};_0x10285a[_0x3f94e1]={'$like':'%'+_0x17613b['query']['filter']+'%'};return _0x10285a;})});}_0x26a90d=_[_0x8abf('0x41')]({},_0x26a90d,_0x17613b[_0x8abf('0x57')]);return _0x12f3e0[_0x8abf('0x55')](_0x26a90d);}})[_0x8abf('0x25')](function(_0x552dcb){if(_0x552dcb){_0x481247=_0x552dcb[_0x8abf('0x3b')];if(!_0x17613b[_0x8abf('0x35')][_0x8abf('0x58')](_0x8abf('0x59'))){_0x26a90d['limit']=qs[_0x8abf('0x20')](_0x17613b[_0x8abf('0x35')][_0x8abf('0x20')]);_0x26a90d[_0x8abf('0x1f')]=qs['offset'](_0x17613b[_0x8abf('0x35')][_0x8abf('0x1f')]);}return _0x12f3e0['getIntervals'](_0x26a90d);}})[_0x8abf('0x25')](function(_0xe4f506){if(_0xe4f506){return _0xe4f506?{'count':_0x481247,'rows':_0xe4f506}:null;}})[_0x8abf('0x25')](respondWithResult(_0x285b6f,null))[_0x8abf('0x52')](handleError(_0x285b6f,null));};exports[_0x8abf('0x5a')]=function(_0xfc075,_0x52061f,_0xe22800){return db['Interval'][_0x8abf('0x56')]({'where':{'id':_0xfc075['params']['id']}})[_0x8abf('0x25')](handleEntityNotFound(_0x52061f,null))['then'](function(_0x49cfd3){if(_0x49cfd3){return db[_0x8abf('0x5b')][_0x8abf('0x5c')](function(_0x341eed){return db[_0x8abf('0x30')]['destroy']({'where':{'IntervalId':_0xfc075[_0x8abf('0x48')]['id']},'transaction':_0x341eed})[_0x8abf('0x25')](function(_0x1036d5){var _0x30e1af=_[_0x8abf('0x2f')](_0xfc075[_0x8abf('0x4a')],function(_0x2821c2){delete _0x2821c2['id'];_0x2821c2[_0x8abf('0x54')]=_0xfc075[_0x8abf('0x48')]['id'];return _0x2821c2;});return db['Interval'][_0x8abf('0x5d')](_0x30e1af,{'transaction':_0x341eed});});})[_0x8abf('0x25')](function(){return db[_0x8abf('0x30')][_0x8abf('0x45')]({'where':{'IntervalId':_0xfc075['params']['id']}});});}})['then'](respondWithResult(_0x52061f,null))[_0x8abf('0x52')](handleError(_0x52061f,null));};
\ No newline at end of file
+var _0xd4b7=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','getIntervals','findOne','addIntervals','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv'];(function(_0x51b2e8,_0x1f8bbe){var _0x2ec121=function(_0x1ca18c){while(--_0x1ca18c){_0x51b2e8['push'](_0x51b2e8['shift']());}};_0x2ec121(++_0x1f8bbe);}(_0xd4b7,0xb8));var _0x7d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7d4b('0x0'));var rimraf=require(_0x7d4b('0x1'));var zipdir=require(_0x7d4b('0x2'));var jsonpatch=require(_0x7d4b('0x3'));var rp=require(_0x7d4b('0x4'));var moment=require(_0x7d4b('0x5'));var BPromise=require(_0x7d4b('0x6'));var Mustache=require('mustache');var util=require(_0x7d4b('0x7'));var path=require('path');var sox=require(_0x7d4b('0x8'));var csv=require(_0x7d4b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d4b('0xa'));var _=require(_0x7d4b('0xb'));var squel=require(_0x7d4b('0xc'));var crypto=require(_0x7d4b('0xd'));var jsforce=require(_0x7d4b('0xe'));var deskjs=require(_0x7d4b('0xf'));var toCsv=require(_0x7d4b('0x9'));var querystring=require(_0x7d4b('0x10'));var Papa=require('papaparse');var Redis=require(_0x7d4b('0x11'));var authService=require(_0x7d4b('0x12'));var qs=require(_0x7d4b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d4b('0x14'));var logger=require(_0x7d4b('0x15'))('api');var utils=require(_0x7d4b('0x16'));var config=require(_0x7d4b('0x17'));var licenseUtil=require(_0x7d4b('0x18'));var db=require(_0x7d4b('0x19'))['db'];var extensions=require(_0x7d4b('0x1a'));function respondWithStatusCode(_0x281a38,_0xa41256){_0xa41256=_0xa41256||0xcc;return function(_0x3ca829){if(_0x3ca829){return _0x281a38[_0x7d4b('0x1b')](_0xa41256);}return _0x281a38[_0x7d4b('0x1c')](_0xa41256)[_0x7d4b('0x1d')]();};}function respondWithResult(_0x1eef30,_0x50428a){_0x50428a=_0x50428a||0xc8;return function(_0x5c47f0){if(_0x5c47f0){return _0x1eef30[_0x7d4b('0x1c')](_0x50428a)[_0x7d4b('0x1e')](_0x5c47f0);}};}function respondWithFilteredResult(_0x4542ce,_0x35d9a0){return function(_0x5c3687){if(_0x5c3687){var _0x587f22=typeof _0x35d9a0[_0x7d4b('0x1f')]===_0x7d4b('0x20')&&typeof _0x35d9a0[_0x7d4b('0x21')]==='undefined';var _0x20b621=_0x5c3687['count'];var _0x5b7ddf=_0x587f22?0x0:_0x35d9a0[_0x7d4b('0x1f')];var _0x5b0389=_0x587f22?_0x5c3687[_0x7d4b('0x22')]:_0x35d9a0['offset']+_0x35d9a0[_0x7d4b('0x21')];var _0x9d703a;if(_0x5b0389>=_0x20b621){_0x5b0389=_0x20b621;_0x9d703a=0xc8;}else{_0x9d703a=0xce;}_0x4542ce[_0x7d4b('0x1c')](_0x9d703a);return _0x4542ce[_0x7d4b('0x23')](_0x7d4b('0x24'),_0x5b7ddf+'-'+_0x5b0389+'/'+_0x20b621)[_0x7d4b('0x1e')](_0x5c3687);}return null;};}function patchUpdates(_0x545f02){return function(_0x21a2d3){try{jsonpatch[_0x7d4b('0x25')](_0x21a2d3,_0x545f02,!![]);}catch(_0x33192f){return BPromise[_0x7d4b('0x26')](_0x33192f);}return _0x21a2d3[_0x7d4b('0x27')]();};}function saveUpdates(_0x14e3fe,_0x992f95){return function(_0x506d04){if(_0x506d04){return _0x506d04[_0x7d4b('0x28')](_0x14e3fe)[_0x7d4b('0x29')](function(_0x1a2939){return _0x1a2939;});}return null;};}function removeEntity(_0xfa7f6c,_0x516705){return function(_0x45cee9){if(_0x45cee9){return _0x45cee9[_0x7d4b('0x2a')]()[_0x7d4b('0x29')](function(){var _0x4869a9=_0x45cee9[_0x7d4b('0x2b')]({'plain':!![]});var _0x2c3730=_0x7d4b('0x2c');return db[_0x7d4b('0x2d')][_0x7d4b('0x2a')]({'where':{'type':_0x2c3730,'resourceId':_0x4869a9['id']}})['then'](function(){return _0x45cee9;});})['then'](function(){_0xfa7f6c[_0x7d4b('0x1c')](0xcc)[_0x7d4b('0x1d')]();});}};}function handleEntityNotFound(_0x365f12,_0x27be55){return function(_0x2011ff){if(!_0x2011ff){_0x365f12[_0x7d4b('0x1b')](0x194);}return _0x2011ff;};}function handleError(_0x1d58fb,_0x31d77f){_0x31d77f=_0x31d77f||0x1f4;return function(_0x3e555c){logger[_0x7d4b('0x2e')](_0x3e555c[_0x7d4b('0x2f')]);if(_0x3e555c[_0x7d4b('0x30')]){delete _0x3e555c[_0x7d4b('0x30')];}_0x1d58fb[_0x7d4b('0x1c')](_0x31d77f)[_0x7d4b('0x31')](_0x3e555c);};}exports[_0x7d4b('0x32')]=function(_0x1f6150,_0x2e0acb){var _0x4a2c37={},_0x276400={},_0x2fac00={'count':0x0,'rows':[]};var _0x47da2a=_[_0x7d4b('0x33')](db[_0x7d4b('0x34')][_0x7d4b('0x35')],function(_0x4dab89){return{'name':_0x4dab89[_0x7d4b('0x36')],'type':_0x4dab89[_0x7d4b('0x37')][_0x7d4b('0x38')]};});_0x276400[_0x7d4b('0x39')]=_[_0x7d4b('0x33')](_0x47da2a,'name');_0x276400[_0x7d4b('0x3a')]=_[_0x7d4b('0x3b')](_0x1f6150[_0x7d4b('0x3a')]);_0x276400[_0x7d4b('0x3c')]=_['intersection'](_0x276400['model'],_0x276400[_0x7d4b('0x3a')]);_0x4a2c37[_0x7d4b('0x3d')]=_[_0x7d4b('0x3e')](_0x276400[_0x7d4b('0x39')],qs[_0x7d4b('0x3f')](_0x1f6150[_0x7d4b('0x3a')][_0x7d4b('0x3f')]));_0x4a2c37['attributes']=_0x4a2c37['attributes'][_0x7d4b('0x40')]?_0x4a2c37[_0x7d4b('0x3d')]:_0x276400[_0x7d4b('0x39')];if(!_0x1f6150['query'][_0x7d4b('0x41')](_0x7d4b('0x42'))){_0x4a2c37[_0x7d4b('0x21')]=qs['limit'](_0x1f6150['query']['limit']);_0x4a2c37['offset']=qs[_0x7d4b('0x1f')](_0x1f6150[_0x7d4b('0x3a')][_0x7d4b('0x1f')]);}_0x4a2c37[_0x7d4b('0x43')]=qs['sort'](_0x1f6150[_0x7d4b('0x3a')][_0x7d4b('0x44')]);_0x4a2c37['where']=qs[_0x7d4b('0x3c')](_[_0x7d4b('0x45')](_0x1f6150['query'],_0x276400['filters']),_0x47da2a);if(_0x1f6150[_0x7d4b('0x3a')][_0x7d4b('0x46')]){_0x4a2c37[_0x7d4b('0x47')]=_[_0x7d4b('0x48')](_0x4a2c37['where'],{'$or':_[_0x7d4b('0x33')](_0x47da2a,function(_0x447fc6){if(_0x447fc6[_0x7d4b('0x37')]!==_0x7d4b('0x49')){var _0x1b62bf={};_0x1b62bf[_0x447fc6['name']]={'$like':'%'+_0x1f6150[_0x7d4b('0x3a')][_0x7d4b('0x46')]+'%'};return _0x1b62bf;}})});}_0x4a2c37=_['merge']({},_0x4a2c37,_0x1f6150[_0x7d4b('0x4a')]);var _0x59c138={'where':_0x4a2c37[_0x7d4b('0x47')]};return db['Interval'][_0x7d4b('0x22')](_0x59c138)[_0x7d4b('0x29')](function(_0x506f67){_0x2fac00[_0x7d4b('0x22')]=_0x506f67;if(_0x1f6150[_0x7d4b('0x3a')][_0x7d4b('0x4b')]){_0x4a2c37[_0x7d4b('0x4c')]=[{'all':!![]}];}return db[_0x7d4b('0x34')][_0x7d4b('0x4d')](_0x4a2c37);})[_0x7d4b('0x29')](function(_0x518478){_0x2fac00[_0x7d4b('0x4e')]=_0x518478;return _0x2fac00;})['then'](respondWithFilteredResult(_0x2e0acb,_0x4a2c37))[_0x7d4b('0x4f')](handleError(_0x2e0acb,null));};exports['show']=function(_0x3609be,_0x3f0f79){var _0x13d213={'raw':!![],'where':{'id':_0x3609be['params']['id']}},_0x578717={};_0x578717['model']=_[_0x7d4b('0x3b')](db[_0x7d4b('0x34')]['rawAttributes']);_0x578717['query']=_[_0x7d4b('0x3b')](_0x3609be[_0x7d4b('0x3a')]);_0x578717[_0x7d4b('0x3c')]=_[_0x7d4b('0x3e')](_0x578717[_0x7d4b('0x39')],_0x578717[_0x7d4b('0x3a')]);_0x13d213[_0x7d4b('0x3d')]=_[_0x7d4b('0x3e')](_0x578717[_0x7d4b('0x39')],qs[_0x7d4b('0x3f')](_0x3609be['query']['fields']));_0x13d213[_0x7d4b('0x3d')]=_0x13d213[_0x7d4b('0x3d')][_0x7d4b('0x40')]?_0x13d213['attributes']:_0x578717[_0x7d4b('0x39')];if(_0x3609be['query'][_0x7d4b('0x4b')]){_0x13d213[_0x7d4b('0x4c')]=[{'all':!![]}];}_0x13d213=_[_0x7d4b('0x48')]({},_0x13d213,_0x3609be['options']);return db[_0x7d4b('0x34')][_0x7d4b('0x50')](_0x13d213)[_0x7d4b('0x29')](handleEntityNotFound(_0x3f0f79,null))['then'](respondWithResult(_0x3f0f79,null))[_0x7d4b('0x4f')](handleError(_0x3f0f79,null));};exports['create']=function(_0x30929f,_0x2c1bcb){return db[_0x7d4b('0x34')][_0x7d4b('0x51')](_0x30929f[_0x7d4b('0x52')],{})[_0x7d4b('0x29')](function(_0x173a97){var _0x4a05a6=_0x30929f[_0x7d4b('0x53')]['get']({'plain':!![]});if(!_0x4a05a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a05a6[_0x7d4b('0x54')]==='user'){var _0x258a36=_0x173a97[_0x7d4b('0x2b')]({'plain':!![]});var _0x207ac6=_0x7d4b('0x2c');return db[_0x7d4b('0x55')]['find']({'where':{'name':_0x207ac6,'userProfileId':_0x4a05a6[_0x7d4b('0x56')]},'raw':!![]})[_0x7d4b('0x29')](function(_0xdb1adc){if(_0xdb1adc&&_0xdb1adc[_0x7d4b('0x57')]===0x0){return db[_0x7d4b('0x2d')][_0x7d4b('0x51')]({'name':_0x258a36[_0x7d4b('0x30')],'resourceId':_0x258a36['id'],'type':_0xdb1adc['name'],'sectionId':_0xdb1adc['id']},{})[_0x7d4b('0x29')](function(){return _0x173a97;});}else{return _0x173a97;}})[_0x7d4b('0x4f')](function(_0x371845){logger[_0x7d4b('0x2e')](_0x7d4b('0x58'),_0x371845);throw _0x371845;});}return _0x173a97;})[_0x7d4b('0x29')](respondWithResult(_0x2c1bcb,0xc9))[_0x7d4b('0x4f')](handleError(_0x2c1bcb,null));};exports['update']=function(_0x3c7edb,_0x1f6c77){if(_0x3c7edb[_0x7d4b('0x52')]['id']){delete _0x3c7edb[_0x7d4b('0x52')]['id'];}return db['Interval'][_0x7d4b('0x50')]({'where':{'id':_0x3c7edb[_0x7d4b('0x59')]['id']}})[_0x7d4b('0x29')](handleEntityNotFound(_0x1f6c77,null))[_0x7d4b('0x29')](saveUpdates(_0x3c7edb[_0x7d4b('0x52')],null))[_0x7d4b('0x29')](respondWithResult(_0x1f6c77,null))[_0x7d4b('0x4f')](handleError(_0x1f6c77,null));};exports[_0x7d4b('0x2a')]=function(_0x18b19a,_0x2b5d8d){return db[_0x7d4b('0x34')]['find']({'where':{'id':_0x18b19a[_0x7d4b('0x59')]['id']}})[_0x7d4b('0x29')](handleEntityNotFound(_0x2b5d8d,null))[_0x7d4b('0x29')](removeEntity(_0x2b5d8d,null))[_0x7d4b('0x4f')](handleError(_0x2b5d8d,null));};exports[_0x7d4b('0x5a')]=function(_0x375a55,_0x119304,_0x477524){if(_0x375a55[_0x7d4b('0x52')]['id']){delete _0x375a55[_0x7d4b('0x52')]['id'];}return db['Interval']['find']({'where':{'id':_0x375a55[_0x7d4b('0x59')]['id']}})[_0x7d4b('0x29')](handleEntityNotFound(_0x119304,null))['then'](function(_0x5a86fa){if(_0x5a86fa){_0x375a55[_0x7d4b('0x52')][_0x7d4b('0x5b')]=_0x5a86fa['id'];return db[_0x7d4b('0x34')][_0x7d4b('0x51')](_0x375a55[_0x7d4b('0x52')]);}})[_0x7d4b('0x29')](respondWithResult(_0x119304,null))[_0x7d4b('0x4f')](handleError(_0x119304,null));};exports[_0x7d4b('0x5c')]=function(_0x185edf,_0xa873d4,_0x1d1515){var _0x1550ea={};var _0x2e4974={};var _0x55b80a;var _0x38c601;return db[_0x7d4b('0x34')][_0x7d4b('0x5d')]({'where':{'id':_0x185edf[_0x7d4b('0x59')]['id']}})[_0x7d4b('0x29')](handleEntityNotFound(_0xa873d4,null))[_0x7d4b('0x29')](function(_0x1e7496){if(_0x1e7496){_0x55b80a=_0x1e7496;_0x2e4974[_0x7d4b('0x39')]=_[_0x7d4b('0x3b')](db[_0x7d4b('0x34')][_0x7d4b('0x35')]);_0x2e4974[_0x7d4b('0x3a')]=_[_0x7d4b('0x3b')](_0x185edf[_0x7d4b('0x3a')]);_0x2e4974[_0x7d4b('0x3c')]=_[_0x7d4b('0x3e')](_0x2e4974[_0x7d4b('0x39')],_0x2e4974[_0x7d4b('0x3a')]);_0x1550ea[_0x7d4b('0x3d')]=_[_0x7d4b('0x3e')](_0x2e4974[_0x7d4b('0x39')],qs[_0x7d4b('0x3f')](_0x185edf[_0x7d4b('0x3a')][_0x7d4b('0x3f')]));_0x1550ea[_0x7d4b('0x3d')]=_0x1550ea['attributes'][_0x7d4b('0x40')]?_0x1550ea[_0x7d4b('0x3d')]:_0x2e4974[_0x7d4b('0x39')];_0x1550ea[_0x7d4b('0x43')]=qs[_0x7d4b('0x44')](_0x185edf['query'][_0x7d4b('0x44')]);_0x1550ea[_0x7d4b('0x47')]=qs[_0x7d4b('0x3c')](_[_0x7d4b('0x45')](_0x185edf[_0x7d4b('0x3a')],_0x2e4974['filters']));if(_0x185edf['query']['filter']){_0x1550ea[_0x7d4b('0x47')]=_[_0x7d4b('0x48')](_0x1550ea['where'],{'$or':_[_0x7d4b('0x33')](_0x1550ea[_0x7d4b('0x3d')],function(_0x386de1){var _0x222559={};_0x222559[_0x386de1]={'$like':'%'+_0x185edf[_0x7d4b('0x3a')][_0x7d4b('0x46')]+'%'};return _0x222559;})});}_0x1550ea=_[_0x7d4b('0x48')]({},_0x1550ea,_0x185edf['options']);return _0x55b80a[_0x7d4b('0x5c')](_0x1550ea);}})[_0x7d4b('0x29')](function(_0x5831a0){if(_0x5831a0){_0x38c601=_0x5831a0['length'];if(!_0x185edf[_0x7d4b('0x3a')]['hasOwnProperty'](_0x7d4b('0x42'))){_0x1550ea['limit']=qs[_0x7d4b('0x21')](_0x185edf[_0x7d4b('0x3a')][_0x7d4b('0x21')]);_0x1550ea[_0x7d4b('0x1f')]=qs[_0x7d4b('0x1f')](_0x185edf[_0x7d4b('0x3a')]['offset']);}return _0x55b80a['getIntervals'](_0x1550ea);}})[_0x7d4b('0x29')](function(_0xeea4d8){if(_0xeea4d8){return _0xeea4d8?{'count':_0x38c601,'rows':_0xeea4d8}:null;}})[_0x7d4b('0x29')](respondWithResult(_0xa873d4,null))[_0x7d4b('0x4f')](handleError(_0xa873d4,null));};exports[_0x7d4b('0x5e')]=function(_0x3d8ea3,_0x2a9d5a,_0x155000){return db['Interval'][_0x7d4b('0x5d')]({'where':{'id':_0x3d8ea3[_0x7d4b('0x59')]['id']}})[_0x7d4b('0x29')](handleEntityNotFound(_0x2a9d5a,null))['then'](function(_0x53c426){if(_0x53c426){return db['sequelize'][_0x7d4b('0x5f')](function(_0x385e8f){return db['Interval'][_0x7d4b('0x2a')]({'where':{'IntervalId':_0x3d8ea3[_0x7d4b('0x59')]['id']},'transaction':_0x385e8f})[_0x7d4b('0x29')](function(_0x160f34){var _0x59eade=_['map'](_0x3d8ea3['body'],function(_0x5b90b4){delete _0x5b90b4['id'];_0x5b90b4[_0x7d4b('0x5b')]=_0x3d8ea3[_0x7d4b('0x59')]['id'];return _0x5b90b4;});return db[_0x7d4b('0x34')][_0x7d4b('0x60')](_0x59eade,{'transaction':_0x385e8f});});})[_0x7d4b('0x29')](function(){return db[_0x7d4b('0x34')][_0x7d4b('0x4d')]({'where':{'IntervalId':_0x3d8ea3[_0x7d4b('0x59')]['id']}});});}})[_0x7d4b('0x29')](respondWithResult(_0x2a9d5a,null))[_0x7d4b('0x4f')](handleError(_0x2a9d5a,null));};
\ No newline at end of file