Built motion from commit d1eab355.|2.6.28
[motion2.git] / server / api / schedule / schedule.controller.js
index a439117..5d19b67 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x03f4=['key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','rows','show','params','Schedule','find','catch','create','body','role','UserProfileSection','userProfileId','autoAssociation','run','../../config/schedule','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','type'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x03f4,0xce));var _0x403f=function(_0xc3519a,_0x2bf606){_0xc3519a=_0xc3519a-0x0;var _0x1eda04=_0x03f4[_0xc3519a];return _0x1eda04;};'use strict';var emlformat=require(_0x403f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x403f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x403f('0x2'));var moment=require('moment');var BPromise=require(_0x403f('0x3'));var Mustache=require(_0x403f('0x4'));var util=require(_0x403f('0x5'));var path=require('path');var sox=require(_0x403f('0x6'));var csv=require(_0x403f('0x7'));var ejs=require(_0x403f('0x8'));var fs=require('fs');var fs_extra=require(_0x403f('0x9'));var _=require(_0x403f('0xa'));var squel=require(_0x403f('0xb'));var crypto=require(_0x403f('0xc'));var jsforce=require(_0x403f('0xd'));var deskjs=require(_0x403f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x403f('0xf'));var Papa=require('papaparse');var Redis=require(_0x403f('0x10'));var authService=require(_0x403f('0x11'));var qs=require(_0x403f('0x12'));var as=require(_0x403f('0x13'));var hardwareService=require(_0x403f('0x14'));var logger=require(_0x403f('0x15'))(_0x403f('0x16'));var utils=require(_0x403f('0x17'));var config=require(_0x403f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x403f('0x19'))['db'];function respondWithStatusCode(_0x11b06d,_0x8a85a0){_0x8a85a0=_0x8a85a0||0xcc;return function(_0xed4e75){if(_0xed4e75){return _0x11b06d['sendStatus'](_0x8a85a0);}return _0x11b06d[_0x403f('0x1a')](_0x8a85a0)[_0x403f('0x1b')]();};}function respondWithResult(_0x40ff07,_0x4a7e5c){_0x4a7e5c=_0x4a7e5c||0xc8;return function(_0x48f6b9){if(_0x48f6b9){return _0x40ff07['status'](_0x4a7e5c)[_0x403f('0x1c')](_0x48f6b9);}};}function respondWithFilteredResult(_0x2d3184,_0x510b79){return function(_0xf11dcd){if(_0xf11dcd){var _0x4a6853=typeof _0x510b79[_0x403f('0x1d')]===_0x403f('0x1e')&&typeof _0x510b79['limit']==='undefined';var _0x5914c2=_0xf11dcd[_0x403f('0x1f')];var _0x5da64b=_0x4a6853?0x0:_0x510b79['offset'];var _0x4ae3d2=_0x4a6853?_0xf11dcd[_0x403f('0x1f')]:_0x510b79[_0x403f('0x1d')]+_0x510b79[_0x403f('0x20')];var _0x39681c;if(_0x4ae3d2>=_0x5914c2){_0x4ae3d2=_0x5914c2;_0x39681c=0xc8;}else{_0x39681c=0xce;}_0x2d3184[_0x403f('0x1a')](_0x39681c);return _0x2d3184[_0x403f('0x21')](_0x403f('0x22'),_0x5da64b+'-'+_0x4ae3d2+'/'+_0x5914c2)[_0x403f('0x1c')](_0xf11dcd);}return null;};}function patchUpdates(_0x1661d8){return function(_0x1dde88){try{jsonpatch[_0x403f('0x23')](_0x1dde88,_0x1661d8,!![]);}catch(_0x3dc4a7){return BPromise['reject'](_0x3dc4a7);}return _0x1dde88[_0x403f('0x24')]();};}function saveUpdates(_0x3e93d1,_0x3825af){return function(_0x46ff78){if(_0x46ff78){return _0x46ff78[_0x403f('0x25')](_0x3e93d1)[_0x403f('0x26')](function(_0x5c33bf){return _0x5c33bf;});}return null;};}function removeEntity(_0x2e4fe6,_0x2977aa){return function(_0x21500c){if(_0x21500c){return _0x21500c[_0x403f('0x27')]()[_0x403f('0x26')](function(){var _0x52523c=_0x21500c[_0x403f('0x28')]({'plain':!![]});var _0x562462=_0x403f('0x29');return db[_0x403f('0x2a')][_0x403f('0x27')]({'where':{'type':_0x562462,'resourceId':_0x52523c['id']}})[_0x403f('0x26')](function(){return _0x21500c;});})[_0x403f('0x26')](function(){_0x2e4fe6[_0x403f('0x1a')](0xcc)[_0x403f('0x1b')]();});}};}function handleEntityNotFound(_0x42aee9,_0x2de6d5){return function(_0x3db145){if(!_0x3db145){_0x42aee9[_0x403f('0x2b')](0x194);}return _0x3db145;};}function handleError(_0x50c688,_0x3a1585){_0x3a1585=_0x3a1585||0x1f4;return function(_0x55e20d){logger[_0x403f('0x2c')](_0x55e20d[_0x403f('0x2d')]);if(_0x55e20d[_0x403f('0x2e')]){delete _0x55e20d[_0x403f('0x2e')];}_0x50c688[_0x403f('0x1a')](_0x3a1585)[_0x403f('0x2f')](_0x55e20d);};}exports[_0x403f('0x30')]=function(_0x1c7f41,_0x306dbb){var _0x5793eb={},_0x55cb5d={},_0x386611={'count':0x0,'rows':[]};var _0x3a9a4b=_[_0x403f('0x31')](db['Schedule']['rawAttributes'],function(_0x16af04){return{'name':_0x16af04[_0x403f('0x32')],'type':_0x16af04[_0x403f('0x33')][_0x403f('0x34')]};});_0x55cb5d[_0x403f('0x35')]=_['map'](_0x3a9a4b,_0x403f('0x2e'));_0x55cb5d['query']=_[_0x403f('0x36')](_0x1c7f41[_0x403f('0x37')]);_0x55cb5d['filters']=_[_0x403f('0x38')](_0x55cb5d[_0x403f('0x35')],_0x55cb5d[_0x403f('0x37')]);_0x5793eb[_0x403f('0x39')]=_[_0x403f('0x38')](_0x55cb5d[_0x403f('0x35')],qs[_0x403f('0x3a')](_0x1c7f41['query'][_0x403f('0x3a')]));_0x5793eb[_0x403f('0x39')]=_0x5793eb['attributes'][_0x403f('0x3b')]?_0x5793eb['attributes']:_0x55cb5d['model'];if(!_0x1c7f41['query'][_0x403f('0x3c')](_0x403f('0x3d'))){_0x5793eb[_0x403f('0x20')]=qs[_0x403f('0x20')](_0x1c7f41[_0x403f('0x37')][_0x403f('0x20')]);_0x5793eb[_0x403f('0x1d')]=qs[_0x403f('0x1d')](_0x1c7f41['query'][_0x403f('0x1d')]);}_0x5793eb[_0x403f('0x3e')]=qs[_0x403f('0x3f')](_0x1c7f41['query']['sort']);_0x5793eb['where']=qs[_0x403f('0x40')](_[_0x403f('0x41')](_0x1c7f41[_0x403f('0x37')],_0x55cb5d['filters']),_0x3a9a4b);if(_0x1c7f41[_0x403f('0x37')][_0x403f('0x42')]){_0x5793eb[_0x403f('0x43')]=_[_0x403f('0x44')](_0x5793eb[_0x403f('0x43')],{'$or':_['map'](_0x3a9a4b,function(_0x4ae18c){if(_0x4ae18c[_0x403f('0x33')]!=='VIRTUAL'){var _0x17f0f4={};_0x17f0f4[_0x4ae18c['name']]={'$like':'%'+_0x1c7f41[_0x403f('0x37')][_0x403f('0x42')]+'%'};return _0x17f0f4;}})});}_0x5793eb=_['merge']({},_0x5793eb,_0x1c7f41[_0x403f('0x45')]);var _0x30da2b={'where':_0x5793eb[_0x403f('0x43')]};return db['Schedule'][_0x403f('0x1f')](_0x30da2b)[_0x403f('0x26')](function(_0x24c37e){_0x386611[_0x403f('0x1f')]=_0x24c37e;if(_0x1c7f41[_0x403f('0x37')][_0x403f('0x46')]){_0x5793eb[_0x403f('0x47')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x5793eb);})[_0x403f('0x26')](function(_0x5d8101){_0x386611[_0x403f('0x48')]=_0x5d8101;return _0x386611;})[_0x403f('0x26')](respondWithFilteredResult(_0x306dbb,_0x5793eb))['catch'](handleError(_0x306dbb,null));};exports[_0x403f('0x49')]=function(_0x52901b,_0x2346e3){var _0xc31c98={'raw':![],'where':{'id':_0x52901b[_0x403f('0x4a')]['id']}},_0x51b7eb={};_0x51b7eb[_0x403f('0x35')]=_[_0x403f('0x36')](db[_0x403f('0x4b')]['rawAttributes']);_0x51b7eb[_0x403f('0x37')]=_[_0x403f('0x36')](_0x52901b[_0x403f('0x37')]);_0x51b7eb[_0x403f('0x40')]=_['intersection'](_0x51b7eb['model'],_0x51b7eb[_0x403f('0x37')]);_0xc31c98[_0x403f('0x39')]=_[_0x403f('0x38')](_0x51b7eb[_0x403f('0x35')],qs[_0x403f('0x3a')](_0x52901b['query'][_0x403f('0x3a')]));_0xc31c98[_0x403f('0x39')]=_0xc31c98[_0x403f('0x39')]['length']?_0xc31c98[_0x403f('0x39')]:_0x51b7eb['model'];if(_0x52901b[_0x403f('0x37')][_0x403f('0x46')]){_0xc31c98['include']=[{'all':!![]}];}_0xc31c98=_[_0x403f('0x44')]({},_0xc31c98,_0x52901b[_0x403f('0x45')]);return db[_0x403f('0x4b')][_0x403f('0x4c')](_0xc31c98)[_0x403f('0x26')](handleEntityNotFound(_0x2346e3,null))[_0x403f('0x26')](respondWithResult(_0x2346e3,null))[_0x403f('0x4d')](handleError(_0x2346e3,null));};exports['create']=function(_0x2febdd,_0x1b9101){return db[_0x403f('0x4b')][_0x403f('0x4e')](_0x2febdd[_0x403f('0x4f')],{})[_0x403f('0x26')](function(_0x5d12e6){var _0x224f2f=_0x2febdd['user'][_0x403f('0x28')]({'plain':!![]});if(!_0x224f2f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x224f2f[_0x403f('0x50')]==='user'){var _0x46d865=_0x5d12e6[_0x403f('0x28')]({'plain':!![]});var _0xd3da08=_0x403f('0x29');return db[_0x403f('0x51')][_0x403f('0x4c')]({'where':{'name':_0xd3da08,'userProfileId':_0x224f2f[_0x403f('0x52')]},'raw':!![]})[_0x403f('0x26')](function(_0x3bb965){if(_0x3bb965&&_0x3bb965[_0x403f('0x53')]===0x0){return db['UserProfileResource'][_0x403f('0x4e')]({'name':_0x46d865['name'],'resourceId':_0x46d865['id'],'type':_0x3bb965[_0x403f('0x2e')],'sectionId':_0x3bb965['id']},{})[_0x403f('0x26')](function(){return _0x5d12e6;});}else{return _0x5d12e6;}})[_0x403f('0x4d')](function(_0xa24407){logger[_0x403f('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa24407);throw _0xa24407;});}return _0x5d12e6;})[_0x403f('0x26')](respondWithResult(_0x1b9101,0xc9))['catch'](handleError(_0x1b9101,null));};exports[_0x403f('0x25')]=function(_0x431708,_0x3679de){if(_0x431708['body']['id']){delete _0x431708['body']['id'];}return db[_0x403f('0x4b')][_0x403f('0x4c')]({'where':{'id':_0x431708[_0x403f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3679de,null))[_0x403f('0x26')](saveUpdates(_0x431708[_0x403f('0x4f')],null))[_0x403f('0x26')](respondWithResult(_0x3679de,null))['catch'](handleError(_0x3679de,null));};exports[_0x403f('0x27')]=function(_0x5c101b,_0x3e71e6){return db[_0x403f('0x4b')][_0x403f('0x4c')]({'where':{'id':_0x5c101b[_0x403f('0x4a')]['id']}})[_0x403f('0x26')](handleEntityNotFound(_0x3e71e6,null))[_0x403f('0x26')](removeEntity(_0x3e71e6,null))[_0x403f('0x4d')](handleError(_0x3e71e6,null));};exports[_0x403f('0x54')]=function(_0x2616de,_0xf94f68,_0x5584b4){var _0x4b8e07=require(_0x403f('0x55'));return db[_0x403f('0x4b')]['find']({'where':{'id':_0x2616de['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0xf94f68,null))[_0x403f('0x26')](function(){_0x4b8e07[_0x403f('0x54')](_0x2616de[_0x403f('0x4a')]['id']);})[_0x403f('0x26')](respondWithStatusCode(_0xf94f68,null))[_0x403f('0x4d')](handleError(_0xf94f68,null));};
\ No newline at end of file
+var _0xffa5=['type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','Schedule','include','rows','catch','show','params','rawAttributes','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','../../config/schedule','run','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','index','map'];(function(_0x42d42a,_0x518c7e){var _0x56bacf=function(_0xbdfd40){while(--_0xbdfd40){_0x42d42a['push'](_0x42d42a['shift']());}};_0x56bacf(++_0x518c7e);}(_0xffa5,0x76));var _0x5ffa=function(_0x48c0d9,_0x422b62){_0x48c0d9=_0x48c0d9-0x0;var _0x54b2e0=_0xffa5[_0x48c0d9];return _0x54b2e0;};'use strict';var emlformat=require(_0x5ffa('0x0'));var rimraf=require(_0x5ffa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ffa('0x2'));var rp=require('request-promise');var moment=require(_0x5ffa('0x3'));var BPromise=require(_0x5ffa('0x4'));var Mustache=require(_0x5ffa('0x5'));var util=require('util');var path=require(_0x5ffa('0x6'));var sox=require(_0x5ffa('0x7'));var csv=require(_0x5ffa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ffa('0x9'));var _=require(_0x5ffa('0xa'));var squel=require(_0x5ffa('0xb'));var crypto=require('crypto');var jsforce=require(_0x5ffa('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5ffa('0xd'));var Papa=require(_0x5ffa('0xe'));var Redis=require(_0x5ffa('0xf'));var authService=require(_0x5ffa('0x10'));var qs=require(_0x5ffa('0x11'));var as=require(_0x5ffa('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5ffa('0x13'));var utils=require(_0x5ffa('0x14'));var config=require(_0x5ffa('0x15'));var licenseUtil=require(_0x5ffa('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4beed9,_0x103688){_0x103688=_0x103688||0xcc;return function(_0x51fd50){if(_0x51fd50){return _0x4beed9[_0x5ffa('0x17')](_0x103688);}return _0x4beed9[_0x5ffa('0x18')](_0x103688)[_0x5ffa('0x19')]();};}function respondWithResult(_0x4607ee,_0x4d718e){_0x4d718e=_0x4d718e||0xc8;return function(_0x413e10){if(_0x413e10){return _0x4607ee[_0x5ffa('0x18')](_0x4d718e)['json'](_0x413e10);}};}function respondWithFilteredResult(_0x4d6c27,_0x206ec0){return function(_0x3a7655){if(_0x3a7655){var _0x3c4783=typeof _0x206ec0['offset']===_0x5ffa('0x1a')&&typeof _0x206ec0[_0x5ffa('0x1b')]===_0x5ffa('0x1a');var _0x4246e9=_0x3a7655[_0x5ffa('0x1c')];var _0x3402cd=_0x3c4783?0x0:_0x206ec0[_0x5ffa('0x1d')];var _0x134a3b=_0x3c4783?_0x3a7655[_0x5ffa('0x1c')]:_0x206ec0[_0x5ffa('0x1d')]+_0x206ec0[_0x5ffa('0x1b')];var _0x3f6411;if(_0x134a3b>=_0x4246e9){_0x134a3b=_0x4246e9;_0x3f6411=0xc8;}else{_0x3f6411=0xce;}_0x4d6c27['status'](_0x3f6411);return _0x4d6c27[_0x5ffa('0x1e')](_0x5ffa('0x1f'),_0x3402cd+'-'+_0x134a3b+'/'+_0x4246e9)[_0x5ffa('0x20')](_0x3a7655);}return null;};}function patchUpdates(_0x574865){return function(_0x3abcff){try{jsonpatch[_0x5ffa('0x21')](_0x3abcff,_0x574865,!![]);}catch(_0x11630d){return BPromise[_0x5ffa('0x22')](_0x11630d);}return _0x3abcff[_0x5ffa('0x23')]();};}function saveUpdates(_0x5d0039,_0x6469df){return function(_0x1c0fca){if(_0x1c0fca){return _0x1c0fca[_0x5ffa('0x24')](_0x5d0039)[_0x5ffa('0x25')](function(_0x3ff4b9){return _0x3ff4b9;});}return null;};}function removeEntity(_0xd040b0,_0x4e1fdf){return function(_0x18ce52){if(_0x18ce52){return _0x18ce52[_0x5ffa('0x26')]()[_0x5ffa('0x25')](function(){var _0x311f5d=_0x18ce52[_0x5ffa('0x27')]({'plain':!![]});var _0x3d4140=_0x5ffa('0x28');return db[_0x5ffa('0x29')][_0x5ffa('0x26')]({'where':{'type':_0x3d4140,'resourceId':_0x311f5d['id']}})[_0x5ffa('0x25')](function(){return _0x18ce52;});})[_0x5ffa('0x25')](function(){_0xd040b0[_0x5ffa('0x18')](0xcc)[_0x5ffa('0x19')]();});}};}function handleEntityNotFound(_0x11701b,_0x48aa65){return function(_0x21d287){if(!_0x21d287){_0x11701b[_0x5ffa('0x17')](0x194);}return _0x21d287;};}function handleError(_0x1b6a26,_0x1b78a3){_0x1b78a3=_0x1b78a3||0x1f4;return function(_0xd8eb38){logger[_0x5ffa('0x2a')](_0xd8eb38[_0x5ffa('0x2b')]);if(_0xd8eb38['name']){delete _0xd8eb38[_0x5ffa('0x2c')];}_0x1b6a26[_0x5ffa('0x18')](_0x1b78a3)[_0x5ffa('0x2d')](_0xd8eb38);};}exports[_0x5ffa('0x2e')]=function(_0x29ca9a,_0x5e93b5){var _0x1b9fc4={},_0x203d77={},_0x332da5={'count':0x0,'rows':[]};var _0x587b7d=_[_0x5ffa('0x2f')](db['Schedule']['rawAttributes'],function(_0x19af43){return{'name':_0x19af43['fieldName'],'type':_0x19af43[_0x5ffa('0x30')]['key']};});_0x203d77[_0x5ffa('0x31')]=_[_0x5ffa('0x2f')](_0x587b7d,'name');_0x203d77[_0x5ffa('0x32')]=_[_0x5ffa('0x33')](_0x29ca9a[_0x5ffa('0x32')]);_0x203d77['filters']=_[_0x5ffa('0x34')](_0x203d77['model'],_0x203d77[_0x5ffa('0x32')]);_0x1b9fc4[_0x5ffa('0x35')]=_[_0x5ffa('0x34')](_0x203d77[_0x5ffa('0x31')],qs[_0x5ffa('0x36')](_0x29ca9a[_0x5ffa('0x32')]['fields']));_0x1b9fc4['attributes']=_0x1b9fc4[_0x5ffa('0x35')][_0x5ffa('0x37')]?_0x1b9fc4['attributes']:_0x203d77[_0x5ffa('0x31')];if(!_0x29ca9a[_0x5ffa('0x32')][_0x5ffa('0x38')](_0x5ffa('0x39'))){_0x1b9fc4[_0x5ffa('0x1b')]=qs[_0x5ffa('0x1b')](_0x29ca9a[_0x5ffa('0x32')][_0x5ffa('0x1b')]);_0x1b9fc4[_0x5ffa('0x1d')]=qs['offset'](_0x29ca9a[_0x5ffa('0x32')][_0x5ffa('0x1d')]);}_0x1b9fc4['order']=qs[_0x5ffa('0x3a')](_0x29ca9a['query'][_0x5ffa('0x3a')]);_0x1b9fc4[_0x5ffa('0x3b')]=qs[_0x5ffa('0x3c')](_['pick'](_0x29ca9a[_0x5ffa('0x32')],_0x203d77[_0x5ffa('0x3c')]),_0x587b7d);if(_0x29ca9a['query'][_0x5ffa('0x3d')]){_0x1b9fc4['where']=_[_0x5ffa('0x3e')](_0x1b9fc4[_0x5ffa('0x3b')],{'$or':_[_0x5ffa('0x2f')](_0x587b7d,function(_0x49dd11){if(_0x49dd11['type']!=='VIRTUAL'){var _0x2656c1={};_0x2656c1[_0x49dd11['name']]={'$like':'%'+_0x29ca9a[_0x5ffa('0x32')][_0x5ffa('0x3d')]+'%'};return _0x2656c1;}})});}_0x1b9fc4=_[_0x5ffa('0x3e')]({},_0x1b9fc4,_0x29ca9a[_0x5ffa('0x3f')]);var _0x4bfd54={'where':_0x1b9fc4['where']};return db[_0x5ffa('0x40')][_0x5ffa('0x1c')](_0x4bfd54)[_0x5ffa('0x25')](function(_0x7a51be){_0x332da5[_0x5ffa('0x1c')]=_0x7a51be;if(_0x29ca9a[_0x5ffa('0x32')]['includeAll']){_0x1b9fc4[_0x5ffa('0x41')]=[{'all':!![]}];}return db[_0x5ffa('0x40')]['findAll'](_0x1b9fc4);})[_0x5ffa('0x25')](function(_0x4d2f1f){_0x332da5[_0x5ffa('0x42')]=_0x4d2f1f;return _0x332da5;})[_0x5ffa('0x25')](respondWithFilteredResult(_0x5e93b5,_0x1b9fc4))[_0x5ffa('0x43')](handleError(_0x5e93b5,null));};exports[_0x5ffa('0x44')]=function(_0x3529bc,_0x3010c3){var _0x4a5dbc={'raw':![],'where':{'id':_0x3529bc[_0x5ffa('0x45')]['id']}},_0x14a051={};_0x14a051[_0x5ffa('0x31')]=_['keys'](db[_0x5ffa('0x40')][_0x5ffa('0x46')]);_0x14a051[_0x5ffa('0x32')]=_['keys'](_0x3529bc[_0x5ffa('0x32')]);_0x14a051[_0x5ffa('0x3c')]=_['intersection'](_0x14a051[_0x5ffa('0x31')],_0x14a051[_0x5ffa('0x32')]);_0x4a5dbc['attributes']=_[_0x5ffa('0x34')](_0x14a051[_0x5ffa('0x31')],qs[_0x5ffa('0x36')](_0x3529bc[_0x5ffa('0x32')]['fields']));_0x4a5dbc['attributes']=_0x4a5dbc[_0x5ffa('0x35')][_0x5ffa('0x37')]?_0x4a5dbc['attributes']:_0x14a051[_0x5ffa('0x31')];if(_0x3529bc['query'][_0x5ffa('0x47')]){_0x4a5dbc['include']=[{'all':!![]}];}_0x4a5dbc=_['merge']({},_0x4a5dbc,_0x3529bc[_0x5ffa('0x3f')]);return db[_0x5ffa('0x40')][_0x5ffa('0x48')](_0x4a5dbc)[_0x5ffa('0x25')](handleEntityNotFound(_0x3010c3,null))[_0x5ffa('0x25')](respondWithResult(_0x3010c3,null))['catch'](handleError(_0x3010c3,null));};exports[_0x5ffa('0x49')]=function(_0x24d794,_0x1d3767){return db[_0x5ffa('0x40')]['create'](_0x24d794['body'],{})[_0x5ffa('0x25')](function(_0x107031){var _0x3fa815=_0x24d794[_0x5ffa('0x4a')][_0x5ffa('0x27')]({'plain':!![]});if(!_0x3fa815)throw new Error(_0x5ffa('0x4b'));if(_0x3fa815[_0x5ffa('0x4c')]===_0x5ffa('0x4a')){var _0x435331=_0x107031[_0x5ffa('0x27')]({'plain':!![]});var _0x1aedc5='Scheduler';return db[_0x5ffa('0x4d')][_0x5ffa('0x48')]({'where':{'name':_0x1aedc5,'userProfileId':_0x3fa815[_0x5ffa('0x4e')]},'raw':!![]})[_0x5ffa('0x25')](function(_0x5b1ebd){if(_0x5b1ebd&&_0x5b1ebd['autoAssociation']===0x0){return db[_0x5ffa('0x29')]['create']({'name':_0x435331[_0x5ffa('0x2c')],'resourceId':_0x435331['id'],'type':_0x5b1ebd[_0x5ffa('0x2c')],'sectionId':_0x5b1ebd['id']},{})[_0x5ffa('0x25')](function(){return _0x107031;});}else{return _0x107031;}})['catch'](function(_0x49ab2d){logger[_0x5ffa('0x2a')](_0x5ffa('0x4f'),_0x49ab2d);throw _0x49ab2d;});}return _0x107031;})[_0x5ffa('0x25')](respondWithResult(_0x1d3767,0xc9))[_0x5ffa('0x43')](handleError(_0x1d3767,null));};exports[_0x5ffa('0x24')]=function(_0x5cc361,_0x39f2f7){if(_0x5cc361[_0x5ffa('0x50')]['id']){delete _0x5cc361[_0x5ffa('0x50')]['id'];}return db[_0x5ffa('0x40')][_0x5ffa('0x48')]({'where':{'id':_0x5cc361[_0x5ffa('0x45')]['id']}})['then'](handleEntityNotFound(_0x39f2f7,null))[_0x5ffa('0x25')](saveUpdates(_0x5cc361[_0x5ffa('0x50')],null))[_0x5ffa('0x25')](respondWithResult(_0x39f2f7,null))[_0x5ffa('0x43')](handleError(_0x39f2f7,null));};exports[_0x5ffa('0x26')]=function(_0x1b295e,_0x178f67){return db[_0x5ffa('0x40')]['find']({'where':{'id':_0x1b295e['params']['id']}})[_0x5ffa('0x25')](handleEntityNotFound(_0x178f67,null))['then'](removeEntity(_0x178f67,null))['catch'](handleError(_0x178f67,null));};exports['run']=function(_0x87bd1f,_0x463a1e,_0x290767){var _0x583ccd=require(_0x5ffa('0x51'));return db[_0x5ffa('0x40')]['find']({'where':{'id':_0x87bd1f[_0x5ffa('0x45')]['id']},'raw':!![]})[_0x5ffa('0x25')](handleEntityNotFound(_0x463a1e,null))[_0x5ffa('0x25')](function(){_0x583ccd[_0x5ffa('0x52')](_0x87bd1f[_0x5ffa('0x45')]['id']);})['then'](respondWithStatusCode(_0x463a1e,null))['catch'](handleError(_0x463a1e,null));};
\ No newline at end of file