Built motion from commit (unavailable).|2.6.0
[motion2.git] / server / api / disposition / disposition.controller.js
index 210c478..fd23645 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf6c1=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','name','send','index','map','Disposition','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xf6c1,0x99));var _0x1f6c=function(_0x541277,_0xbba8d6){_0x541277=_0x541277-0x0;var _0x48582f=_0xf6c1[_0x541277];return _0x48582f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1f6c('0x0'));var jsonpatch=require(_0x1f6c('0x1'));var rp=require(_0x1f6c('0x2'));var moment=require('moment');var BPromise=require(_0x1f6c('0x3'));var Mustache=require('mustache');var util=require(_0x1f6c('0x4'));var path=require(_0x1f6c('0x5'));var sox=require(_0x1f6c('0x6'));var csv=require(_0x1f6c('0x7'));var ejs=require(_0x1f6c('0x8'));var fs=require('fs');var fs_extra=require(_0x1f6c('0x9'));var _=require('lodash');var squel=require(_0x1f6c('0xa'));var crypto=require(_0x1f6c('0xb'));var jsforce=require(_0x1f6c('0xc'));var deskjs=require(_0x1f6c('0xd'));var toCsv=require(_0x1f6c('0x7'));var querystring=require(_0x1f6c('0xe'));var Papa=require(_0x1f6c('0xf'));var Redis=require(_0x1f6c('0x10'));var authService=require(_0x1f6c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f6c('0x12'))(_0x1f6c('0x13'));var utils=require(_0x1f6c('0x14'));var config=require(_0x1f6c('0x15'));var licenseUtil=require(_0x1f6c('0x16'));var db=require(_0x1f6c('0x17'))['db'];function respondWithStatusCode(_0x507a06,_0x7963a9){_0x7963a9=_0x7963a9||0xcc;return function(_0x1e7060){if(_0x1e7060){return _0x507a06[_0x1f6c('0x18')](_0x7963a9);}return _0x507a06[_0x1f6c('0x19')](_0x7963a9)[_0x1f6c('0x1a')]();};}function respondWithResult(_0x1315b7,_0x31fc67){_0x31fc67=_0x31fc67||0xc8;return function(_0x147c01){if(_0x147c01){return _0x1315b7['status'](_0x31fc67)[_0x1f6c('0x1b')](_0x147c01);}};}function respondWithFilteredResult(_0x302026,_0x26652b){return function(_0x43ce04){if(_0x43ce04){var _0xc8b6f2=typeof _0x26652b[_0x1f6c('0x1c')]==='undefined'&&typeof _0x26652b['limit']===_0x1f6c('0x1d');var _0x30a8dc=_0x43ce04['count'];var _0x2328f2=_0xc8b6f2?0x0:_0x26652b['offset'];var _0x31c887=_0xc8b6f2?_0x43ce04[_0x1f6c('0x1e')]:_0x26652b[_0x1f6c('0x1c')]+_0x26652b[_0x1f6c('0x1f')];var _0xd71b77;if(_0x31c887>=_0x30a8dc){_0x31c887=_0x30a8dc;_0xd71b77=0xc8;}else{_0xd71b77=0xce;}_0x302026[_0x1f6c('0x19')](_0xd71b77);return _0x302026[_0x1f6c('0x20')](_0x1f6c('0x21'),_0x2328f2+'-'+_0x31c887+'/'+_0x30a8dc)[_0x1f6c('0x1b')](_0x43ce04);}return null;};}function patchUpdates(_0x459944){return function(_0x44b1c5){try{jsonpatch[_0x1f6c('0x22')](_0x44b1c5,_0x459944,!![]);}catch(_0x196356){return BPromise[_0x1f6c('0x23')](_0x196356);}return _0x44b1c5[_0x1f6c('0x24')]();};}function saveUpdates(_0x55881f,_0x2644e9){return function(_0x511191){if(_0x511191){return _0x511191[_0x1f6c('0x25')](_0x55881f)[_0x1f6c('0x26')](function(_0x536eb6){return _0x536eb6;});}return null;};}function removeEntity(_0x1aa1f6,_0x4ef92a){return function(_0x32a812){if(_0x32a812){return _0x32a812[_0x1f6c('0x27')]()[_0x1f6c('0x26')](function(){var _0x185eb0=_0x32a812[_0x1f6c('0x28')]({'plain':!![]});var _0x386016=_0x1f6c('0x29');return db[_0x1f6c('0x2a')][_0x1f6c('0x27')]({'where':{'type':_0x386016,'resourceId':_0x185eb0['id']}})[_0x1f6c('0x26')](function(){return _0x32a812;});})['then'](function(){_0x1aa1f6[_0x1f6c('0x19')](0xcc)[_0x1f6c('0x1a')]();});}};}function handleEntityNotFound(_0x2b59b8,_0x5389e5){return function(_0x3374dc){if(!_0x3374dc){_0x2b59b8[_0x1f6c('0x18')](0x194);}return _0x3374dc;};}function handleError(_0x2ce9df,_0x30fdea){_0x30fdea=_0x30fdea||0x1f4;return function(_0xeaeccd){logger[_0x1f6c('0x2b')](_0xeaeccd['stack']);if(_0xeaeccd[_0x1f6c('0x2c')]){delete _0xeaeccd['name'];}_0x2ce9df[_0x1f6c('0x19')](_0x30fdea)[_0x1f6c('0x2d')](_0xeaeccd);};}exports[_0x1f6c('0x2e')]=function(_0x463543,_0xe574ac){var _0x497d8c={},_0x7a927a={},_0x47db8b={'count':0x0,'rows':[]};var _0x4ed20c=_[_0x1f6c('0x2f')](db[_0x1f6c('0x30')][_0x1f6c('0x31')],function(_0x29ad8d){return{'name':_0x29ad8d['fieldName'],'type':_0x29ad8d[_0x1f6c('0x32')][_0x1f6c('0x33')]};});_0x7a927a[_0x1f6c('0x34')]=_[_0x1f6c('0x2f')](_0x4ed20c,_0x1f6c('0x2c'));_0x7a927a['query']=_['keys'](_0x463543[_0x1f6c('0x35')]);_0x7a927a[_0x1f6c('0x36')]=_[_0x1f6c('0x37')](_0x7a927a[_0x1f6c('0x34')],_0x7a927a['query']);_0x497d8c[_0x1f6c('0x38')]=_['intersection'](_0x7a927a['model'],qs[_0x1f6c('0x39')](_0x463543[_0x1f6c('0x35')][_0x1f6c('0x39')]));_0x497d8c[_0x1f6c('0x38')]=_0x497d8c[_0x1f6c('0x38')][_0x1f6c('0x3a')]?_0x497d8c[_0x1f6c('0x38')]:_0x7a927a[_0x1f6c('0x34')];if(!_0x463543[_0x1f6c('0x35')][_0x1f6c('0x3b')](_0x1f6c('0x3c'))){_0x497d8c[_0x1f6c('0x1f')]=qs[_0x1f6c('0x1f')](_0x463543[_0x1f6c('0x35')][_0x1f6c('0x1f')]);_0x497d8c[_0x1f6c('0x1c')]=qs[_0x1f6c('0x1c')](_0x463543['query'][_0x1f6c('0x1c')]);}_0x497d8c[_0x1f6c('0x3d')]=qs[_0x1f6c('0x3e')](_0x463543[_0x1f6c('0x35')][_0x1f6c('0x3e')]);_0x497d8c['where']=qs['filters'](_[_0x1f6c('0x3f')](_0x463543[_0x1f6c('0x35')],_0x7a927a[_0x1f6c('0x36')]),_0x4ed20c);if(_0x463543[_0x1f6c('0x35')][_0x1f6c('0x40')]){_0x497d8c[_0x1f6c('0x41')]=_['merge'](_0x497d8c[_0x1f6c('0x41')],{'$or':_[_0x1f6c('0x2f')](_0x4ed20c,function(_0x23f4bd){if(_0x23f4bd[_0x1f6c('0x32')]!==_0x1f6c('0x42')){var _0x74d4a6={};_0x74d4a6[_0x23f4bd[_0x1f6c('0x2c')]]={'$like':'%'+_0x463543[_0x1f6c('0x35')]['filter']+'%'};return _0x74d4a6;}})});}_0x497d8c=_['merge']({},_0x497d8c,_0x463543[_0x1f6c('0x43')]);var _0x48c2a1={'where':_0x497d8c['where']};return db[_0x1f6c('0x30')][_0x1f6c('0x1e')](_0x48c2a1)[_0x1f6c('0x26')](function(_0x1a2fff){_0x47db8b[_0x1f6c('0x1e')]=_0x1a2fff;if(_0x463543[_0x1f6c('0x35')][_0x1f6c('0x44')]){_0x497d8c[_0x1f6c('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x1f6c('0x46')](_0x497d8c);})['then'](function(_0x4b92ac){_0x47db8b[_0x1f6c('0x47')]=_0x4b92ac;return _0x47db8b;})[_0x1f6c('0x26')](respondWithFilteredResult(_0xe574ac,_0x497d8c))[_0x1f6c('0x48')](handleError(_0xe574ac,null));};exports['show']=function(_0x13034d,_0x4e2cdb){var _0x42ae1d={'raw':!![],'where':{'id':_0x13034d['params']['id']}},_0x2c7f71={};_0x2c7f71[_0x1f6c('0x34')]=_['keys'](db[_0x1f6c('0x30')][_0x1f6c('0x31')]);_0x2c7f71['query']=_[_0x1f6c('0x49')](_0x13034d['query']);_0x2c7f71['filters']=_[_0x1f6c('0x37')](_0x2c7f71['model'],_0x2c7f71[_0x1f6c('0x35')]);_0x42ae1d['attributes']=_[_0x1f6c('0x37')](_0x2c7f71[_0x1f6c('0x34')],qs[_0x1f6c('0x39')](_0x13034d['query'][_0x1f6c('0x39')]));_0x42ae1d[_0x1f6c('0x38')]=_0x42ae1d[_0x1f6c('0x38')]['length']?_0x42ae1d['attributes']:_0x2c7f71['model'];if(_0x13034d['query'][_0x1f6c('0x44')]){_0x42ae1d[_0x1f6c('0x45')]=[{'all':!![]}];}_0x42ae1d=_['merge']({},_0x42ae1d,_0x13034d['options']);return db[_0x1f6c('0x30')][_0x1f6c('0x4a')](_0x42ae1d)[_0x1f6c('0x26')](handleEntityNotFound(_0x4e2cdb,null))[_0x1f6c('0x26')](respondWithResult(_0x4e2cdb,null))[_0x1f6c('0x48')](handleError(_0x4e2cdb,null));};exports[_0x1f6c('0x4b')]=function(_0x508fdb,_0x303c50){return db[_0x1f6c('0x30')]['create'](_0x508fdb[_0x1f6c('0x4c')],{})[_0x1f6c('0x26')](function(_0x4bd86d){var _0x28a02a=_0x508fdb['user'][_0x1f6c('0x28')]({'plain':!![]});if(!_0x28a02a)throw new Error(_0x1f6c('0x4d'));if(_0x28a02a[_0x1f6c('0x4e')]==='user'){var _0xd4d0b1=_0x4bd86d[_0x1f6c('0x28')]({'plain':!![]});var _0x4b4621=_0x1f6c('0x29');return db['UserProfileSection'][_0x1f6c('0x4a')]({'where':{'name':_0x4b4621,'userProfileId':_0x28a02a[_0x1f6c('0x4f')]},'raw':!![]})[_0x1f6c('0x26')](function(_0x48f713){if(_0x48f713&&_0x48f713[_0x1f6c('0x50')]===0x0){return db[_0x1f6c('0x2a')]['create']({'name':_0xd4d0b1[_0x1f6c('0x2c')],'resourceId':_0xd4d0b1['id'],'type':_0x48f713['name'],'sectionId':_0x48f713['id']},{})[_0x1f6c('0x26')](function(){return _0x4bd86d;});}else{return _0x4bd86d;}})[_0x1f6c('0x48')](function(_0xd4d119){logger[_0x1f6c('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd4d119);throw _0xd4d119;});}return _0x4bd86d;})['then'](respondWithResult(_0x303c50,0xc9))['catch'](handleError(_0x303c50,null));};exports[_0x1f6c('0x25')]=function(_0x426761,_0x335974){if(_0x426761[_0x1f6c('0x4c')]['id']){delete _0x426761[_0x1f6c('0x4c')]['id'];}return db[_0x1f6c('0x30')][_0x1f6c('0x4a')]({'where':{'id':_0x426761[_0x1f6c('0x51')]['id']}})[_0x1f6c('0x26')](handleEntityNotFound(_0x335974,null))[_0x1f6c('0x26')](saveUpdates(_0x426761[_0x1f6c('0x4c')],null))[_0x1f6c('0x26')](respondWithResult(_0x335974,null))[_0x1f6c('0x48')](handleError(_0x335974,null));};exports[_0x1f6c('0x27')]=function(_0xc76c51,_0x38a288){return db[_0x1f6c('0x30')][_0x1f6c('0x4a')]({'where':{'id':_0xc76c51[_0x1f6c('0x51')]['id']}})['then'](handleEntityNotFound(_0x38a288,null))[_0x1f6c('0x26')](removeEntity(_0x38a288,null))['catch'](handleError(_0x38a288,null));};
\ No newline at end of file
+var _0xfd0f=['type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','Disposition','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','get','Dispositions','UserProfileResource','sendStatus','error','name','index','rawAttributes','fieldName'];(function(_0x3d6721,_0x261121){var _0x1cfd87=function(_0x552fa2){while(--_0x552fa2){_0x3d6721['push'](_0x3d6721['shift']());}};_0x1cfd87(++_0x261121);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x17d7ea,_0x2e0974){_0x17d7ea=_0x17d7ea-0x0;var _0x243d72=_0xfd0f[_0x17d7ea];return _0x243d72;};'use strict';var emlformat=require(_0xffd0('0x0'));var rimraf=require(_0xffd0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xffd0('0x2'));var rp=require(_0xffd0('0x3'));var moment=require(_0xffd0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xffd0('0x5'));var util=require('util');var path=require(_0xffd0('0x6'));var sox=require(_0xffd0('0x7'));var csv=require(_0xffd0('0x8'));var ejs=require(_0xffd0('0x9'));var fs=require('fs');var fs_extra=require(_0xffd0('0xa'));var _=require(_0xffd0('0xb'));var squel=require(_0xffd0('0xc'));var crypto=require(_0xffd0('0xd'));var jsforce=require(_0xffd0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xffd0('0x8'));var querystring=require(_0xffd0('0xf'));var Papa=require(_0xffd0('0x10'));var Redis=require(_0xffd0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xffd0('0x12'));var hardwareService=require(_0xffd0('0x13'));var logger=require(_0xffd0('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xffd0('0x15'));var licenseUtil=require(_0xffd0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa6e1ad,_0xaf12c1){_0xaf12c1=_0xaf12c1||0xcc;return function(_0x2ca16d){if(_0x2ca16d){return _0xa6e1ad['sendStatus'](_0xaf12c1);}return _0xa6e1ad[_0xffd0('0x17')](_0xaf12c1)[_0xffd0('0x18')]();};}function respondWithResult(_0x5be5aa,_0x3cf549){_0x3cf549=_0x3cf549||0xc8;return function(_0x48fc60){if(_0x48fc60){return _0x5be5aa['status'](_0x3cf549)[_0xffd0('0x19')](_0x48fc60);}};}function respondWithFilteredResult(_0x5c799c,_0x321ceb){return function(_0x2e030d){if(_0x2e030d){var _0x15e710=typeof _0x321ceb[_0xffd0('0x1a')]===_0xffd0('0x1b')&&typeof _0x321ceb['limit']==='undefined';var _0x285c52=_0x2e030d[_0xffd0('0x1c')];var _0x2e9463=_0x15e710?0x0:_0x321ceb[_0xffd0('0x1a')];var _0x409b90=_0x15e710?_0x2e030d[_0xffd0('0x1c')]:_0x321ceb[_0xffd0('0x1a')]+_0x321ceb[_0xffd0('0x1d')];var _0x684579;if(_0x409b90>=_0x285c52){_0x409b90=_0x285c52;_0x684579=0xc8;}else{_0x684579=0xce;}_0x5c799c[_0xffd0('0x17')](_0x684579);return _0x5c799c[_0xffd0('0x1e')](_0xffd0('0x1f'),_0x2e9463+'-'+_0x409b90+'/'+_0x285c52)[_0xffd0('0x19')](_0x2e030d);}return null;};}function patchUpdates(_0x19c523){return function(_0x3deed6){try{jsonpatch[_0xffd0('0x20')](_0x3deed6,_0x19c523,!![]);}catch(_0x5219ca){return BPromise['reject'](_0x5219ca);}return _0x3deed6[_0xffd0('0x21')]();};}function saveUpdates(_0x13c117,_0x4fbb72){return function(_0x4f3cb3){if(_0x4f3cb3){return _0x4f3cb3[_0xffd0('0x22')](_0x13c117)['then'](function(_0x10467e){return _0x10467e;});}return null;};}function removeEntity(_0x329864,_0x2c8d64){return function(_0x38f25f){if(_0x38f25f){return _0x38f25f[_0xffd0('0x23')]()[_0xffd0('0x24')](function(){var _0x45edb3=_0x38f25f[_0xffd0('0x25')]({'plain':!![]});var _0x2e3046=_0xffd0('0x26');return db[_0xffd0('0x27')][_0xffd0('0x23')]({'where':{'type':_0x2e3046,'resourceId':_0x45edb3['id']}})[_0xffd0('0x24')](function(){return _0x38f25f;});})['then'](function(){_0x329864['status'](0xcc)[_0xffd0('0x18')]();});}};}function handleEntityNotFound(_0x4928ea,_0x5a7c44){return function(_0x142921){if(!_0x142921){_0x4928ea[_0xffd0('0x28')](0x194);}return _0x142921;};}function handleError(_0x3a28b7,_0xe8a70){_0xe8a70=_0xe8a70||0x1f4;return function(_0x3f5423){logger[_0xffd0('0x29')](_0x3f5423['stack']);if(_0x3f5423[_0xffd0('0x2a')]){delete _0x3f5423['name'];}_0x3a28b7['status'](_0xe8a70)['send'](_0x3f5423);};}exports[_0xffd0('0x2b')]=function(_0x896a70,_0x3b71ac){var _0xdb9da8={},_0x3bb309={},_0x326e8f={'count':0x0,'rows':[]};var _0x5c3be5=_['map'](db['Disposition'][_0xffd0('0x2c')],function(_0x5bb7f1){return{'name':_0x5bb7f1[_0xffd0('0x2d')],'type':_0x5bb7f1[_0xffd0('0x2e')]['key']};});_0x3bb309[_0xffd0('0x2f')]=_['map'](_0x5c3be5,'name');_0x3bb309['query']=_[_0xffd0('0x30')](_0x896a70[_0xffd0('0x31')]);_0x3bb309[_0xffd0('0x32')]=_[_0xffd0('0x33')](_0x3bb309[_0xffd0('0x2f')],_0x3bb309['query']);_0xdb9da8[_0xffd0('0x34')]=_[_0xffd0('0x33')](_0x3bb309['model'],qs[_0xffd0('0x35')](_0x896a70[_0xffd0('0x31')][_0xffd0('0x35')]));_0xdb9da8[_0xffd0('0x34')]=_0xdb9da8[_0xffd0('0x34')][_0xffd0('0x36')]?_0xdb9da8['attributes']:_0x3bb309[_0xffd0('0x2f')];if(!_0x896a70[_0xffd0('0x31')]['hasOwnProperty'](_0xffd0('0x37'))){_0xdb9da8[_0xffd0('0x1d')]=qs['limit'](_0x896a70[_0xffd0('0x31')][_0xffd0('0x1d')]);_0xdb9da8['offset']=qs[_0xffd0('0x1a')](_0x896a70['query'][_0xffd0('0x1a')]);}_0xdb9da8[_0xffd0('0x38')]=qs['sort'](_0x896a70[_0xffd0('0x31')][_0xffd0('0x39')]);_0xdb9da8[_0xffd0('0x3a')]=qs[_0xffd0('0x32')](_[_0xffd0('0x3b')](_0x896a70[_0xffd0('0x31')],_0x3bb309[_0xffd0('0x32')]),_0x5c3be5);if(_0x896a70[_0xffd0('0x31')][_0xffd0('0x3c')]){_0xdb9da8[_0xffd0('0x3a')]=_[_0xffd0('0x3d')](_0xdb9da8[_0xffd0('0x3a')],{'$or':_[_0xffd0('0x3e')](_0x5c3be5,function(_0x2ccb38){if(_0x2ccb38[_0xffd0('0x2e')]!==_0xffd0('0x3f')){var _0x338f04={};_0x338f04[_0x2ccb38['name']]={'$like':'%'+_0x896a70[_0xffd0('0x31')][_0xffd0('0x3c')]+'%'};return _0x338f04;}})});}_0xdb9da8=_[_0xffd0('0x3d')]({},_0xdb9da8,_0x896a70[_0xffd0('0x40')]);var _0x4e06ea={'where':_0xdb9da8['where']};return db[_0xffd0('0x41')][_0xffd0('0x1c')](_0x4e06ea)[_0xffd0('0x24')](function(_0xc0aa){_0x326e8f['count']=_0xc0aa;if(_0x896a70[_0xffd0('0x31')][_0xffd0('0x42')]){_0xdb9da8[_0xffd0('0x43')]=[{'all':!![]}];}return db[_0xffd0('0x41')][_0xffd0('0x44')](_0xdb9da8);})[_0xffd0('0x24')](function(_0x9558c0){_0x326e8f[_0xffd0('0x45')]=_0x9558c0;return _0x326e8f;})[_0xffd0('0x24')](respondWithFilteredResult(_0x3b71ac,_0xdb9da8))[_0xffd0('0x46')](handleError(_0x3b71ac,null));};exports[_0xffd0('0x47')]=function(_0x18ef0b,_0x236c1d){var _0x1f660c={'raw':!![],'where':{'id':_0x18ef0b[_0xffd0('0x48')]['id']}},_0x3a99d5={};_0x3a99d5[_0xffd0('0x2f')]=_[_0xffd0('0x30')](db[_0xffd0('0x41')][_0xffd0('0x2c')]);_0x3a99d5[_0xffd0('0x31')]=_['keys'](_0x18ef0b[_0xffd0('0x31')]);_0x3a99d5[_0xffd0('0x32')]=_[_0xffd0('0x33')](_0x3a99d5[_0xffd0('0x2f')],_0x3a99d5[_0xffd0('0x31')]);_0x1f660c[_0xffd0('0x34')]=_[_0xffd0('0x33')](_0x3a99d5[_0xffd0('0x2f')],qs[_0xffd0('0x35')](_0x18ef0b['query'][_0xffd0('0x35')]));_0x1f660c[_0xffd0('0x34')]=_0x1f660c[_0xffd0('0x34')][_0xffd0('0x36')]?_0x1f660c[_0xffd0('0x34')]:_0x3a99d5['model'];if(_0x18ef0b['query']['includeAll']){_0x1f660c[_0xffd0('0x43')]=[{'all':!![]}];}_0x1f660c=_[_0xffd0('0x3d')]({},_0x1f660c,_0x18ef0b['options']);return db[_0xffd0('0x41')][_0xffd0('0x49')](_0x1f660c)[_0xffd0('0x24')](handleEntityNotFound(_0x236c1d,null))[_0xffd0('0x24')](respondWithResult(_0x236c1d,null))[_0xffd0('0x46')](handleError(_0x236c1d,null));};exports[_0xffd0('0x4a')]=function(_0x3b70a7,_0x2c0ffd){return db[_0xffd0('0x41')][_0xffd0('0x4a')](_0x3b70a7[_0xffd0('0x4b')],{})[_0xffd0('0x24')](function(_0x300a52){var _0x57b453=_0x3b70a7['user'][_0xffd0('0x25')]({'plain':!![]});if(!_0x57b453)throw new Error(_0xffd0('0x4c'));if(_0x57b453[_0xffd0('0x4d')]==='user'){var _0x35b42e=_0x300a52['get']({'plain':!![]});var _0x31c80e=_0xffd0('0x26');return db[_0xffd0('0x4e')][_0xffd0('0x49')]({'where':{'name':_0x31c80e,'userProfileId':_0x57b453['userProfileId']},'raw':!![]})['then'](function(_0x57d072){if(_0x57d072&&_0x57d072[_0xffd0('0x4f')]===0x0){return db[_0xffd0('0x27')][_0xffd0('0x4a')]({'name':_0x35b42e[_0xffd0('0x2a')],'resourceId':_0x35b42e['id'],'type':_0x57d072[_0xffd0('0x2a')],'sectionId':_0x57d072['id']},{})[_0xffd0('0x24')](function(){return _0x300a52;});}else{return _0x300a52;}})[_0xffd0('0x46')](function(_0x4721a6){logger[_0xffd0('0x29')](_0xffd0('0x50'),_0x4721a6);throw _0x4721a6;});}return _0x300a52;})[_0xffd0('0x24')](respondWithResult(_0x2c0ffd,0xc9))[_0xffd0('0x46')](handleError(_0x2c0ffd,null));};exports['update']=function(_0x3ab6dd,_0x1521c9){if(_0x3ab6dd[_0xffd0('0x4b')]['id']){delete _0x3ab6dd[_0xffd0('0x4b')]['id'];}return db[_0xffd0('0x41')][_0xffd0('0x49')]({'where':{'id':_0x3ab6dd[_0xffd0('0x48')]['id']}})['then'](handleEntityNotFound(_0x1521c9,null))[_0xffd0('0x24')](saveUpdates(_0x3ab6dd[_0xffd0('0x4b')],null))[_0xffd0('0x24')](respondWithResult(_0x1521c9,null))[_0xffd0('0x46')](handleError(_0x1521c9,null));};exports['destroy']=function(_0x58acd3,_0x4b863e){return db[_0xffd0('0x41')][_0xffd0('0x49')]({'where':{'id':_0x58acd3[_0xffd0('0x48')]['id']}})[_0xffd0('0x24')](handleEntityNotFound(_0x4b863e,null))[_0xffd0('0x24')](removeEntity(_0x4b863e,null))[_0xffd0('0x46')](handleError(_0x4b863e,null));};
\ No newline at end of file