Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / schedule / schedule.controller.js
index 6551b0d..b90366b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd2fe=['ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','limit','Content-Range','apply','save','then','Scheduler','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','Schedule','rows','show','params','keys','length','options','find','catch','create','user','role','get','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x14477e,_0x44d4da){var _0x5d4a05=function(_0x5e0fa3){while(--_0x5e0fa3){_0x14477e['push'](_0x14477e['shift']());}};_0x5d4a05(++_0x44d4da);}(_0xd2fe,0x138));var _0xed2f=function(_0x5f37b1,_0x26fb91){_0x5f37b1=_0x5f37b1-0x0;var _0x31ab85=_0xd2fe[_0x5f37b1];return _0x31ab85;};'use strict';var pdf=require(_0xed2f('0x0'));var emlformat=require(_0xed2f('0x1'));var rimraf=require(_0xed2f('0x2'));var zipdir=require(_0xed2f('0x3'));var jsonpatch=require(_0xed2f('0x4'));var rp=require(_0xed2f('0x5'));var moment=require(_0xed2f('0x6'));var BPromise=require(_0xed2f('0x7'));var Mustache=require(_0xed2f('0x8'));var util=require('util');var path=require(_0xed2f('0x9'));var sox=require(_0xed2f('0xa'));var csv=require(_0xed2f('0xb'));var ejs=require(_0xed2f('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xed2f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xed2f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xed2f('0xf'));var Papa=require('papaparse');var Redis=require(_0xed2f('0x10'));var authService=require(_0xed2f('0x11'));var qs=require(_0xed2f('0x12'));var as=require(_0xed2f('0x13'));var hardwareService=require(_0xed2f('0x14'));var logger=require(_0xed2f('0x15'))('api');var utils=require(_0xed2f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xed2f('0x17'));var db=require(_0xed2f('0x18'))['db'];function respondWithStatusCode(_0x5b1bf4,_0x5125ef){_0x5125ef=_0x5125ef||0xcc;return function(_0x5199a6){if(_0x5199a6){return _0x5b1bf4['sendStatus'](_0x5125ef);}return _0x5b1bf4[_0xed2f('0x19')](_0x5125ef)[_0xed2f('0x1a')]();};}function respondWithResult(_0x8fba7f,_0x191c41){_0x191c41=_0x191c41||0xc8;return function(_0x2a5f8c){if(_0x2a5f8c){return _0x8fba7f[_0xed2f('0x19')](_0x191c41)[_0xed2f('0x1b')](_0x2a5f8c);}};}function respondWithFilteredResult(_0x5bf6a6,_0x2f7c4a){return function(_0x343cca){if(_0x343cca){var _0x285790=_0x343cca[_0xed2f('0x1c')],_0x1f5776=_0x2f7c4a['offset'],_0x6b1005=_0x2f7c4a['offset']+_0x2f7c4a[_0xed2f('0x1d')],_0x39b2b8;if(_0x6b1005>=_0x285790){_0x6b1005=_0x285790;_0x39b2b8=0xc8;}else{_0x39b2b8=0xce;}_0x5bf6a6['status'](_0x39b2b8);return _0x5bf6a6['set'](_0xed2f('0x1e'),_0x1f5776+'-'+_0x6b1005+'/'+_0x285790)['json'](_0x343cca);}return null;};}function patchUpdates(_0x41d211){return function(_0x18b7c2){try{jsonpatch[_0xed2f('0x1f')](_0x18b7c2,_0x41d211,!![]);}catch(_0x208c9){return BPromise['reject'](_0x208c9);}return _0x18b7c2[_0xed2f('0x20')]();};}function saveUpdates(_0x497b1d,_0x4299ec){return function(_0x1dfc8e){if(_0x1dfc8e){return _0x1dfc8e['update'](_0x497b1d)['then'](function(_0x5dd903){return _0x5dd903;});}return null;};}function removeEntity(_0x387026,_0x58554f){return function(_0x9caef){if(_0x9caef){return _0x9caef['destroy']()[_0xed2f('0x21')](function(){var _0x10ae5d=_0x9caef['get']({'plain':!![]});var _0x36d880=_0xed2f('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x36d880,'resourceId':_0x10ae5d['id']}})[_0xed2f('0x21')](function(){return _0x9caef;});})[_0xed2f('0x21')](function(){_0x387026[_0xed2f('0x19')](0xcc)[_0xed2f('0x1a')]();});}};}function handleEntityNotFound(_0x35aaf2,_0x345de6){return function(_0x18eb32){if(!_0x18eb32){_0x35aaf2['sendStatus'](0x194);}return _0x18eb32;};}function handleError(_0x1801f9,_0x7e8266){_0x7e8266=_0x7e8266||0x1f4;return function(_0x141837){logger['error'](_0x141837['stack']);if(_0x141837[_0xed2f('0x23')]){delete _0x141837[_0xed2f('0x23')];}_0x1801f9[_0xed2f('0x19')](_0x7e8266)[_0xed2f('0x24')](_0x141837);};}exports['index']=function(_0x13fb0e,_0x8497c3){var _0x4348dd={},_0x38a581={},_0x54ce2e={'count':0x0,'rows':[]};var _0x11f82f=_[_0xed2f('0x25')](db['Schedule'][_0xed2f('0x26')],function(_0x4cafe5){return{'name':_0x4cafe5[_0xed2f('0x27')],'type':_0x4cafe5[_0xed2f('0x28')][_0xed2f('0x29')]};});_0x38a581[_0xed2f('0x2a')]=_[_0xed2f('0x25')](_0x11f82f,_0xed2f('0x23'));_0x38a581[_0xed2f('0x2b')]=_['keys'](_0x13fb0e[_0xed2f('0x2b')]);_0x38a581['filters']=_[_0xed2f('0x2c')](_0x38a581[_0xed2f('0x2a')],_0x38a581[_0xed2f('0x2b')]);_0x4348dd[_0xed2f('0x2d')]=_[_0xed2f('0x2c')](_0x38a581[_0xed2f('0x2a')],qs['fields'](_0x13fb0e[_0xed2f('0x2b')][_0xed2f('0x2e')]));_0x4348dd[_0xed2f('0x2d')]=_0x4348dd['attributes']['length']?_0x4348dd[_0xed2f('0x2d')]:_0x38a581[_0xed2f('0x2a')];if(!_0x13fb0e[_0xed2f('0x2b')][_0xed2f('0x2f')](_0xed2f('0x30'))){_0x4348dd[_0xed2f('0x1d')]=qs[_0xed2f('0x1d')](_0x13fb0e[_0xed2f('0x2b')][_0xed2f('0x1d')]);_0x4348dd[_0xed2f('0x31')]=qs[_0xed2f('0x31')](_0x13fb0e[_0xed2f('0x2b')][_0xed2f('0x31')]);}_0x4348dd[_0xed2f('0x32')]=qs[_0xed2f('0x33')](_0x13fb0e[_0xed2f('0x2b')][_0xed2f('0x33')]);_0x4348dd[_0xed2f('0x34')]=qs[_0xed2f('0x35')](_[_0xed2f('0x36')](_0x13fb0e['query'],_0x38a581[_0xed2f('0x35')]),_0x11f82f);if(_0x13fb0e[_0xed2f('0x2b')][_0xed2f('0x37')]){_0x4348dd[_0xed2f('0x34')]=_['merge'](_0x4348dd[_0xed2f('0x34')],{'$or':_[_0xed2f('0x25')](_0x11f82f,function(_0x45e0b1){if(_0x45e0b1[_0xed2f('0x28')]!==_0xed2f('0x38')){var _0x5acde3={};_0x5acde3[_0x45e0b1[_0xed2f('0x23')]]={'$like':'%'+_0x13fb0e['query'][_0xed2f('0x37')]+'%'};return _0x5acde3;}})});}_0x4348dd=_[_0xed2f('0x39')]({},_0x4348dd,_0x13fb0e['options']);var _0x3fa492={'where':_0x4348dd[_0xed2f('0x34')]};return db['Schedule'][_0xed2f('0x1c')](_0x3fa492)['then'](function(_0x2d3a58){_0x54ce2e['count']=_0x2d3a58;if(_0x13fb0e[_0xed2f('0x2b')][_0xed2f('0x3a')]){_0x4348dd[_0xed2f('0x3b')]=[{'all':!![]}];}return db[_0xed2f('0x3c')]['findAll'](_0x4348dd);})[_0xed2f('0x21')](function(_0x43df15){_0x54ce2e[_0xed2f('0x3d')]=_0x43df15;return _0x54ce2e;})[_0xed2f('0x21')](respondWithFilteredResult(_0x8497c3,_0x4348dd))['catch'](handleError(_0x8497c3,null));};exports[_0xed2f('0x3e')]=function(_0x47e9e6,_0x176430){var _0x25ef2f={'raw':![],'where':{'id':_0x47e9e6[_0xed2f('0x3f')]['id']}},_0xa24fac={};_0xa24fac[_0xed2f('0x2a')]=_['keys'](db[_0xed2f('0x3c')][_0xed2f('0x26')]);_0xa24fac[_0xed2f('0x2b')]=_[_0xed2f('0x40')](_0x47e9e6['query']);_0xa24fac['filters']=_[_0xed2f('0x2c')](_0xa24fac[_0xed2f('0x2a')],_0xa24fac[_0xed2f('0x2b')]);_0x25ef2f['attributes']=_[_0xed2f('0x2c')](_0xa24fac['model'],qs[_0xed2f('0x2e')](_0x47e9e6[_0xed2f('0x2b')]['fields']));_0x25ef2f['attributes']=_0x25ef2f[_0xed2f('0x2d')][_0xed2f('0x41')]?_0x25ef2f[_0xed2f('0x2d')]:_0xa24fac[_0xed2f('0x2a')];if(_0x47e9e6[_0xed2f('0x2b')]['includeAll']){_0x25ef2f['include']=[{'all':!![]}];}_0x25ef2f=_[_0xed2f('0x39')]({},_0x25ef2f,_0x47e9e6[_0xed2f('0x42')]);return db[_0xed2f('0x3c')][_0xed2f('0x43')](_0x25ef2f)['then'](handleEntityNotFound(_0x176430,null))[_0xed2f('0x21')](respondWithResult(_0x176430,null))[_0xed2f('0x44')](handleError(_0x176430,null));};exports[_0xed2f('0x45')]=function(_0x1e25ee,_0x2d2772){return db[_0xed2f('0x3c')][_0xed2f('0x45')](_0x1e25ee['body'],{})['then'](function(_0x256ab6){var _0x23c431=_0x1e25ee[_0xed2f('0x46')]['get']({'plain':!![]});if(!_0x23c431)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23c431[_0xed2f('0x47')]===_0xed2f('0x46')){var _0x1c8e0a=_0x256ab6[_0xed2f('0x48')]({'plain':!![]});var _0x466932='Scheduler';return db[_0xed2f('0x49')][_0xed2f('0x43')]({'where':{'name':_0x466932,'userProfileId':_0x23c431[_0xed2f('0x4a')]},'raw':!![]})[_0xed2f('0x21')](function(_0x1f6c8a){if(_0x1f6c8a&&_0x1f6c8a['autoAssociation']===0x0){return db['UserProfileResource'][_0xed2f('0x45')]({'name':_0x1c8e0a[_0xed2f('0x23')],'resourceId':_0x1c8e0a['id'],'type':_0x1f6c8a[_0xed2f('0x23')],'sectionId':_0x1f6c8a['id']},{})[_0xed2f('0x21')](function(){return _0x256ab6;});}else{return _0x256ab6;}})[_0xed2f('0x44')](function(_0x623849){logger[_0xed2f('0x4b')](_0xed2f('0x4c'),_0x623849);throw _0x623849;});}return _0x256ab6;})[_0xed2f('0x21')](respondWithResult(_0x2d2772,0xc9))[_0xed2f('0x44')](handleError(_0x2d2772,null));};exports[_0xed2f('0x4d')]=function(_0x218808,_0x24c5ea){if(_0x218808[_0xed2f('0x4e')]['id']){delete _0x218808[_0xed2f('0x4e')]['id'];}return db[_0xed2f('0x3c')][_0xed2f('0x43')]({'where':{'id':_0x218808[_0xed2f('0x3f')]['id']}})[_0xed2f('0x21')](handleEntityNotFound(_0x24c5ea,null))['then'](saveUpdates(_0x218808[_0xed2f('0x4e')],null))[_0xed2f('0x21')](respondWithResult(_0x24c5ea,null))['catch'](handleError(_0x24c5ea,null));};exports['destroy']=function(_0x429937,_0x1cc543){return db[_0xed2f('0x3c')][_0xed2f('0x43')]({'where':{'id':_0x429937[_0xed2f('0x3f')]['id']}})[_0xed2f('0x21')](handleEntityNotFound(_0x1cc543,null))[_0xed2f('0x21')](removeEntity(_0x1cc543,null))[_0xed2f('0x44')](handleError(_0x1cc543,null));};exports[_0xed2f('0x4f')]=function(_0x17178a,_0x3cecdd,_0x54bc0d){var _0x4fea26=require(_0xed2f('0x50'));return db[_0xed2f('0x3c')][_0xed2f('0x43')]({'where':{'id':_0x17178a[_0xed2f('0x3f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3cecdd,null))['then'](function(){_0x4fea26[_0xed2f('0x4f')](_0x17178a[_0xed2f('0x3f')]['id']);})[_0xed2f('0x21')](respondWithStatusCode(_0x3cecdd,null))[_0xed2f('0x44')](handleError(_0x3cecdd,null));};
\ No newline at end of file
+var _0xdce9=['UserProfileResource','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Scheduler','stack','send','index','map','Schedule','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','user','UserProfileSection','userProfileId'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0xdce9,0x1dd));var _0x9dce=function(_0x32535c,_0x4da469){_0x32535c=_0x32535c-0x0;var _0x24f2aa=_0xdce9[_0x32535c];return _0x24f2aa;};'use strict';var emlformat=require(_0x9dce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9dce('0x1'));var jsonpatch=require(_0x9dce('0x2'));var rp=require(_0x9dce('0x3'));var moment=require(_0x9dce('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9dce('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9dce('0x6'));var csv=require(_0x9dce('0x7'));var ejs=require(_0x9dce('0x8'));var fs=require('fs');var fs_extra=require(_0x9dce('0x9'));var _=require(_0x9dce('0xa'));var squel=require('squel');var crypto=require(_0x9dce('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9dce('0x7'));var querystring=require(_0x9dce('0xc'));var Papa=require(_0x9dce('0xd'));var Redis=require(_0x9dce('0xe'));var authService=require(_0x9dce('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9dce('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9dce('0x11'))(_0x9dce('0x12'));var utils=require(_0x9dce('0x13'));var config=require(_0x9dce('0x14'));var licenseUtil=require(_0x9dce('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x325579,_0x5b02e6){_0x5b02e6=_0x5b02e6||0xcc;return function(_0xef4be0){if(_0xef4be0){return _0x325579[_0x9dce('0x16')](_0x5b02e6);}return _0x325579[_0x9dce('0x17')](_0x5b02e6)[_0x9dce('0x18')]();};}function respondWithResult(_0x3fe2c7,_0xff0de5){_0xff0de5=_0xff0de5||0xc8;return function(_0x1d5f5c){if(_0x1d5f5c){return _0x3fe2c7['status'](_0xff0de5)[_0x9dce('0x19')](_0x1d5f5c);}};}function respondWithFilteredResult(_0x110179,_0x221130){return function(_0x1622c6){if(_0x1622c6){var _0x25e530=typeof _0x221130['offset']===_0x9dce('0x1a')&&typeof _0x221130['limit']===_0x9dce('0x1a');var _0x47e270=_0x1622c6[_0x9dce('0x1b')];var _0x271b81=_0x25e530?0x0:_0x221130[_0x9dce('0x1c')];var _0x154628=_0x25e530?_0x1622c6['count']:_0x221130['offset']+_0x221130[_0x9dce('0x1d')];var _0x30743e;if(_0x154628>=_0x47e270){_0x154628=_0x47e270;_0x30743e=0xc8;}else{_0x30743e=0xce;}_0x110179[_0x9dce('0x17')](_0x30743e);return _0x110179[_0x9dce('0x1e')](_0x9dce('0x1f'),_0x271b81+'-'+_0x154628+'/'+_0x47e270)['json'](_0x1622c6);}return null;};}function patchUpdates(_0x52f382){return function(_0x211cc9){try{jsonpatch[_0x9dce('0x20')](_0x211cc9,_0x52f382,!![]);}catch(_0x1f2a13){return BPromise['reject'](_0x1f2a13);}return _0x211cc9[_0x9dce('0x21')]();};}function saveUpdates(_0x5e1031,_0x1932ea){return function(_0x167793){if(_0x167793){return _0x167793[_0x9dce('0x22')](_0x5e1031)[_0x9dce('0x23')](function(_0x19d9b5){return _0x19d9b5;});}return null;};}function removeEntity(_0x25dcf3,_0x158f49){return function(_0x3ff99e){if(_0x3ff99e){return _0x3ff99e[_0x9dce('0x24')]()['then'](function(){var _0x24ea5f=_0x3ff99e[_0x9dce('0x25')]({'plain':!![]});var _0x987394=_0x9dce('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x987394,'resourceId':_0x24ea5f['id']}})[_0x9dce('0x23')](function(){return _0x3ff99e;});})[_0x9dce('0x23')](function(){_0x25dcf3['status'](0xcc)[_0x9dce('0x18')]();});}};}function handleEntityNotFound(_0x5a2362,_0x467f3a){return function(_0x52aee3){if(!_0x52aee3){_0x5a2362[_0x9dce('0x16')](0x194);}return _0x52aee3;};}function handleError(_0x53654d,_0x2172e0){_0x2172e0=_0x2172e0||0x1f4;return function(_0x1ae121){logger['error'](_0x1ae121[_0x9dce('0x27')]);if(_0x1ae121['name']){delete _0x1ae121['name'];}_0x53654d['status'](_0x2172e0)[_0x9dce('0x28')](_0x1ae121);};}exports[_0x9dce('0x29')]=function(_0x38ab1d,_0x4648f3){var _0x11d291={},_0x25b744={},_0x38f91d={'count':0x0,'rows':[]};var _0x3657dd=_[_0x9dce('0x2a')](db[_0x9dce('0x2b')]['rawAttributes'],function(_0x59ab27){return{'name':_0x59ab27['fieldName'],'type':_0x59ab27[_0x9dce('0x2c')][_0x9dce('0x2d')]};});_0x25b744[_0x9dce('0x2e')]=_[_0x9dce('0x2a')](_0x3657dd,_0x9dce('0x2f'));_0x25b744[_0x9dce('0x30')]=_[_0x9dce('0x31')](_0x38ab1d['query']);_0x25b744['filters']=_[_0x9dce('0x32')](_0x25b744[_0x9dce('0x2e')],_0x25b744[_0x9dce('0x30')]);_0x11d291[_0x9dce('0x33')]=_[_0x9dce('0x32')](_0x25b744['model'],qs[_0x9dce('0x34')](_0x38ab1d[_0x9dce('0x30')][_0x9dce('0x34')]));_0x11d291[_0x9dce('0x33')]=_0x11d291[_0x9dce('0x33')][_0x9dce('0x35')]?_0x11d291[_0x9dce('0x33')]:_0x25b744[_0x9dce('0x2e')];if(!_0x38ab1d[_0x9dce('0x30')][_0x9dce('0x36')](_0x9dce('0x37'))){_0x11d291[_0x9dce('0x1d')]=qs[_0x9dce('0x1d')](_0x38ab1d[_0x9dce('0x30')][_0x9dce('0x1d')]);_0x11d291[_0x9dce('0x1c')]=qs['offset'](_0x38ab1d[_0x9dce('0x30')][_0x9dce('0x1c')]);}_0x11d291['order']=qs[_0x9dce('0x38')](_0x38ab1d['query'][_0x9dce('0x38')]);_0x11d291['where']=qs['filters'](_[_0x9dce('0x39')](_0x38ab1d[_0x9dce('0x30')],_0x25b744['filters']),_0x3657dd);if(_0x38ab1d[_0x9dce('0x30')]['filter']){_0x11d291[_0x9dce('0x3a')]=_[_0x9dce('0x3b')](_0x11d291[_0x9dce('0x3a')],{'$or':_['map'](_0x3657dd,function(_0x2cb4a5){if(_0x2cb4a5[_0x9dce('0x2c')]!==_0x9dce('0x3c')){var _0xbe8e7a={};_0xbe8e7a[_0x2cb4a5[_0x9dce('0x2f')]]={'$like':'%'+_0x38ab1d['query'][_0x9dce('0x3d')]+'%'};return _0xbe8e7a;}})});}_0x11d291=_[_0x9dce('0x3b')]({},_0x11d291,_0x38ab1d['options']);var _0x5ce7f4={'where':_0x11d291['where']};return db[_0x9dce('0x2b')][_0x9dce('0x1b')](_0x5ce7f4)[_0x9dce('0x23')](function(_0x585d63){_0x38f91d['count']=_0x585d63;if(_0x38ab1d[_0x9dce('0x30')][_0x9dce('0x3e')]){_0x11d291['include']=[{'all':!![]}];}return db['Schedule'][_0x9dce('0x3f')](_0x11d291);})[_0x9dce('0x23')](function(_0xcd4885){_0x38f91d[_0x9dce('0x40')]=_0xcd4885;return _0x38f91d;})[_0x9dce('0x23')](respondWithFilteredResult(_0x4648f3,_0x11d291))[_0x9dce('0x41')](handleError(_0x4648f3,null));};exports[_0x9dce('0x42')]=function(_0x11d5f0,_0x4ec679){var _0xd1c6b2={'raw':![],'where':{'id':_0x11d5f0[_0x9dce('0x43')]['id']}},_0xf3b340={};_0xf3b340[_0x9dce('0x2e')]=_[_0x9dce('0x31')](db['Schedule'][_0x9dce('0x44')]);_0xf3b340[_0x9dce('0x30')]=_[_0x9dce('0x31')](_0x11d5f0[_0x9dce('0x30')]);_0xf3b340['filters']=_[_0x9dce('0x32')](_0xf3b340['model'],_0xf3b340[_0x9dce('0x30')]);_0xd1c6b2['attributes']=_[_0x9dce('0x32')](_0xf3b340[_0x9dce('0x2e')],qs[_0x9dce('0x34')](_0x11d5f0[_0x9dce('0x30')][_0x9dce('0x34')]));_0xd1c6b2[_0x9dce('0x33')]=_0xd1c6b2['attributes'][_0x9dce('0x35')]?_0xd1c6b2[_0x9dce('0x33')]:_0xf3b340[_0x9dce('0x2e')];if(_0x11d5f0[_0x9dce('0x30')]['includeAll']){_0xd1c6b2['include']=[{'all':!![]}];}_0xd1c6b2=_['merge']({},_0xd1c6b2,_0x11d5f0[_0x9dce('0x45')]);return db['Schedule'][_0x9dce('0x46')](_0xd1c6b2)[_0x9dce('0x23')](handleEntityNotFound(_0x4ec679,null))[_0x9dce('0x23')](respondWithResult(_0x4ec679,null))[_0x9dce('0x41')](handleError(_0x4ec679,null));};exports[_0x9dce('0x47')]=function(_0x36538c,_0x2fb423){return db[_0x9dce('0x2b')][_0x9dce('0x47')](_0x36538c[_0x9dce('0x48')],{})[_0x9dce('0x23')](function(_0x5c07ae){var _0x19cb58=_0x36538c[_0x9dce('0x49')][_0x9dce('0x25')]({'plain':!![]});if(!_0x19cb58)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19cb58['role']==='user'){var _0x41ada7=_0x5c07ae[_0x9dce('0x25')]({'plain':!![]});var _0x1d93e6=_0x9dce('0x26');return db[_0x9dce('0x4a')][_0x9dce('0x46')]({'where':{'name':_0x1d93e6,'userProfileId':_0x19cb58[_0x9dce('0x4b')]},'raw':!![]})['then'](function(_0x15e88a){if(_0x15e88a&&_0x15e88a['autoAssociation']===0x0){return db[_0x9dce('0x4c')][_0x9dce('0x47')]({'name':_0x41ada7[_0x9dce('0x2f')],'resourceId':_0x41ada7['id'],'type':_0x15e88a['name'],'sectionId':_0x15e88a['id']},{})['then'](function(){return _0x5c07ae;});}else{return _0x5c07ae;}})[_0x9dce('0x41')](function(_0x5bd6ff){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bd6ff);throw _0x5bd6ff;});}return _0x5c07ae;})[_0x9dce('0x23')](respondWithResult(_0x2fb423,0xc9))[_0x9dce('0x41')](handleError(_0x2fb423,null));};exports['update']=function(_0x4db0c3,_0x1b6daf){if(_0x4db0c3[_0x9dce('0x48')]['id']){delete _0x4db0c3[_0x9dce('0x48')]['id'];}return db[_0x9dce('0x2b')]['find']({'where':{'id':_0x4db0c3[_0x9dce('0x43')]['id']}})[_0x9dce('0x23')](handleEntityNotFound(_0x1b6daf,null))[_0x9dce('0x23')](saveUpdates(_0x4db0c3[_0x9dce('0x48')],null))[_0x9dce('0x23')](respondWithResult(_0x1b6daf,null))[_0x9dce('0x41')](handleError(_0x1b6daf,null));};exports['destroy']=function(_0x46632a,_0x9f7b48){return db['Schedule'][_0x9dce('0x46')]({'where':{'id':_0x46632a[_0x9dce('0x43')]['id']}})['then'](handleEntityNotFound(_0x9f7b48,null))[_0x9dce('0x23')](removeEntity(_0x9f7b48,null))[_0x9dce('0x41')](handleError(_0x9f7b48,null));};exports[_0x9dce('0x4d')]=function(_0x1fc1b5,_0x277819,_0x3b3b02){var _0x56de10=require(_0x9dce('0x4e'));return db[_0x9dce('0x2b')][_0x9dce('0x46')]({'where':{'id':_0x1fc1b5[_0x9dce('0x43')]['id']},'raw':!![]})[_0x9dce('0x23')](handleEntityNotFound(_0x277819,null))[_0x9dce('0x23')](function(){_0x56de10[_0x9dce('0x4d')](_0x1fc1b5['params']['id']);})[_0x9dce('0x23')](respondWithStatusCode(_0x277819,null))[_0x9dce('0x41')](handleError(_0x277819,null));};
\ No newline at end of file