Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / schedule / schedule.controller.js
index 8e852fc..b90366b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x149f=['includeAll','include','show','keys','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Scheduler','UserProfileSection','userProfileId','autoAssociation','params','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','set','json','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','index','map','Schedule','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count'];(function(_0x569d11,_0x217bc7){var _0x4160c5=function(_0x5b8980){while(--_0x5b8980){_0x569d11['push'](_0x569d11['shift']());}};_0x4160c5(++_0x217bc7);}(_0x149f,0x1ca));var _0xf149=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x149f[_0x5d4607];return _0x5e4a86;};'use strict';var emlformat=require(_0xf149('0x0'));var rimraf=require(_0xf149('0x1'));var zipdir=require(_0xf149('0x2'));var jsonpatch=require(_0xf149('0x3'));var rp=require(_0xf149('0x4'));var moment=require(_0xf149('0x5'));var BPromise=require(_0xf149('0x6'));var Mustache=require(_0xf149('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf149('0x8'));var csv=require('to-csv');var ejs=require(_0xf149('0x9'));var fs=require('fs');var fs_extra=require(_0xf149('0xa'));var _=require(_0xf149('0xb'));var squel=require(_0xf149('0xc'));var crypto=require(_0xf149('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf149('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf149('0xf'));var Papa=require(_0xf149('0x10'));var Redis=require('ioredis');var authService=require(_0xf149('0x11'));var qs=require(_0xf149('0x12'));var as=require(_0xf149('0x13'));var hardwareService=require(_0xf149('0x14'));var logger=require(_0xf149('0x15'))(_0xf149('0x16'));var utils=require(_0xf149('0x17'));var config=require(_0xf149('0x18'));var licenseUtil=require(_0xf149('0x19'));var db=require(_0xf149('0x1a'))['db'];function respondWithStatusCode(_0x2e3a49,_0x1387ce){_0x1387ce=_0x1387ce||0xcc;return function(_0x4cd848){if(_0x4cd848){return _0x2e3a49[_0xf149('0x1b')](_0x1387ce);}return _0x2e3a49[_0xf149('0x1c')](_0x1387ce)['end']();};}function respondWithResult(_0x1a43c9,_0x1816ab){_0x1816ab=_0x1816ab||0xc8;return function(_0x4ef640){if(_0x4ef640){return _0x1a43c9[_0xf149('0x1c')](_0x1816ab)['json'](_0x4ef640);}};}function respondWithFilteredResult(_0x3c0643,_0x4246a5){return function(_0x3c8e60){if(_0x3c8e60){var _0xf39ac6=typeof _0x4246a5[_0xf149('0x1d')]===_0xf149('0x1e')&&typeof _0x4246a5[_0xf149('0x1f')]==='undefined';var _0x441645=_0x3c8e60['count'];var _0x52db33=_0xf39ac6?0x0:_0x4246a5['offset'];var _0x290d52=_0xf39ac6?_0x3c8e60['count']:_0x4246a5['offset']+_0x4246a5[_0xf149('0x1f')];var _0x3f25b3;if(_0x290d52>=_0x441645){_0x290d52=_0x441645;_0x3f25b3=0xc8;}else{_0x3f25b3=0xce;}_0x3c0643[_0xf149('0x1c')](_0x3f25b3);return _0x3c0643[_0xf149('0x20')]('Content-Range',_0x52db33+'-'+_0x290d52+'/'+_0x441645)[_0xf149('0x21')](_0x3c8e60);}return null;};}function patchUpdates(_0x380d3c){return function(_0x3b1b9d){try{jsonpatch[_0xf149('0x22')](_0x3b1b9d,_0x380d3c,!![]);}catch(_0x262ebe){return BPromise[_0xf149('0x23')](_0x262ebe);}return _0x3b1b9d['save']();};}function saveUpdates(_0x32d2aa,_0x32a1f6){return function(_0x2ec479){if(_0x2ec479){return _0x2ec479[_0xf149('0x24')](_0x32d2aa)[_0xf149('0x25')](function(_0x5125a0){return _0x5125a0;});}return null;};}function removeEntity(_0x25d6c7,_0xaf95ea){return function(_0x41e626){if(_0x41e626){return _0x41e626[_0xf149('0x26')]()['then'](function(){var _0x4ac432=_0x41e626[_0xf149('0x27')]({'plain':!![]});var _0x32505b='Scheduler';return db[_0xf149('0x28')][_0xf149('0x26')]({'where':{'type':_0x32505b,'resourceId':_0x4ac432['id']}})[_0xf149('0x25')](function(){return _0x41e626;});})[_0xf149('0x25')](function(){_0x25d6c7['status'](0xcc)[_0xf149('0x29')]();});}};}function handleEntityNotFound(_0x52e7f2,_0x2d3414){return function(_0x3f9a38){if(!_0x3f9a38){_0x52e7f2[_0xf149('0x1b')](0x194);}return _0x3f9a38;};}function handleError(_0x17722b,_0x33e85c){_0x33e85c=_0x33e85c||0x1f4;return function(_0x5c6ba1){logger[_0xf149('0x2a')](_0x5c6ba1[_0xf149('0x2b')]);if(_0x5c6ba1[_0xf149('0x2c')]){delete _0x5c6ba1[_0xf149('0x2c')];}_0x17722b[_0xf149('0x1c')](_0x33e85c)['send'](_0x5c6ba1);};}exports[_0xf149('0x2d')]=function(_0x2f116a,_0xf76370){var _0x28b9aa={},_0x333fe1={},_0x4519db={'count':0x0,'rows':[]};var _0x564c80=_[_0xf149('0x2e')](db[_0xf149('0x2f')][_0xf149('0x30')],function(_0x413c5e){return{'name':_0x413c5e[_0xf149('0x31')],'type':_0x413c5e[_0xf149('0x32')][_0xf149('0x33')]};});_0x333fe1[_0xf149('0x34')]=_[_0xf149('0x2e')](_0x564c80,_0xf149('0x2c'));_0x333fe1['query']=_['keys'](_0x2f116a['query']);_0x333fe1[_0xf149('0x35')]=_[_0xf149('0x36')](_0x333fe1['model'],_0x333fe1[_0xf149('0x37')]);_0x28b9aa['attributes']=_[_0xf149('0x36')](_0x333fe1['model'],qs['fields'](_0x2f116a[_0xf149('0x37')][_0xf149('0x38')]));_0x28b9aa['attributes']=_0x28b9aa['attributes'][_0xf149('0x39')]?_0x28b9aa[_0xf149('0x3a')]:_0x333fe1[_0xf149('0x34')];if(!_0x2f116a['query'][_0xf149('0x3b')](_0xf149('0x3c'))){_0x28b9aa['limit']=qs[_0xf149('0x1f')](_0x2f116a['query'][_0xf149('0x1f')]);_0x28b9aa['offset']=qs[_0xf149('0x1d')](_0x2f116a['query'][_0xf149('0x1d')]);}_0x28b9aa[_0xf149('0x3d')]=qs[_0xf149('0x3e')](_0x2f116a[_0xf149('0x37')][_0xf149('0x3e')]);_0x28b9aa[_0xf149('0x3f')]=qs['filters'](_[_0xf149('0x40')](_0x2f116a[_0xf149('0x37')],_0x333fe1['filters']),_0x564c80);if(_0x2f116a[_0xf149('0x37')][_0xf149('0x41')]){_0x28b9aa[_0xf149('0x3f')]=_[_0xf149('0x42')](_0x28b9aa[_0xf149('0x3f')],{'$or':_[_0xf149('0x2e')](_0x564c80,function(_0x441aee){if(_0x441aee[_0xf149('0x32')]!==_0xf149('0x43')){var _0x2f7c45={};_0x2f7c45[_0x441aee[_0xf149('0x2c')]]={'$like':'%'+_0x2f116a[_0xf149('0x37')]['filter']+'%'};return _0x2f7c45;}})});}_0x28b9aa=_['merge']({},_0x28b9aa,_0x2f116a[_0xf149('0x44')]);var _0x407a12={'where':_0x28b9aa[_0xf149('0x3f')]};return db['Schedule'][_0xf149('0x45')](_0x407a12)[_0xf149('0x25')](function(_0x26ba89){_0x4519db[_0xf149('0x45')]=_0x26ba89;if(_0x2f116a[_0xf149('0x37')][_0xf149('0x46')]){_0x28b9aa[_0xf149('0x47')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x28b9aa);})[_0xf149('0x25')](function(_0x20bcd3){_0x4519db['rows']=_0x20bcd3;return _0x4519db;})[_0xf149('0x25')](respondWithFilteredResult(_0xf76370,_0x28b9aa))['catch'](handleError(_0xf76370,null));};exports[_0xf149('0x48')]=function(_0x21e246,_0x10958a){var _0x277b33={'raw':![],'where':{'id':_0x21e246['params']['id']}},_0x239897={};_0x239897[_0xf149('0x34')]=_[_0xf149('0x49')](db[_0xf149('0x2f')][_0xf149('0x30')]);_0x239897['query']=_[_0xf149('0x49')](_0x21e246[_0xf149('0x37')]);_0x239897['filters']=_[_0xf149('0x36')](_0x239897['model'],_0x239897['query']);_0x277b33[_0xf149('0x3a')]=_['intersection'](_0x239897['model'],qs[_0xf149('0x38')](_0x21e246[_0xf149('0x37')]['fields']));_0x277b33[_0xf149('0x3a')]=_0x277b33[_0xf149('0x3a')]['length']?_0x277b33[_0xf149('0x3a')]:_0x239897[_0xf149('0x34')];if(_0x21e246[_0xf149('0x37')][_0xf149('0x46')]){_0x277b33[_0xf149('0x47')]=[{'all':!![]}];}_0x277b33=_[_0xf149('0x42')]({},_0x277b33,_0x21e246['options']);return db[_0xf149('0x2f')][_0xf149('0x4a')](_0x277b33)[_0xf149('0x25')](handleEntityNotFound(_0x10958a,null))['then'](respondWithResult(_0x10958a,null))[_0xf149('0x4b')](handleError(_0x10958a,null));};exports['create']=function(_0x54601b,_0x59c0e0){return db[_0xf149('0x2f')][_0xf149('0x4c')](_0x54601b[_0xf149('0x4d')],{})[_0xf149('0x25')](function(_0x41167c){var _0x36cab4=_0x54601b['user']['get']({'plain':!![]});if(!_0x36cab4)throw new Error(_0xf149('0x4e'));if(_0x36cab4[_0xf149('0x4f')]===_0xf149('0x50')){var _0x176eb2=_0x41167c[_0xf149('0x27')]({'plain':!![]});var _0x53c9ac=_0xf149('0x51');return db[_0xf149('0x52')][_0xf149('0x4a')]({'where':{'name':_0x53c9ac,'userProfileId':_0x36cab4[_0xf149('0x53')]},'raw':!![]})['then'](function(_0x32889a){if(_0x32889a&&_0x32889a[_0xf149('0x54')]===0x0){return db[_0xf149('0x28')]['create']({'name':_0x176eb2[_0xf149('0x2c')],'resourceId':_0x176eb2['id'],'type':_0x32889a[_0xf149('0x2c')],'sectionId':_0x32889a['id']},{})['then'](function(){return _0x41167c;});}else{return _0x41167c;}})[_0xf149('0x4b')](function(_0x597449){logger[_0xf149('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x597449);throw _0x597449;});}return _0x41167c;})[_0xf149('0x25')](respondWithResult(_0x59c0e0,0xc9))[_0xf149('0x4b')](handleError(_0x59c0e0,null));};exports[_0xf149('0x24')]=function(_0x246bec,_0x1dae6d){if(_0x246bec[_0xf149('0x4d')]['id']){delete _0x246bec[_0xf149('0x4d')]['id'];}return db[_0xf149('0x2f')]['find']({'where':{'id':_0x246bec[_0xf149('0x55')]['id']}})['then'](handleEntityNotFound(_0x1dae6d,null))[_0xf149('0x25')](saveUpdates(_0x246bec[_0xf149('0x4d')],null))[_0xf149('0x25')](respondWithResult(_0x1dae6d,null))['catch'](handleError(_0x1dae6d,null));};exports[_0xf149('0x26')]=function(_0x4086bd,_0x5bb6dd){return db['Schedule'][_0xf149('0x4a')]({'where':{'id':_0x4086bd['params']['id']}})[_0xf149('0x25')](handleEntityNotFound(_0x5bb6dd,null))[_0xf149('0x25')](removeEntity(_0x5bb6dd,null))[_0xf149('0x4b')](handleError(_0x5bb6dd,null));};exports[_0xf149('0x56')]=function(_0x2d2dcb,_0x55bcbc,_0x325d75){var _0x2e55ba=require(_0xf149('0x57'));return db['Schedule'][_0xf149('0x4a')]({'where':{'id':_0x2d2dcb[_0xf149('0x55')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x55bcbc,null))['then'](function(){_0x2e55ba['run'](_0x2d2dcb[_0xf149('0x55')]['id']);})[_0xf149('0x25')](respondWithStatusCode(_0x55bcbc,null))[_0xf149('0x4b')](handleError(_0x55bcbc,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