Built motion from commit eddce310.|2.6.12
[motion2.git] / server / api / schedule / schedule.controller.js
index 8e852fc..97197e2 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 _0xc01b=['rawAttributes','fieldName','type','model','map','keys','query','intersection','attributes','fields','length','nolimit','sort','where','filters','VIRTUAL','filter','merge','Schedule','rows','catch','show','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','stack','name','send','index'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xc01b,0xcc));var _0xbc01=function(_0x40a45a,_0x1c3551){_0x40a45a=_0x40a45a-0x0;var _0xdea9d8=_0xc01b[_0x40a45a];return _0xdea9d8;};'use strict';var emlformat=require(_0xbc01('0x0'));var rimraf=require(_0xbc01('0x1'));var zipdir=require(_0xbc01('0x2'));var jsonpatch=require(_0xbc01('0x3'));var rp=require(_0xbc01('0x4'));var moment=require('moment');var BPromise=require(_0xbc01('0x5'));var Mustache=require(_0xbc01('0x6'));var util=require('util');var path=require(_0xbc01('0x7'));var sox=require('sox');var csv=require(_0xbc01('0x8'));var ejs=require(_0xbc01('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc01('0xa'));var squel=require(_0xbc01('0xb'));var crypto=require('crypto');var jsforce=require(_0xbc01('0xc'));var deskjs=require(_0xbc01('0xd'));var toCsv=require(_0xbc01('0x8'));var querystring=require(_0xbc01('0xe'));var Papa=require(_0xbc01('0xf'));var Redis=require(_0xbc01('0x10'));var authService=require(_0xbc01('0x11'));var qs=require(_0xbc01('0x12'));var as=require(_0xbc01('0x13'));var hardwareService=require(_0xbc01('0x14'));var logger=require(_0xbc01('0x15'))(_0xbc01('0x16'));var utils=require('../../config/utils');var config=require(_0xbc01('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc01('0x18'))['db'];function respondWithStatusCode(_0x354819,_0x21f49f){_0x21f49f=_0x21f49f||0xcc;return function(_0x57402b){if(_0x57402b){return _0x354819['sendStatus'](_0x21f49f);}return _0x354819[_0xbc01('0x19')](_0x21f49f)[_0xbc01('0x1a')]();};}function respondWithResult(_0x41e799,_0x40b6c9){_0x40b6c9=_0x40b6c9||0xc8;return function(_0x1fd785){if(_0x1fd785){return _0x41e799[_0xbc01('0x19')](_0x40b6c9)[_0xbc01('0x1b')](_0x1fd785);}};}function respondWithFilteredResult(_0x1b2470,_0x1d959b){return function(_0x5962a9){if(_0x5962a9){var _0x5349d9=typeof _0x1d959b['offset']===_0xbc01('0x1c')&&typeof _0x1d959b[_0xbc01('0x1d')]===_0xbc01('0x1c');var _0x284138=_0x5962a9['count'];var _0x2d0b37=_0x5349d9?0x0:_0x1d959b[_0xbc01('0x1e')];var _0xaaa9ba=_0x5349d9?_0x5962a9[_0xbc01('0x1f')]:_0x1d959b['offset']+_0x1d959b[_0xbc01('0x1d')];var _0x27c264;if(_0xaaa9ba>=_0x284138){_0xaaa9ba=_0x284138;_0x27c264=0xc8;}else{_0x27c264=0xce;}_0x1b2470[_0xbc01('0x19')](_0x27c264);return _0x1b2470[_0xbc01('0x20')](_0xbc01('0x21'),_0x2d0b37+'-'+_0xaaa9ba+'/'+_0x284138)[_0xbc01('0x1b')](_0x5962a9);}return null;};}function patchUpdates(_0x413e91){return function(_0x1a29b2){try{jsonpatch[_0xbc01('0x22')](_0x1a29b2,_0x413e91,!![]);}catch(_0x21ff03){return BPromise[_0xbc01('0x23')](_0x21ff03);}return _0x1a29b2['save']();};}function saveUpdates(_0x4b0bfa,_0x2cd369){return function(_0x5b6d57){if(_0x5b6d57){return _0x5b6d57[_0xbc01('0x24')](_0x4b0bfa)[_0xbc01('0x25')](function(_0x41d0f5){return _0x41d0f5;});}return null;};}function removeEntity(_0x56832b,_0x1c0732){return function(_0x7da9c4){if(_0x7da9c4){return _0x7da9c4[_0xbc01('0x26')]()[_0xbc01('0x25')](function(){var _0x1c2aa0=_0x7da9c4[_0xbc01('0x27')]({'plain':!![]});var _0x21034f=_0xbc01('0x28');return db[_0xbc01('0x29')][_0xbc01('0x26')]({'where':{'type':_0x21034f,'resourceId':_0x1c2aa0['id']}})['then'](function(){return _0x7da9c4;});})[_0xbc01('0x25')](function(){_0x56832b[_0xbc01('0x19')](0xcc)[_0xbc01('0x1a')]();});}};}function handleEntityNotFound(_0x5c2c73,_0x692e21){return function(_0x1786ad){if(!_0x1786ad){_0x5c2c73[_0xbc01('0x2a')](0x194);}return _0x1786ad;};}function handleError(_0x4e0138,_0x24bb9f){_0x24bb9f=_0x24bb9f||0x1f4;return function(_0xb02c3c){logger[_0xbc01('0x2b')](_0xb02c3c[_0xbc01('0x2c')]);if(_0xb02c3c['name']){delete _0xb02c3c[_0xbc01('0x2d')];}_0x4e0138[_0xbc01('0x19')](_0x24bb9f)[_0xbc01('0x2e')](_0xb02c3c);};}exports[_0xbc01('0x2f')]=function(_0x28f0e7,_0x47ed9f){var _0x35659d={},_0x2fe832={},_0x550612={'count':0x0,'rows':[]};var _0x5f373b=_['map'](db['Schedule'][_0xbc01('0x30')],function(_0x226f64){return{'name':_0x226f64[_0xbc01('0x31')],'type':_0x226f64[_0xbc01('0x32')]['key']};});_0x2fe832[_0xbc01('0x33')]=_[_0xbc01('0x34')](_0x5f373b,_0xbc01('0x2d'));_0x2fe832['query']=_[_0xbc01('0x35')](_0x28f0e7[_0xbc01('0x36')]);_0x2fe832['filters']=_[_0xbc01('0x37')](_0x2fe832[_0xbc01('0x33')],_0x2fe832[_0xbc01('0x36')]);_0x35659d[_0xbc01('0x38')]=_[_0xbc01('0x37')](_0x2fe832[_0xbc01('0x33')],qs['fields'](_0x28f0e7['query'][_0xbc01('0x39')]));_0x35659d[_0xbc01('0x38')]=_0x35659d[_0xbc01('0x38')][_0xbc01('0x3a')]?_0x35659d['attributes']:_0x2fe832[_0xbc01('0x33')];if(!_0x28f0e7[_0xbc01('0x36')]['hasOwnProperty'](_0xbc01('0x3b'))){_0x35659d[_0xbc01('0x1d')]=qs[_0xbc01('0x1d')](_0x28f0e7[_0xbc01('0x36')]['limit']);_0x35659d[_0xbc01('0x1e')]=qs[_0xbc01('0x1e')](_0x28f0e7[_0xbc01('0x36')][_0xbc01('0x1e')]);}_0x35659d['order']=qs[_0xbc01('0x3c')](_0x28f0e7[_0xbc01('0x36')]['sort']);_0x35659d[_0xbc01('0x3d')]=qs[_0xbc01('0x3e')](_['pick'](_0x28f0e7[_0xbc01('0x36')],_0x2fe832[_0xbc01('0x3e')]),_0x5f373b);if(_0x28f0e7[_0xbc01('0x36')]['filter']){_0x35659d[_0xbc01('0x3d')]=_['merge'](_0x35659d[_0xbc01('0x3d')],{'$or':_[_0xbc01('0x34')](_0x5f373b,function(_0x53fb55){if(_0x53fb55[_0xbc01('0x32')]!==_0xbc01('0x3f')){var _0x244c70={};_0x244c70[_0x53fb55['name']]={'$like':'%'+_0x28f0e7[_0xbc01('0x36')][_0xbc01('0x40')]+'%'};return _0x244c70;}})});}_0x35659d=_[_0xbc01('0x41')]({},_0x35659d,_0x28f0e7['options']);var _0x165945={'where':_0x35659d[_0xbc01('0x3d')]};return db[_0xbc01('0x42')][_0xbc01('0x1f')](_0x165945)[_0xbc01('0x25')](function(_0x289b0d){_0x550612[_0xbc01('0x1f')]=_0x289b0d;if(_0x28f0e7[_0xbc01('0x36')]['includeAll']){_0x35659d['include']=[{'all':!![]}];}return db['Schedule']['findAll'](_0x35659d);})[_0xbc01('0x25')](function(_0x15da42){_0x550612[_0xbc01('0x43')]=_0x15da42;return _0x550612;})[_0xbc01('0x25')](respondWithFilteredResult(_0x47ed9f,_0x35659d))[_0xbc01('0x44')](handleError(_0x47ed9f,null));};exports[_0xbc01('0x45')]=function(_0x4a7604,_0x15deaa){var _0x444928={'raw':![],'where':{'id':_0x4a7604['params']['id']}},_0x3366a2={};_0x3366a2[_0xbc01('0x33')]=_[_0xbc01('0x35')](db[_0xbc01('0x42')][_0xbc01('0x30')]);_0x3366a2['query']=_['keys'](_0x4a7604[_0xbc01('0x36')]);_0x3366a2[_0xbc01('0x3e')]=_[_0xbc01('0x37')](_0x3366a2[_0xbc01('0x33')],_0x3366a2[_0xbc01('0x36')]);_0x444928[_0xbc01('0x38')]=_[_0xbc01('0x37')](_0x3366a2[_0xbc01('0x33')],qs[_0xbc01('0x39')](_0x4a7604[_0xbc01('0x36')][_0xbc01('0x39')]));_0x444928['attributes']=_0x444928[_0xbc01('0x38')]['length']?_0x444928[_0xbc01('0x38')]:_0x3366a2[_0xbc01('0x33')];if(_0x4a7604[_0xbc01('0x36')][_0xbc01('0x46')]){_0x444928['include']=[{'all':!![]}];}_0x444928=_[_0xbc01('0x41')]({},_0x444928,_0x4a7604[_0xbc01('0x47')]);return db[_0xbc01('0x42')][_0xbc01('0x48')](_0x444928)['then'](handleEntityNotFound(_0x15deaa,null))['then'](respondWithResult(_0x15deaa,null))[_0xbc01('0x44')](handleError(_0x15deaa,null));};exports[_0xbc01('0x49')]=function(_0x3bf33e,_0x2b580f){return db[_0xbc01('0x42')]['create'](_0x3bf33e[_0xbc01('0x4a')],{})['then'](function(_0x2b3bcf){var _0xe139ff=_0x3bf33e[_0xbc01('0x4b')][_0xbc01('0x27')]({'plain':!![]});if(!_0xe139ff)throw new Error(_0xbc01('0x4c'));if(_0xe139ff[_0xbc01('0x4d')]===_0xbc01('0x4b')){var _0x5014ff=_0x2b3bcf[_0xbc01('0x27')]({'plain':!![]});var _0x4158ac=_0xbc01('0x28');return db[_0xbc01('0x4e')][_0xbc01('0x48')]({'where':{'name':_0x4158ac,'userProfileId':_0xe139ff[_0xbc01('0x4f')]},'raw':!![]})['then'](function(_0x1e8a2c){if(_0x1e8a2c&&_0x1e8a2c[_0xbc01('0x50')]===0x0){return db[_0xbc01('0x29')][_0xbc01('0x49')]({'name':_0x5014ff[_0xbc01('0x2d')],'resourceId':_0x5014ff['id'],'type':_0x1e8a2c[_0xbc01('0x2d')],'sectionId':_0x1e8a2c['id']},{})['then'](function(){return _0x2b3bcf;});}else{return _0x2b3bcf;}})['catch'](function(_0x5af608){logger[_0xbc01('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5af608);throw _0x5af608;});}return _0x2b3bcf;})['then'](respondWithResult(_0x2b580f,0xc9))[_0xbc01('0x44')](handleError(_0x2b580f,null));};exports['update']=function(_0x3d5e1c,_0x1c4d0b){if(_0x3d5e1c[_0xbc01('0x4a')]['id']){delete _0x3d5e1c[_0xbc01('0x4a')]['id'];}return db[_0xbc01('0x42')]['find']({'where':{'id':_0x3d5e1c[_0xbc01('0x51')]['id']}})[_0xbc01('0x25')](handleEntityNotFound(_0x1c4d0b,null))['then'](saveUpdates(_0x3d5e1c['body'],null))[_0xbc01('0x25')](respondWithResult(_0x1c4d0b,null))[_0xbc01('0x44')](handleError(_0x1c4d0b,null));};exports['destroy']=function(_0x4bf1d3,_0x5195f8){return db[_0xbc01('0x42')][_0xbc01('0x48')]({'where':{'id':_0x4bf1d3['params']['id']}})['then'](handleEntityNotFound(_0x5195f8,null))[_0xbc01('0x25')](removeEntity(_0x5195f8,null))[_0xbc01('0x44')](handleError(_0x5195f8,null));};exports['run']=function(_0x6e4652,_0x481fde,_0x142b0f){var _0x236f7d=require(_0xbc01('0x52'));return db[_0xbc01('0x42')][_0xbc01('0x48')]({'where':{'id':_0x6e4652[_0xbc01('0x51')]['id']},'raw':!![]})[_0xbc01('0x25')](handleEntityNotFound(_0x481fde,null))['then'](function(){_0x236f7d[_0xbc01('0x53')](_0x6e4652['params']['id']);})['then'](respondWithStatusCode(_0x481fde,null))[_0xbc01('0x44')](handleError(_0x481fde,null));};
\ No newline at end of file