Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / schedule / schedule.controller.js
index 77d586e..3055a01 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3ea8=['params','user','get','role','UserProfileSection','find','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','Scheduler','UserProfileResource','then','stack','name','send','index','Schedule','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show'];(function(_0x4514b1,_0x5226ab){var _0x2db9d5=function(_0x2e2305){while(--_0x2e2305){_0x4514b1['push'](_0x4514b1['shift']());}};_0x2db9d5(++_0x5226ab);}(_0x3ea8,0x105));var _0x83ea=function(_0x298a79,_0x1749c3){_0x298a79=_0x298a79-0x0;var _0x275ad7=_0x3ea8[_0x298a79];return _0x275ad7;};'use strict';var emlformat=require(_0x83ea('0x0'));var rimraf=require(_0x83ea('0x1'));var zipdir=require(_0x83ea('0x2'));var jsonpatch=require(_0x83ea('0x3'));var rp=require(_0x83ea('0x4'));var moment=require(_0x83ea('0x5'));var BPromise=require(_0x83ea('0x6'));var Mustache=require(_0x83ea('0x7'));var util=require(_0x83ea('0x8'));var path=require('path');var sox=require(_0x83ea('0x9'));var csv=require(_0x83ea('0xa'));var ejs=require(_0x83ea('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x83ea('0xc'));var squel=require(_0x83ea('0xd'));var crypto=require(_0x83ea('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x83ea('0xf'));var toCsv=require(_0x83ea('0xa'));var querystring=require(_0x83ea('0x10'));var Papa=require(_0x83ea('0x11'));var Redis=require(_0x83ea('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x83ea('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x83ea('0x14'))(_0x83ea('0x15'));var utils=require(_0x83ea('0x16'));var config=require(_0x83ea('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49417f,_0x567a49){_0x567a49=_0x567a49||0xcc;return function(_0x4aa538){if(_0x4aa538){return _0x49417f[_0x83ea('0x18')](_0x567a49);}return _0x49417f['status'](_0x567a49)[_0x83ea('0x19')]();};}function respondWithResult(_0xf91086,_0x341eb2){_0x341eb2=_0x341eb2||0xc8;return function(_0x2645e3){if(_0x2645e3){return _0xf91086[_0x83ea('0x1a')](_0x341eb2)[_0x83ea('0x1b')](_0x2645e3);}};}function respondWithFilteredResult(_0x398c05,_0x4cc16e){return function(_0x13900c){if(_0x13900c){var _0x24c44e=typeof _0x4cc16e[_0x83ea('0x1c')]===_0x83ea('0x1d')&&typeof _0x4cc16e[_0x83ea('0x1e')]===_0x83ea('0x1d');var _0x1b70ed=_0x13900c[_0x83ea('0x1f')];var _0xc4ae72=_0x24c44e?0x0:_0x4cc16e[_0x83ea('0x1c')];var _0x35a2f7=_0x24c44e?_0x13900c[_0x83ea('0x1f')]:_0x4cc16e[_0x83ea('0x1c')]+_0x4cc16e['limit'];var _0x2b41c1;if(_0x35a2f7>=_0x1b70ed){_0x35a2f7=_0x1b70ed;_0x2b41c1=0xc8;}else{_0x2b41c1=0xce;}_0x398c05['status'](_0x2b41c1);return _0x398c05[_0x83ea('0x20')](_0x83ea('0x21'),_0xc4ae72+'-'+_0x35a2f7+'/'+_0x1b70ed)[_0x83ea('0x1b')](_0x13900c);}return null;};}function patchUpdates(_0x498ae3){return function(_0x590172){try{jsonpatch['apply'](_0x590172,_0x498ae3,!![]);}catch(_0x16638d){return BPromise['reject'](_0x16638d);}return _0x590172[_0x83ea('0x22')]();};}function saveUpdates(_0x4025b9,_0x5a9114){return function(_0x3c2358){if(_0x3c2358){return _0x3c2358[_0x83ea('0x23')](_0x4025b9)['then'](function(_0x37fd2f){return _0x37fd2f;});}return null;};}function removeEntity(_0x5d9ed5,_0x59af98){return function(_0x280e23){if(_0x280e23){return _0x280e23[_0x83ea('0x24')]()['then'](function(){var _0x2c9c86=_0x280e23['get']({'plain':!![]});var _0x5cf442=_0x83ea('0x25');return db[_0x83ea('0x26')][_0x83ea('0x24')]({'where':{'type':_0x5cf442,'resourceId':_0x2c9c86['id']}})[_0x83ea('0x27')](function(){return _0x280e23;});})[_0x83ea('0x27')](function(){_0x5d9ed5[_0x83ea('0x1a')](0xcc)[_0x83ea('0x19')]();});}};}function handleEntityNotFound(_0x25e61e,_0x3dbdf1){return function(_0x23e4f8){if(!_0x23e4f8){_0x25e61e[_0x83ea('0x18')](0x194);}return _0x23e4f8;};}function handleError(_0x2e7a98,_0x9dbad6){_0x9dbad6=_0x9dbad6||0x1f4;return function(_0x419920){logger['error'](_0x419920[_0x83ea('0x28')]);if(_0x419920[_0x83ea('0x29')]){delete _0x419920[_0x83ea('0x29')];}_0x2e7a98[_0x83ea('0x1a')](_0x9dbad6)[_0x83ea('0x2a')](_0x419920);};}exports[_0x83ea('0x2b')]=function(_0x72faaa,_0x5a909d){var _0x616428={},_0x2fb83a={},_0x41d7d0={'count':0x0,'rows':[]};var _0xdfa3d6=_['map'](db[_0x83ea('0x2c')][_0x83ea('0x2d')],function(_0x110ffa){return{'name':_0x110ffa[_0x83ea('0x2e')],'type':_0x110ffa[_0x83ea('0x2f')][_0x83ea('0x30')]};});_0x2fb83a[_0x83ea('0x31')]=_[_0x83ea('0x32')](_0xdfa3d6,_0x83ea('0x29'));_0x2fb83a[_0x83ea('0x33')]=_[_0x83ea('0x34')](_0x72faaa[_0x83ea('0x33')]);_0x2fb83a[_0x83ea('0x35')]=_[_0x83ea('0x36')](_0x2fb83a['model'],_0x2fb83a[_0x83ea('0x33')]);_0x616428['attributes']=_[_0x83ea('0x36')](_0x2fb83a['model'],qs[_0x83ea('0x37')](_0x72faaa[_0x83ea('0x33')][_0x83ea('0x37')]));_0x616428[_0x83ea('0x38')]=_0x616428['attributes'][_0x83ea('0x39')]?_0x616428[_0x83ea('0x38')]:_0x2fb83a['model'];if(!_0x72faaa['query']['hasOwnProperty'](_0x83ea('0x3a'))){_0x616428['limit']=qs[_0x83ea('0x1e')](_0x72faaa[_0x83ea('0x33')]['limit']);_0x616428[_0x83ea('0x1c')]=qs[_0x83ea('0x1c')](_0x72faaa[_0x83ea('0x33')][_0x83ea('0x1c')]);}_0x616428['order']=qs['sort'](_0x72faaa['query'][_0x83ea('0x3b')]);_0x616428[_0x83ea('0x3c')]=qs[_0x83ea('0x35')](_[_0x83ea('0x3d')](_0x72faaa[_0x83ea('0x33')],_0x2fb83a['filters']),_0xdfa3d6);if(_0x72faaa[_0x83ea('0x33')]['filter']){_0x616428[_0x83ea('0x3c')]=_[_0x83ea('0x3e')](_0x616428[_0x83ea('0x3c')],{'$or':_[_0x83ea('0x32')](_0xdfa3d6,function(_0x4fafe7){if(_0x4fafe7['type']!=='VIRTUAL'){var _0x48be5a={};_0x48be5a[_0x4fafe7[_0x83ea('0x29')]]={'$like':'%'+_0x72faaa[_0x83ea('0x33')][_0x83ea('0x3f')]+'%'};return _0x48be5a;}})});}_0x616428=_[_0x83ea('0x3e')]({},_0x616428,_0x72faaa[_0x83ea('0x40')]);var _0x555ee2={'where':_0x616428[_0x83ea('0x3c')]};return db[_0x83ea('0x2c')][_0x83ea('0x1f')](_0x555ee2)[_0x83ea('0x27')](function(_0xf66811){_0x41d7d0['count']=_0xf66811;if(_0x72faaa[_0x83ea('0x33')][_0x83ea('0x41')]){_0x616428[_0x83ea('0x42')]=[{'all':!![]}];}return db[_0x83ea('0x2c')][_0x83ea('0x43')](_0x616428);})['then'](function(_0x4f6ef5){_0x41d7d0[_0x83ea('0x44')]=_0x4f6ef5;return _0x41d7d0;})['then'](respondWithFilteredResult(_0x5a909d,_0x616428))[_0x83ea('0x45')](handleError(_0x5a909d,null));};exports[_0x83ea('0x46')]=function(_0x2394f5,_0x4903bf){var _0x731913={'raw':![],'where':{'id':_0x2394f5[_0x83ea('0x47')]['id']}},_0x52c80f={};_0x52c80f[_0x83ea('0x31')]=_['keys'](db[_0x83ea('0x2c')][_0x83ea('0x2d')]);_0x52c80f[_0x83ea('0x33')]=_[_0x83ea('0x34')](_0x2394f5['query']);_0x52c80f[_0x83ea('0x35')]=_[_0x83ea('0x36')](_0x52c80f['model'],_0x52c80f[_0x83ea('0x33')]);_0x731913['attributes']=_[_0x83ea('0x36')](_0x52c80f[_0x83ea('0x31')],qs[_0x83ea('0x37')](_0x2394f5[_0x83ea('0x33')][_0x83ea('0x37')]));_0x731913['attributes']=_0x731913[_0x83ea('0x38')][_0x83ea('0x39')]?_0x731913['attributes']:_0x52c80f[_0x83ea('0x31')];if(_0x2394f5['query'][_0x83ea('0x41')]){_0x731913[_0x83ea('0x42')]=[{'all':!![]}];}_0x731913=_['merge']({},_0x731913,_0x2394f5[_0x83ea('0x40')]);return db[_0x83ea('0x2c')]['find'](_0x731913)['then'](handleEntityNotFound(_0x4903bf,null))[_0x83ea('0x27')](respondWithResult(_0x4903bf,null))['catch'](handleError(_0x4903bf,null));};exports['create']=function(_0x2d1694,_0x177963){return db['Schedule']['create'](_0x2d1694['body'],{})[_0x83ea('0x27')](function(_0xe71117){var _0x450065=_0x2d1694[_0x83ea('0x48')][_0x83ea('0x49')]({'plain':!![]});if(!_0x450065)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x450065[_0x83ea('0x4a')]==='user'){var _0x6e0bd5=_0xe71117[_0x83ea('0x49')]({'plain':!![]});var _0x1d0794='Scheduler';return db[_0x83ea('0x4b')][_0x83ea('0x4c')]({'where':{'name':_0x1d0794,'userProfileId':_0x450065['userProfileId']},'raw':!![]})[_0x83ea('0x27')](function(_0x53021a){if(_0x53021a&&_0x53021a['autoAssociation']===0x0){return db[_0x83ea('0x26')][_0x83ea('0x4d')]({'name':_0x6e0bd5[_0x83ea('0x29')],'resourceId':_0x6e0bd5['id'],'type':_0x53021a['name'],'sectionId':_0x53021a['id']},{})['then'](function(){return _0xe71117;});}else{return _0xe71117;}})[_0x83ea('0x45')](function(_0x47d4cb){logger[_0x83ea('0x4e')](_0x83ea('0x4f'),_0x47d4cb);throw _0x47d4cb;});}return _0xe71117;})[_0x83ea('0x27')](respondWithResult(_0x177963,0xc9))[_0x83ea('0x45')](handleError(_0x177963,null));};exports['update']=function(_0x5bc543,_0x39a641){if(_0x5bc543['body']['id']){delete _0x5bc543['body']['id'];}return db[_0x83ea('0x2c')][_0x83ea('0x4c')]({'where':{'id':_0x5bc543[_0x83ea('0x47')]['id']}})[_0x83ea('0x27')](handleEntityNotFound(_0x39a641,null))[_0x83ea('0x27')](saveUpdates(_0x5bc543[_0x83ea('0x50')],null))[_0x83ea('0x27')](respondWithResult(_0x39a641,null))[_0x83ea('0x45')](handleError(_0x39a641,null));};exports[_0x83ea('0x24')]=function(_0x3c0ec1,_0x4297da){return db[_0x83ea('0x2c')][_0x83ea('0x4c')]({'where':{'id':_0x3c0ec1[_0x83ea('0x47')]['id']}})[_0x83ea('0x27')](handleEntityNotFound(_0x4297da,null))['then'](removeEntity(_0x4297da,null))['catch'](handleError(_0x4297da,null));};exports[_0x83ea('0x51')]=function(_0x2db415,_0x110970,_0x51e558){var _0x2c09c7=require(_0x83ea('0x52'));return db[_0x83ea('0x2c')][_0x83ea('0x4c')]({'where':{'id':_0x2db415[_0x83ea('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x110970,null))[_0x83ea('0x27')](function(){_0x2c09c7[_0x83ea('0x51')](_0x2db415['params']['id']);})['then'](respondWithStatusCode(_0x110970,null))[_0x83ea('0x45')](handleError(_0x110970,null));};
\ No newline at end of file
+var _0xfccc=['count','limit','set','Content-Range','apply','reject','save','update','Scheduler','UserProfileResource','destroy','then','stack','name','send','index','map','Schedule','rawAttributes','type','key','query','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x457681,_0x391b2c){var _0x322437=function(_0x2a0a95){while(--_0x2a0a95){_0x457681['push'](_0x457681['shift']());}};_0x322437(++_0x391b2c);}(_0xfccc,0xe6));var _0xcfcc=function(_0x3f25db,_0x1d3686){_0x3f25db=_0x3f25db-0x0;var _0x54f29d=_0xfccc[_0x3f25db];return _0x54f29d;};'use strict';var emlformat=require(_0xcfcc('0x0'));var rimraf=require(_0xcfcc('0x1'));var zipdir=require(_0xcfcc('0x2'));var jsonpatch=require(_0xcfcc('0x3'));var rp=require(_0xcfcc('0x4'));var moment=require('moment');var BPromise=require(_0xcfcc('0x5'));var Mustache=require(_0xcfcc('0x6'));var util=require(_0xcfcc('0x7'));var path=require('path');var sox=require(_0xcfcc('0x8'));var csv=require(_0xcfcc('0x9'));var ejs=require(_0xcfcc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcfcc('0xb'));var crypto=require(_0xcfcc('0xc'));var jsforce=require(_0xcfcc('0xd'));var deskjs=require(_0xcfcc('0xe'));var toCsv=require(_0xcfcc('0x9'));var querystring=require(_0xcfcc('0xf'));var Papa=require(_0xcfcc('0x10'));var Redis=require('ioredis');var authService=require(_0xcfcc('0x11'));var qs=require(_0xcfcc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcfcc('0x13'));var logger=require(_0xcfcc('0x14'))('api');var utils=require(_0xcfcc('0x15'));var config=require(_0xcfcc('0x16'));var licenseUtil=require(_0xcfcc('0x17'));var db=require(_0xcfcc('0x18'))['db'];function respondWithStatusCode(_0x2780fd,_0xacc838){_0xacc838=_0xacc838||0xcc;return function(_0x12599c){if(_0x12599c){return _0x2780fd[_0xcfcc('0x19')](_0xacc838);}return _0x2780fd[_0xcfcc('0x1a')](_0xacc838)[_0xcfcc('0x1b')]();};}function respondWithResult(_0x5a50d7,_0x54fa64){_0x54fa64=_0x54fa64||0xc8;return function(_0x1e2ce0){if(_0x1e2ce0){return _0x5a50d7['status'](_0x54fa64)[_0xcfcc('0x1c')](_0x1e2ce0);}};}function respondWithFilteredResult(_0x14f2c0,_0x34e3d9){return function(_0x36923b){if(_0x36923b){var _0x26dcf3=typeof _0x34e3d9[_0xcfcc('0x1d')]===_0xcfcc('0x1e')&&typeof _0x34e3d9['limit']===_0xcfcc('0x1e');var _0x45daca=_0x36923b[_0xcfcc('0x1f')];var _0x514a03=_0x26dcf3?0x0:_0x34e3d9[_0xcfcc('0x1d')];var _0x463ff1=_0x26dcf3?_0x36923b['count']:_0x34e3d9[_0xcfcc('0x1d')]+_0x34e3d9[_0xcfcc('0x20')];var _0x4cbd34;if(_0x463ff1>=_0x45daca){_0x463ff1=_0x45daca;_0x4cbd34=0xc8;}else{_0x4cbd34=0xce;}_0x14f2c0[_0xcfcc('0x1a')](_0x4cbd34);return _0x14f2c0[_0xcfcc('0x21')](_0xcfcc('0x22'),_0x514a03+'-'+_0x463ff1+'/'+_0x45daca)['json'](_0x36923b);}return null;};}function patchUpdates(_0x2bec1c){return function(_0xb05c5f){try{jsonpatch[_0xcfcc('0x23')](_0xb05c5f,_0x2bec1c,!![]);}catch(_0x267bba){return BPromise[_0xcfcc('0x24')](_0x267bba);}return _0xb05c5f[_0xcfcc('0x25')]();};}function saveUpdates(_0x55f6ff,_0x51fc28){return function(_0x7bef52){if(_0x7bef52){return _0x7bef52[_0xcfcc('0x26')](_0x55f6ff)['then'](function(_0x542a7e){return _0x542a7e;});}return null;};}function removeEntity(_0x474e09,_0xd078d6){return function(_0x160a53){if(_0x160a53){return _0x160a53['destroy']()['then'](function(){var _0x1b9405=_0x160a53['get']({'plain':!![]});var _0x5a4374=_0xcfcc('0x27');return db[_0xcfcc('0x28')][_0xcfcc('0x29')]({'where':{'type':_0x5a4374,'resourceId':_0x1b9405['id']}})[_0xcfcc('0x2a')](function(){return _0x160a53;});})[_0xcfcc('0x2a')](function(){_0x474e09[_0xcfcc('0x1a')](0xcc)[_0xcfcc('0x1b')]();});}};}function handleEntityNotFound(_0x48b2a3,_0x2f6110){return function(_0x1f94bc){if(!_0x1f94bc){_0x48b2a3['sendStatus'](0x194);}return _0x1f94bc;};}function handleError(_0x1b27ea,_0x3fcc59){_0x3fcc59=_0x3fcc59||0x1f4;return function(_0x46ef33){logger['error'](_0x46ef33[_0xcfcc('0x2b')]);if(_0x46ef33[_0xcfcc('0x2c')]){delete _0x46ef33[_0xcfcc('0x2c')];}_0x1b27ea[_0xcfcc('0x1a')](_0x3fcc59)[_0xcfcc('0x2d')](_0x46ef33);};}exports[_0xcfcc('0x2e')]=function(_0x22b1a2,_0x561a13){var _0x4adb8d={},_0x1d0b40={},_0x2327bd={'count':0x0,'rows':[]};var _0x173976=_[_0xcfcc('0x2f')](db[_0xcfcc('0x30')][_0xcfcc('0x31')],function(_0x50f456){return{'name':_0x50f456['fieldName'],'type':_0x50f456[_0xcfcc('0x32')][_0xcfcc('0x33')]};});_0x1d0b40['model']=_['map'](_0x173976,_0xcfcc('0x2c'));_0x1d0b40['query']=_['keys'](_0x22b1a2[_0xcfcc('0x34')]);_0x1d0b40[_0xcfcc('0x35')]=_['intersection'](_0x1d0b40[_0xcfcc('0x36')],_0x1d0b40['query']);_0x4adb8d['attributes']=_[_0xcfcc('0x37')](_0x1d0b40[_0xcfcc('0x36')],qs[_0xcfcc('0x38')](_0x22b1a2[_0xcfcc('0x34')][_0xcfcc('0x38')]));_0x4adb8d[_0xcfcc('0x39')]=_0x4adb8d['attributes'][_0xcfcc('0x3a')]?_0x4adb8d['attributes']:_0x1d0b40[_0xcfcc('0x36')];if(!_0x22b1a2['query']['hasOwnProperty'](_0xcfcc('0x3b'))){_0x4adb8d[_0xcfcc('0x20')]=qs['limit'](_0x22b1a2[_0xcfcc('0x34')]['limit']);_0x4adb8d[_0xcfcc('0x1d')]=qs['offset'](_0x22b1a2[_0xcfcc('0x34')][_0xcfcc('0x1d')]);}_0x4adb8d[_0xcfcc('0x3c')]=qs[_0xcfcc('0x3d')](_0x22b1a2[_0xcfcc('0x34')][_0xcfcc('0x3d')]);_0x4adb8d[_0xcfcc('0x3e')]=qs[_0xcfcc('0x35')](_[_0xcfcc('0x3f')](_0x22b1a2[_0xcfcc('0x34')],_0x1d0b40[_0xcfcc('0x35')]),_0x173976);if(_0x22b1a2[_0xcfcc('0x34')][_0xcfcc('0x40')]){_0x4adb8d[_0xcfcc('0x3e')]=_[_0xcfcc('0x41')](_0x4adb8d[_0xcfcc('0x3e')],{'$or':_[_0xcfcc('0x2f')](_0x173976,function(_0x5303b1){if(_0x5303b1[_0xcfcc('0x32')]!==_0xcfcc('0x42')){var _0x59bbe4={};_0x59bbe4[_0x5303b1[_0xcfcc('0x2c')]]={'$like':'%'+_0x22b1a2['query']['filter']+'%'};return _0x59bbe4;}})});}_0x4adb8d=_['merge']({},_0x4adb8d,_0x22b1a2['options']);var _0x2d8fca={'where':_0x4adb8d['where']};return db[_0xcfcc('0x30')]['count'](_0x2d8fca)[_0xcfcc('0x2a')](function(_0x50b0db){_0x2327bd[_0xcfcc('0x1f')]=_0x50b0db;if(_0x22b1a2['query'][_0xcfcc('0x43')]){_0x4adb8d[_0xcfcc('0x44')]=[{'all':!![]}];}return db[_0xcfcc('0x30')][_0xcfcc('0x45')](_0x4adb8d);})[_0xcfcc('0x2a')](function(_0xfd00fb){_0x2327bd['rows']=_0xfd00fb;return _0x2327bd;})['then'](respondWithFilteredResult(_0x561a13,_0x4adb8d))[_0xcfcc('0x46')](handleError(_0x561a13,null));};exports[_0xcfcc('0x47')]=function(_0x2344b1,_0x52f565){var _0x52907b={'raw':![],'where':{'id':_0x2344b1['params']['id']}},_0x182c4b={};_0x182c4b[_0xcfcc('0x36')]=_['keys'](db[_0xcfcc('0x30')][_0xcfcc('0x31')]);_0x182c4b['query']=_['keys'](_0x2344b1[_0xcfcc('0x34')]);_0x182c4b['filters']=_[_0xcfcc('0x37')](_0x182c4b[_0xcfcc('0x36')],_0x182c4b[_0xcfcc('0x34')]);_0x52907b[_0xcfcc('0x39')]=_[_0xcfcc('0x37')](_0x182c4b['model'],qs[_0xcfcc('0x38')](_0x2344b1['query'][_0xcfcc('0x38')]));_0x52907b['attributes']=_0x52907b[_0xcfcc('0x39')][_0xcfcc('0x3a')]?_0x52907b[_0xcfcc('0x39')]:_0x182c4b[_0xcfcc('0x36')];if(_0x2344b1[_0xcfcc('0x34')]['includeAll']){_0x52907b[_0xcfcc('0x44')]=[{'all':!![]}];}_0x52907b=_[_0xcfcc('0x41')]({},_0x52907b,_0x2344b1[_0xcfcc('0x48')]);return db[_0xcfcc('0x30')][_0xcfcc('0x49')](_0x52907b)[_0xcfcc('0x2a')](handleEntityNotFound(_0x52f565,null))[_0xcfcc('0x2a')](respondWithResult(_0x52f565,null))['catch'](handleError(_0x52f565,null));};exports[_0xcfcc('0x4a')]=function(_0x450151,_0x5cda40){return db[_0xcfcc('0x30')][_0xcfcc('0x4a')](_0x450151[_0xcfcc('0x4b')],{})[_0xcfcc('0x2a')](function(_0x3419f5){var _0x11087a=_0x450151[_0xcfcc('0x4c')][_0xcfcc('0x4d')]({'plain':!![]});if(!_0x11087a)throw new Error(_0xcfcc('0x4e'));if(_0x11087a['role']===_0xcfcc('0x4c')){var _0x18a132=_0x3419f5[_0xcfcc('0x4d')]({'plain':!![]});var _0x23fe97=_0xcfcc('0x27');return db[_0xcfcc('0x4f')][_0xcfcc('0x49')]({'where':{'name':_0x23fe97,'userProfileId':_0x11087a[_0xcfcc('0x50')]},'raw':!![]})[_0xcfcc('0x2a')](function(_0xc3efc1){if(_0xc3efc1&&_0xc3efc1[_0xcfcc('0x51')]===0x0){return db[_0xcfcc('0x28')][_0xcfcc('0x4a')]({'name':_0x18a132[_0xcfcc('0x2c')],'resourceId':_0x18a132['id'],'type':_0xc3efc1[_0xcfcc('0x2c')],'sectionId':_0xc3efc1['id']},{})[_0xcfcc('0x2a')](function(){return _0x3419f5;});}else{return _0x3419f5;}})[_0xcfcc('0x46')](function(_0x3954d7){logger[_0xcfcc('0x52')](_0xcfcc('0x53'),_0x3954d7);throw _0x3954d7;});}return _0x3419f5;})['then'](respondWithResult(_0x5cda40,0xc9))[_0xcfcc('0x46')](handleError(_0x5cda40,null));};exports['update']=function(_0x3ff41b,_0x24684d){if(_0x3ff41b['body']['id']){delete _0x3ff41b['body']['id'];}return db[_0xcfcc('0x30')][_0xcfcc('0x49')]({'where':{'id':_0x3ff41b['params']['id']}})[_0xcfcc('0x2a')](handleEntityNotFound(_0x24684d,null))['then'](saveUpdates(_0x3ff41b['body'],null))[_0xcfcc('0x2a')](respondWithResult(_0x24684d,null))['catch'](handleError(_0x24684d,null));};exports[_0xcfcc('0x29')]=function(_0x15159e,_0x559a09){return db[_0xcfcc('0x30')][_0xcfcc('0x49')]({'where':{'id':_0x15159e[_0xcfcc('0x54')]['id']}})[_0xcfcc('0x2a')](handleEntityNotFound(_0x559a09,null))['then'](removeEntity(_0x559a09,null))['catch'](handleError(_0x559a09,null));};exports[_0xcfcc('0x55')]=function(_0x5dc813,_0x3580cb,_0x137b74){var _0x363ffd=require(_0xcfcc('0x56'));return db[_0xcfcc('0x30')][_0xcfcc('0x49')]({'where':{'id':_0x5dc813[_0xcfcc('0x54')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3580cb,null))[_0xcfcc('0x2a')](function(){_0x363ffd[_0xcfcc('0x55')](_0x5dc813[_0xcfcc('0x54')]['id']);})['then'](respondWithStatusCode(_0x3580cb,null))['catch'](handleError(_0x3580cb,null));};
\ No newline at end of file