Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / schedule / schedule.controller.js
index 2b1509d..3055a01 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xef0f=['order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','params','intersection','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../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','end','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','get','Scheduler','UserProfileResource','stack','name','send','index','Schedule','fieldName','type','keys','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','limit'];(function(_0xf64e7a,_0x55a492){var _0x2e2ab1=function(_0x9bf292){while(--_0x9bf292){_0xf64e7a['push'](_0xf64e7a['shift']());}};_0x2e2ab1(++_0x55a492);}(_0xef0f,0x168));var _0xfef0=function(_0x318b69,_0x5ae387){_0x318b69=_0x318b69-0x0;var _0x3e53b5=_0xef0f[_0x318b69];return _0x3e53b5;};'use strict';var pdf=require(_0xfef0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfef0('0x1'));var zipdir=require(_0xfef0('0x2'));var jsonpatch=require(_0xfef0('0x3'));var rp=require('request-promise');var moment=require(_0xfef0('0x4'));var BPromise=require(_0xfef0('0x5'));var Mustache=require(_0xfef0('0x6'));var util=require('util');var path=require(_0xfef0('0x7'));var sox=require(_0xfef0('0x8'));var csv=require(_0xfef0('0x9'));var ejs=require(_0xfef0('0xa'));var fs=require('fs');var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x9'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var licenseUtil=require(_0xfef0('0x19'));var db=require(_0xfef0('0x1a'))['db'];function respondWithStatusCode(_0x546c7a,_0x3135ab){_0x3135ab=_0x3135ab||0xcc;return function(_0x2f4e23){if(_0x2f4e23){return _0x546c7a[_0xfef0('0x1b')](_0x3135ab);}return _0x546c7a[_0xfef0('0x1c')](_0x3135ab)[_0xfef0('0x1d')]();};}function respondWithResult(_0x45599a,_0xa9f040){_0xa9f040=_0xa9f040||0xc8;return function(_0x573ae7){if(_0x573ae7){return _0x45599a[_0xfef0('0x1c')](_0xa9f040)['json'](_0x573ae7);}};}function respondWithFilteredResult(_0x4b5bcf,_0x5acdd0){return function(_0x118b8d){if(_0x118b8d){var _0x284b6d=_0x118b8d[_0xfef0('0x1e')],_0x3510a7=_0x5acdd0[_0xfef0('0x1f')],_0x1bce2f=_0x5acdd0[_0xfef0('0x1f')]+_0x5acdd0['limit'],_0x2a96d9;if(_0x1bce2f>=_0x284b6d){_0x1bce2f=_0x284b6d;_0x2a96d9=0xc8;}else{_0x2a96d9=0xce;}_0x4b5bcf[_0xfef0('0x1c')](_0x2a96d9);return _0x4b5bcf[_0xfef0('0x20')](_0xfef0('0x21'),_0x3510a7+'-'+_0x1bce2f+'/'+_0x284b6d)[_0xfef0('0x22')](_0x118b8d);}return null;};}function patchUpdates(_0x1ad020){return function(_0x55912f){try{jsonpatch[_0xfef0('0x23')](_0x55912f,_0x1ad020,!![]);}catch(_0x4e24de){return BPromise[_0xfef0('0x24')](_0x4e24de);}return _0x55912f[_0xfef0('0x25')]();};}function saveUpdates(_0x28dee1,_0x48408a){return function(_0x2be956){if(_0x2be956){return _0x2be956['update'](_0x28dee1)[_0xfef0('0x26')](function(_0x394fbc){return _0x394fbc;});}return null;};}function removeEntity(_0x52b93b,_0x4897af){return function(_0x4b8b22){if(_0x4b8b22){return _0x4b8b22[_0xfef0('0x27')]()['then'](function(){var _0x1f9970=_0x4b8b22[_0xfef0('0x28')]({'plain':!![]});var _0x1a8d66=_0xfef0('0x29');return db[_0xfef0('0x2a')][_0xfef0('0x27')]({'where':{'type':_0x1a8d66,'resourceId':_0x1f9970['id']}})['then'](function(){return _0x4b8b22;});})['then'](function(){_0x52b93b[_0xfef0('0x1c')](0xcc)[_0xfef0('0x1d')]();});}};}function handleEntityNotFound(_0x924f6e,_0x34ca65){return function(_0xab231c){if(!_0xab231c){_0x924f6e[_0xfef0('0x1b')](0x194);}return _0xab231c;};}function handleError(_0x5df04f,_0x168b98){_0x168b98=_0x168b98||0x1f4;return function(_0x391279){logger['error'](_0x391279[_0xfef0('0x2b')]);if(_0x391279[_0xfef0('0x2c')]){delete _0x391279[_0xfef0('0x2c')];}_0x5df04f[_0xfef0('0x1c')](_0x168b98)[_0xfef0('0x2d')](_0x391279);};}exports[_0xfef0('0x2e')]=function(_0x3e3c4c,_0x3e026a){var _0x26cb9a={},_0x213a91={},_0x3ee42f={'count':0x0,'rows':[]};var _0x3ffea0=_['map'](db[_0xfef0('0x2f')]['rawAttributes'],function(_0x4eaf74){return{'name':_0x4eaf74[_0xfef0('0x30')],'type':_0x4eaf74[_0xfef0('0x31')]['key']};});_0x213a91['model']=_['map'](_0x3ffea0,'name');_0x213a91['query']=_[_0xfef0('0x32')](_0x3e3c4c[_0xfef0('0x33')]);_0x213a91[_0xfef0('0x34')]=_['intersection'](_0x213a91['model'],_0x213a91['query']);_0x26cb9a[_0xfef0('0x35')]=_['intersection'](_0x213a91[_0xfef0('0x36')],qs[_0xfef0('0x37')](_0x3e3c4c[_0xfef0('0x33')]['fields']));_0x26cb9a[_0xfef0('0x35')]=_0x26cb9a['attributes'][_0xfef0('0x38')]?_0x26cb9a[_0xfef0('0x35')]:_0x213a91[_0xfef0('0x36')];if(!_0x3e3c4c[_0xfef0('0x33')][_0xfef0('0x39')](_0xfef0('0x3a'))){_0x26cb9a[_0xfef0('0x3b')]=qs[_0xfef0('0x3b')](_0x3e3c4c['query'][_0xfef0('0x3b')]);_0x26cb9a[_0xfef0('0x1f')]=qs[_0xfef0('0x1f')](_0x3e3c4c[_0xfef0('0x33')][_0xfef0('0x1f')]);}_0x26cb9a[_0xfef0('0x3c')]=qs[_0xfef0('0x3d')](_0x3e3c4c[_0xfef0('0x33')][_0xfef0('0x3d')]);_0x26cb9a[_0xfef0('0x3e')]=qs[_0xfef0('0x34')](_[_0xfef0('0x3f')](_0x3e3c4c[_0xfef0('0x33')],_0x213a91['filters']),_0x3ffea0);if(_0x3e3c4c[_0xfef0('0x33')]['filter']){_0x26cb9a[_0xfef0('0x3e')]=_[_0xfef0('0x40')](_0x26cb9a[_0xfef0('0x3e')],{'$or':_['map'](_0x3ffea0,function(_0x3f1597){if(_0x3f1597[_0xfef0('0x31')]!==_0xfef0('0x41')){var _0x5537c8={};_0x5537c8[_0x3f1597[_0xfef0('0x2c')]]={'$like':'%'+_0x3e3c4c[_0xfef0('0x33')][_0xfef0('0x42')]+'%'};return _0x5537c8;}})});}_0x26cb9a=_['merge']({},_0x26cb9a,_0x3e3c4c[_0xfef0('0x43')]);var _0x492b90={'where':_0x26cb9a['where']};return db[_0xfef0('0x2f')]['count'](_0x492b90)['then'](function(_0xbf6ddd){_0x3ee42f[_0xfef0('0x1e')]=_0xbf6ddd;if(_0x3e3c4c[_0xfef0('0x33')][_0xfef0('0x44')]){_0x26cb9a[_0xfef0('0x45')]=[{'all':!![]}];}return db[_0xfef0('0x2f')]['findAll'](_0x26cb9a);})[_0xfef0('0x26')](function(_0x2a5779){_0x3ee42f['rows']=_0x2a5779;return _0x3ee42f;})['then'](respondWithFilteredResult(_0x3e026a,_0x26cb9a))[_0xfef0('0x46')](handleError(_0x3e026a,null));};exports['show']=function(_0x1fc518,_0x22c940){var _0x3c100c={'raw':![],'where':{'id':_0x1fc518[_0xfef0('0x47')]['id']}},_0x1abcfb={};_0x1abcfb[_0xfef0('0x36')]=_[_0xfef0('0x32')](db[_0xfef0('0x2f')]['rawAttributes']);_0x1abcfb[_0xfef0('0x33')]=_['keys'](_0x1fc518['query']);_0x1abcfb[_0xfef0('0x34')]=_[_0xfef0('0x48')](_0x1abcfb['model'],_0x1abcfb[_0xfef0('0x33')]);_0x3c100c['attributes']=_[_0xfef0('0x48')](_0x1abcfb[_0xfef0('0x36')],qs[_0xfef0('0x37')](_0x1fc518[_0xfef0('0x33')]['fields']));_0x3c100c[_0xfef0('0x35')]=_0x3c100c[_0xfef0('0x35')]['length']?_0x3c100c['attributes']:_0x1abcfb[_0xfef0('0x36')];if(_0x1fc518['query'][_0xfef0('0x44')]){_0x3c100c[_0xfef0('0x45')]=[{'all':!![]}];}_0x3c100c=_[_0xfef0('0x40')]({},_0x3c100c,_0x1fc518[_0xfef0('0x43')]);return db[_0xfef0('0x2f')][_0xfef0('0x49')](_0x3c100c)['then'](handleEntityNotFound(_0x22c940,null))[_0xfef0('0x26')](respondWithResult(_0x22c940,null))['catch'](handleError(_0x22c940,null));};exports['create']=function(_0x2f11cb,_0x25da1b){return db[_0xfef0('0x2f')]['create'](_0x2f11cb[_0xfef0('0x4a')],{})['then'](function(_0x5dd26b){var _0x51f207=_0x2f11cb[_0xfef0('0x4b')][_0xfef0('0x28')]({'plain':!![]});if(!_0x51f207)throw new Error(_0xfef0('0x4c'));if(_0x51f207[_0xfef0('0x4d')]===_0xfef0('0x4b')){var _0xa23cc8=_0x5dd26b[_0xfef0('0x28')]({'plain':!![]});var _0x3853bb=_0xfef0('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x3853bb,'userProfileId':_0x51f207[_0xfef0('0x4e')]},'raw':!![]})[_0xfef0('0x26')](function(_0x34e9ed){if(_0x34e9ed&&_0x34e9ed[_0xfef0('0x4f')]===0x0){return db[_0xfef0('0x2a')][_0xfef0('0x50')]({'name':_0xa23cc8[_0xfef0('0x2c')],'resourceId':_0xa23cc8['id'],'type':_0x34e9ed[_0xfef0('0x2c')],'sectionId':_0x34e9ed['id']},{})['then'](function(){return _0x5dd26b;});}else{return _0x5dd26b;}})[_0xfef0('0x46')](function(_0x19e449){logger[_0xfef0('0x51')](_0xfef0('0x52'),_0x19e449);throw _0x19e449;});}return _0x5dd26b;})[_0xfef0('0x26')](respondWithResult(_0x25da1b,0xc9))['catch'](handleError(_0x25da1b,null));};exports['update']=function(_0x523763,_0x445f3f){if(_0x523763[_0xfef0('0x4a')]['id']){delete _0x523763[_0xfef0('0x4a')]['id'];}return db[_0xfef0('0x2f')]['find']({'where':{'id':_0x523763[_0xfef0('0x47')]['id']}})[_0xfef0('0x26')](handleEntityNotFound(_0x445f3f,null))[_0xfef0('0x26')](saveUpdates(_0x523763[_0xfef0('0x4a')],null))[_0xfef0('0x26')](respondWithResult(_0x445f3f,null))[_0xfef0('0x46')](handleError(_0x445f3f,null));};exports[_0xfef0('0x27')]=function(_0x4cd0fd,_0x3458b0){return db[_0xfef0('0x2f')]['find']({'where':{'id':_0x4cd0fd[_0xfef0('0x47')]['id']}})['then'](handleEntityNotFound(_0x3458b0,null))[_0xfef0('0x26')](removeEntity(_0x3458b0,null))[_0xfef0('0x46')](handleError(_0x3458b0,null));};exports['run']=function(_0x1e1c02,_0x49ec3c,_0x5da063){var _0x4812c7=require(_0xfef0('0x53'));return db[_0xfef0('0x2f')][_0xfef0('0x49')]({'where':{'id':_0x1e1c02[_0xfef0('0x47')]['id']},'raw':!![]})[_0xfef0('0x26')](handleEntityNotFound(_0x49ec3c,null))[_0xfef0('0x26')](function(){_0x4812c7['run'](_0x1e1c02[_0xfef0('0x47')]['id']);})[_0xfef0('0x26')](respondWithStatusCode(_0x49ec3c,null))[_0xfef0('0x46')](handleError(_0x49ec3c,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