Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / disposition / disposition.controller.js
index a50c3d9..59665a8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa65=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','get','Dispositions','UserProfileResource','error','name','index','map','Disposition','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','include','rows','catch','show','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x51639a,_0x35f006){var _0x3abae4=function(_0x89b35e){while(--_0x89b35e){_0x51639a['push'](_0x51639a['shift']());}};_0x3abae4(++_0x35f006);}(_0xaa65,0x90));var _0x5aa6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa65[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5aa6('0x0'));var rimraf=require(_0x5aa6('0x1'));var zipdir=require(_0x5aa6('0x2'));var jsonpatch=require(_0x5aa6('0x3'));var rp=require('request-promise');var moment=require(_0x5aa6('0x4'));var BPromise=require(_0x5aa6('0x5'));var Mustache=require(_0x5aa6('0x6'));var util=require(_0x5aa6('0x7'));var path=require(_0x5aa6('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5aa6('0x9'));var fs=require('fs');var fs_extra=require(_0x5aa6('0xa'));var _=require(_0x5aa6('0xb'));var squel=require(_0x5aa6('0xc'));var crypto=require('crypto');var jsforce=require(_0x5aa6('0xd'));var deskjs=require(_0x5aa6('0xe'));var toCsv=require(_0x5aa6('0xf'));var querystring=require(_0x5aa6('0x10'));var Papa=require(_0x5aa6('0x11'));var Redis=require(_0x5aa6('0x12'));var authService=require(_0x5aa6('0x13'));var qs=require(_0x5aa6('0x14'));var as=require(_0x5aa6('0x15'));var hardwareService=require(_0x5aa6('0x16'));var logger=require(_0x5aa6('0x17'))(_0x5aa6('0x18'));var utils=require('../../config/utils');var config=require(_0x5aa6('0x19'));var licenseUtil=require(_0x5aa6('0x1a'));var db=require(_0x5aa6('0x1b'))['db'];function respondWithStatusCode(_0x2705c1,_0x35f52a){_0x35f52a=_0x35f52a||0xcc;return function(_0x4eb241){if(_0x4eb241){return _0x2705c1[_0x5aa6('0x1c')](_0x35f52a);}return _0x2705c1['status'](_0x35f52a)[_0x5aa6('0x1d')]();};}function respondWithResult(_0x3b9975,_0x37b20b){_0x37b20b=_0x37b20b||0xc8;return function(_0xbe2686){if(_0xbe2686){return _0x3b9975['status'](_0x37b20b)['json'](_0xbe2686);}};}function respondWithFilteredResult(_0x54d11f,_0x434bb8){return function(_0x49bc20){if(_0x49bc20){var _0x29c809=typeof _0x434bb8[_0x5aa6('0x1e')]===_0x5aa6('0x1f')&&typeof _0x434bb8[_0x5aa6('0x20')]===_0x5aa6('0x1f');var _0x2dc6b5=_0x49bc20[_0x5aa6('0x21')];var _0x5370dd=_0x29c809?0x0:_0x434bb8['offset'];var _0x16f7e0=_0x29c809?_0x49bc20['count']:_0x434bb8[_0x5aa6('0x1e')]+_0x434bb8['limit'];var _0x223cc6;if(_0x16f7e0>=_0x2dc6b5){_0x16f7e0=_0x2dc6b5;_0x223cc6=0xc8;}else{_0x223cc6=0xce;}_0x54d11f[_0x5aa6('0x22')](_0x223cc6);return _0x54d11f[_0x5aa6('0x23')](_0x5aa6('0x24'),_0x5370dd+'-'+_0x16f7e0+'/'+_0x2dc6b5)['json'](_0x49bc20);}return null;};}function patchUpdates(_0x55d786){return function(_0x313b4b){try{jsonpatch[_0x5aa6('0x25')](_0x313b4b,_0x55d786,!![]);}catch(_0xdc492e){return BPromise[_0x5aa6('0x26')](_0xdc492e);}return _0x313b4b[_0x5aa6('0x27')]();};}function saveUpdates(_0x136f00,_0x27c317){return function(_0x535692){if(_0x535692){return _0x535692[_0x5aa6('0x28')](_0x136f00)['then'](function(_0x5eaddd){return _0x5eaddd;});}return null;};}function removeEntity(_0x296a11,_0x1e74d2){return function(_0x8c7319){if(_0x8c7319){return _0x8c7319[_0x5aa6('0x29')]()[_0x5aa6('0x2a')](function(){var _0x3066a6=_0x8c7319[_0x5aa6('0x2b')]({'plain':!![]});var _0x30a7da=_0x5aa6('0x2c');return db[_0x5aa6('0x2d')][_0x5aa6('0x29')]({'where':{'type':_0x30a7da,'resourceId':_0x3066a6['id']}})[_0x5aa6('0x2a')](function(){return _0x8c7319;});})[_0x5aa6('0x2a')](function(){_0x296a11[_0x5aa6('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x540789,_0x3f0623){return function(_0x546337){if(!_0x546337){_0x540789[_0x5aa6('0x1c')](0x194);}return _0x546337;};}function handleError(_0x35b48b,_0x26c401){_0x26c401=_0x26c401||0x1f4;return function(_0x5c3b1f){logger[_0x5aa6('0x2e')](_0x5c3b1f['stack']);if(_0x5c3b1f['name']){delete _0x5c3b1f[_0x5aa6('0x2f')];}_0x35b48b['status'](_0x26c401)['send'](_0x5c3b1f);};}exports[_0x5aa6('0x30')]=function(_0x33bd51,_0x4ac7c0){var _0x1ce7d1={},_0x407958={},_0x58ec31={'count':0x0,'rows':[]};var _0x5b9aff=_[_0x5aa6('0x31')](db[_0x5aa6('0x32')][_0x5aa6('0x33')],function(_0x39914f){return{'name':_0x39914f[_0x5aa6('0x34')],'type':_0x39914f[_0x5aa6('0x35')][_0x5aa6('0x36')]};});_0x407958[_0x5aa6('0x37')]=_[_0x5aa6('0x31')](_0x5b9aff,'name');_0x407958['query']=_[_0x5aa6('0x38')](_0x33bd51['query']);_0x407958['filters']=_['intersection'](_0x407958[_0x5aa6('0x37')],_0x407958['query']);_0x1ce7d1['attributes']=_[_0x5aa6('0x39')](_0x407958['model'],qs['fields'](_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x3b')]));_0x1ce7d1[_0x5aa6('0x3c')]=_0x1ce7d1[_0x5aa6('0x3c')]['length']?_0x1ce7d1[_0x5aa6('0x3c')]:_0x407958['model'];if(!_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x3d')](_0x5aa6('0x3e'))){_0x1ce7d1[_0x5aa6('0x20')]=qs[_0x5aa6('0x20')](_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x20')]);_0x1ce7d1[_0x5aa6('0x1e')]=qs[_0x5aa6('0x1e')](_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x1e')]);}_0x1ce7d1[_0x5aa6('0x3f')]=qs[_0x5aa6('0x40')](_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x40')]);_0x1ce7d1[_0x5aa6('0x41')]=qs[_0x5aa6('0x42')](_['pick'](_0x33bd51[_0x5aa6('0x3a')],_0x407958[_0x5aa6('0x42')]),_0x5b9aff);if(_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x43')]){_0x1ce7d1['where']=_['merge'](_0x1ce7d1[_0x5aa6('0x41')],{'$or':_[_0x5aa6('0x31')](_0x5b9aff,function(_0x372c95){if(_0x372c95[_0x5aa6('0x35')]!=='VIRTUAL'){var _0x4d19f9={};_0x4d19f9[_0x372c95[_0x5aa6('0x2f')]]={'$like':'%'+_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x43')]+'%'};return _0x4d19f9;}})});}_0x1ce7d1=_[_0x5aa6('0x44')]({},_0x1ce7d1,_0x33bd51['options']);var _0x57b48d={'where':_0x1ce7d1[_0x5aa6('0x41')]};return db[_0x5aa6('0x32')][_0x5aa6('0x21')](_0x57b48d)['then'](function(_0x5b6595){_0x58ec31[_0x5aa6('0x21')]=_0x5b6595;if(_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x45')]){_0x1ce7d1[_0x5aa6('0x46')]=[{'all':!![]}];}return db[_0x5aa6('0x32')]['findAll'](_0x1ce7d1);})[_0x5aa6('0x2a')](function(_0x568afd){_0x58ec31[_0x5aa6('0x47')]=_0x568afd;return _0x58ec31;})[_0x5aa6('0x2a')](respondWithFilteredResult(_0x4ac7c0,_0x1ce7d1))[_0x5aa6('0x48')](handleError(_0x4ac7c0,null));};exports[_0x5aa6('0x49')]=function(_0x24665d,_0x4bb169){var _0x4e2487={'raw':!![],'where':{'id':_0x24665d['params']['id']}},_0x471d2c={};_0x471d2c[_0x5aa6('0x37')]=_['keys'](db[_0x5aa6('0x32')][_0x5aa6('0x33')]);_0x471d2c[_0x5aa6('0x3a')]=_[_0x5aa6('0x38')](_0x24665d[_0x5aa6('0x3a')]);_0x471d2c[_0x5aa6('0x42')]=_['intersection'](_0x471d2c[_0x5aa6('0x37')],_0x471d2c[_0x5aa6('0x3a')]);_0x4e2487[_0x5aa6('0x3c')]=_[_0x5aa6('0x39')](_0x471d2c[_0x5aa6('0x37')],qs['fields'](_0x24665d[_0x5aa6('0x3a')]['fields']));_0x4e2487[_0x5aa6('0x3c')]=_0x4e2487[_0x5aa6('0x3c')]['length']?_0x4e2487['attributes']:_0x471d2c[_0x5aa6('0x37')];if(_0x24665d[_0x5aa6('0x3a')][_0x5aa6('0x45')]){_0x4e2487[_0x5aa6('0x46')]=[{'all':!![]}];}_0x4e2487=_[_0x5aa6('0x44')]({},_0x4e2487,_0x24665d[_0x5aa6('0x4a')]);return db[_0x5aa6('0x32')][_0x5aa6('0x4b')](_0x4e2487)[_0x5aa6('0x2a')](handleEntityNotFound(_0x4bb169,null))[_0x5aa6('0x2a')](respondWithResult(_0x4bb169,null))[_0x5aa6('0x48')](handleError(_0x4bb169,null));};exports['create']=function(_0x5cfb93,_0xc33a2){return db[_0x5aa6('0x32')][_0x5aa6('0x4c')](_0x5cfb93[_0x5aa6('0x4d')],{})[_0x5aa6('0x2a')](function(_0x27bdf4){var _0xb62d69=_0x5cfb93[_0x5aa6('0x4e')][_0x5aa6('0x2b')]({'plain':!![]});if(!_0xb62d69)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb62d69[_0x5aa6('0x4f')]===_0x5aa6('0x4e')){var _0x28c4d7=_0x27bdf4[_0x5aa6('0x2b')]({'plain':!![]});var _0x22ae33=_0x5aa6('0x2c');return db[_0x5aa6('0x50')][_0x5aa6('0x4b')]({'where':{'name':_0x22ae33,'userProfileId':_0xb62d69[_0x5aa6('0x51')]},'raw':!![]})[_0x5aa6('0x2a')](function(_0xf56e54){if(_0xf56e54&&_0xf56e54[_0x5aa6('0x52')]===0x0){return db[_0x5aa6('0x2d')][_0x5aa6('0x4c')]({'name':_0x28c4d7[_0x5aa6('0x2f')],'resourceId':_0x28c4d7['id'],'type':_0xf56e54['name'],'sectionId':_0xf56e54['id']},{})['then'](function(){return _0x27bdf4;});}else{return _0x27bdf4;}})[_0x5aa6('0x48')](function(_0x385966){logger[_0x5aa6('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x385966);throw _0x385966;});}return _0x27bdf4;})[_0x5aa6('0x2a')](respondWithResult(_0xc33a2,0xc9))[_0x5aa6('0x48')](handleError(_0xc33a2,null));};exports[_0x5aa6('0x28')]=function(_0x2b5276,_0x451304){if(_0x2b5276[_0x5aa6('0x4d')]['id']){delete _0x2b5276[_0x5aa6('0x4d')]['id'];}return db[_0x5aa6('0x32')][_0x5aa6('0x4b')]({'where':{'id':_0x2b5276[_0x5aa6('0x53')]['id']}})[_0x5aa6('0x2a')](handleEntityNotFound(_0x451304,null))[_0x5aa6('0x2a')](saveUpdates(_0x2b5276[_0x5aa6('0x4d')],null))[_0x5aa6('0x2a')](respondWithResult(_0x451304,null))[_0x5aa6('0x48')](handleError(_0x451304,null));};exports[_0x5aa6('0x29')]=function(_0x205ac0,_0x2844f8){return db[_0x5aa6('0x32')][_0x5aa6('0x4b')]({'where':{'id':_0x205ac0[_0x5aa6('0x53')]['id']}})[_0x5aa6('0x2a')](handleEntityNotFound(_0x2844f8,null))[_0x5aa6('0x2a')](removeEntity(_0x2844f8,null))[_0x5aa6('0x48')](handleError(_0x2844f8,null));};
\ No newline at end of file
+var _0xba6e=['pick','filter','where','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','get','Dispositions','UserProfileResource','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0xba6e,0x168));var _0xeba6=function(_0xf9ce28,_0x3571a5){_0xf9ce28=_0xf9ce28-0x0;var _0x96578e=_0xba6e[_0xf9ce28];return _0x96578e;};'use strict';var emlformat=require(_0xeba6('0x0'));var rimraf=require(_0xeba6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeba6('0x2'));var rp=require('request-promise');var moment=require(_0xeba6('0x3'));var BPromise=require(_0xeba6('0x4'));var Mustache=require(_0xeba6('0x5'));var util=require(_0xeba6('0x6'));var path=require(_0xeba6('0x7'));var sox=require(_0xeba6('0x8'));var csv=require(_0xeba6('0x9'));var ejs=require(_0xeba6('0xa'));var fs=require('fs');var fs_extra=require(_0xeba6('0xb'));var _=require(_0xeba6('0xc'));var squel=require(_0xeba6('0xd'));var crypto=require(_0xeba6('0xe'));var jsforce=require(_0xeba6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xeba6('0x9'));var querystring=require(_0xeba6('0x10'));var Papa=require(_0xeba6('0x11'));var Redis=require(_0xeba6('0x12'));var authService=require(_0xeba6('0x13'));var qs=require(_0xeba6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeba6('0x15'));var logger=require(_0xeba6('0x16'))(_0xeba6('0x17'));var utils=require(_0xeba6('0x18'));var config=require(_0xeba6('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xeba6('0x1a'))['db'];function respondWithStatusCode(_0xc6c95f,_0x2847cf){_0x2847cf=_0x2847cf||0xcc;return function(_0x9b58c9){if(_0x9b58c9){return _0xc6c95f[_0xeba6('0x1b')](_0x2847cf);}return _0xc6c95f['status'](_0x2847cf)[_0xeba6('0x1c')]();};}function respondWithResult(_0x48abfc,_0x2a9607){_0x2a9607=_0x2a9607||0xc8;return function(_0x232ac1){if(_0x232ac1){return _0x48abfc[_0xeba6('0x1d')](_0x2a9607)[_0xeba6('0x1e')](_0x232ac1);}};}function respondWithFilteredResult(_0x25d2f9,_0x32c8aa){return function(_0x41c36f){if(_0x41c36f){var _0x4c82d2=typeof _0x32c8aa[_0xeba6('0x1f')]===_0xeba6('0x20')&&typeof _0x32c8aa['limit']===_0xeba6('0x20');var _0x1948f3=_0x41c36f[_0xeba6('0x21')];var _0xd632dc=_0x4c82d2?0x0:_0x32c8aa[_0xeba6('0x1f')];var _0x346d44=_0x4c82d2?_0x41c36f[_0xeba6('0x21')]:_0x32c8aa[_0xeba6('0x1f')]+_0x32c8aa[_0xeba6('0x22')];var _0x44ed37;if(_0x346d44>=_0x1948f3){_0x346d44=_0x1948f3;_0x44ed37=0xc8;}else{_0x44ed37=0xce;}_0x25d2f9[_0xeba6('0x1d')](_0x44ed37);return _0x25d2f9[_0xeba6('0x23')](_0xeba6('0x24'),_0xd632dc+'-'+_0x346d44+'/'+_0x1948f3)[_0xeba6('0x1e')](_0x41c36f);}return null;};}function patchUpdates(_0x5a7c69){return function(_0x46856f){try{jsonpatch[_0xeba6('0x25')](_0x46856f,_0x5a7c69,!![]);}catch(_0x33ce8a){return BPromise['reject'](_0x33ce8a);}return _0x46856f['save']();};}function saveUpdates(_0x43e6c4,_0x1264fc){return function(_0x1b61da){if(_0x1b61da){return _0x1b61da[_0xeba6('0x26')](_0x43e6c4)[_0xeba6('0x27')](function(_0x2c55a4){return _0x2c55a4;});}return null;};}function removeEntity(_0x2423ee,_0x5d0889){return function(_0x2d77e3){if(_0x2d77e3){return _0x2d77e3[_0xeba6('0x28')]()[_0xeba6('0x27')](function(){var _0x57d141=_0x2d77e3[_0xeba6('0x29')]({'plain':!![]});var _0x3a7e81=_0xeba6('0x2a');return db[_0xeba6('0x2b')][_0xeba6('0x28')]({'where':{'type':_0x3a7e81,'resourceId':_0x57d141['id']}})[_0xeba6('0x27')](function(){return _0x2d77e3;});})['then'](function(){_0x2423ee[_0xeba6('0x1d')](0xcc)[_0xeba6('0x1c')]();});}};}function handleEntityNotFound(_0x2b6017,_0xfabfd2){return function(_0x57a506){if(!_0x57a506){_0x2b6017[_0xeba6('0x1b')](0x194);}return _0x57a506;};}function handleError(_0x555d74,_0x4e09d9){_0x4e09d9=_0x4e09d9||0x1f4;return function(_0x288a08){logger['error'](_0x288a08[_0xeba6('0x2c')]);if(_0x288a08[_0xeba6('0x2d')]){delete _0x288a08['name'];}_0x555d74['status'](_0x4e09d9)[_0xeba6('0x2e')](_0x288a08);};}exports[_0xeba6('0x2f')]=function(_0x5c5d5f,_0x42e7d0){var _0x3327dc={},_0x5c6797={},_0x2f8ef6={'count':0x0,'rows':[]};var _0x5dc9a7=_[_0xeba6('0x30')](db[_0xeba6('0x31')][_0xeba6('0x32')],function(_0x56bcde){return{'name':_0x56bcde[_0xeba6('0x33')],'type':_0x56bcde['type'][_0xeba6('0x34')]};});_0x5c6797[_0xeba6('0x35')]=_['map'](_0x5dc9a7,_0xeba6('0x2d'));_0x5c6797[_0xeba6('0x36')]=_[_0xeba6('0x37')](_0x5c5d5f[_0xeba6('0x36')]);_0x5c6797[_0xeba6('0x38')]=_[_0xeba6('0x39')](_0x5c6797[_0xeba6('0x35')],_0x5c6797[_0xeba6('0x36')]);_0x3327dc[_0xeba6('0x3a')]=_[_0xeba6('0x39')](_0x5c6797['model'],qs[_0xeba6('0x3b')](_0x5c5d5f[_0xeba6('0x36')][_0xeba6('0x3b')]));_0x3327dc[_0xeba6('0x3a')]=_0x3327dc[_0xeba6('0x3a')][_0xeba6('0x3c')]?_0x3327dc[_0xeba6('0x3a')]:_0x5c6797[_0xeba6('0x35')];if(!_0x5c5d5f['query'][_0xeba6('0x3d')](_0xeba6('0x3e'))){_0x3327dc[_0xeba6('0x22')]=qs['limit'](_0x5c5d5f[_0xeba6('0x36')][_0xeba6('0x22')]);_0x3327dc[_0xeba6('0x1f')]=qs[_0xeba6('0x1f')](_0x5c5d5f['query'][_0xeba6('0x1f')]);}_0x3327dc[_0xeba6('0x3f')]=qs[_0xeba6('0x40')](_0x5c5d5f[_0xeba6('0x36')][_0xeba6('0x40')]);_0x3327dc['where']=qs[_0xeba6('0x38')](_[_0xeba6('0x41')](_0x5c5d5f[_0xeba6('0x36')],_0x5c6797[_0xeba6('0x38')]),_0x5dc9a7);if(_0x5c5d5f[_0xeba6('0x36')][_0xeba6('0x42')]){_0x3327dc[_0xeba6('0x43')]=_[_0xeba6('0x44')](_0x3327dc[_0xeba6('0x43')],{'$or':_['map'](_0x5dc9a7,function(_0x3ab15a){if(_0x3ab15a['type']!=='VIRTUAL'){var _0x55770a={};_0x55770a[_0x3ab15a['name']]={'$like':'%'+_0x5c5d5f['query'][_0xeba6('0x42')]+'%'};return _0x55770a;}})});}_0x3327dc=_[_0xeba6('0x44')]({},_0x3327dc,_0x5c5d5f[_0xeba6('0x45')]);var _0x55cb23={'where':_0x3327dc[_0xeba6('0x43')]};return db[_0xeba6('0x31')][_0xeba6('0x21')](_0x55cb23)[_0xeba6('0x27')](function(_0x2af9c0){_0x2f8ef6[_0xeba6('0x21')]=_0x2af9c0;if(_0x5c5d5f[_0xeba6('0x36')]['includeAll']){_0x3327dc[_0xeba6('0x46')]=[{'all':!![]}];}return db[_0xeba6('0x31')][_0xeba6('0x47')](_0x3327dc);})[_0xeba6('0x27')](function(_0x1b4538){_0x2f8ef6[_0xeba6('0x48')]=_0x1b4538;return _0x2f8ef6;})[_0xeba6('0x27')](respondWithFilteredResult(_0x42e7d0,_0x3327dc))[_0xeba6('0x49')](handleError(_0x42e7d0,null));};exports[_0xeba6('0x4a')]=function(_0x45edc1,_0x59b8f3){var _0x270272={'raw':!![],'where':{'id':_0x45edc1[_0xeba6('0x4b')]['id']}},_0x2c294c={};_0x2c294c['model']=_['keys'](db[_0xeba6('0x31')][_0xeba6('0x32')]);_0x2c294c[_0xeba6('0x36')]=_[_0xeba6('0x37')](_0x45edc1['query']);_0x2c294c[_0xeba6('0x38')]=_[_0xeba6('0x39')](_0x2c294c[_0xeba6('0x35')],_0x2c294c['query']);_0x270272['attributes']=_[_0xeba6('0x39')](_0x2c294c[_0xeba6('0x35')],qs[_0xeba6('0x3b')](_0x45edc1['query'][_0xeba6('0x3b')]));_0x270272['attributes']=_0x270272['attributes']['length']?_0x270272[_0xeba6('0x3a')]:_0x2c294c[_0xeba6('0x35')];if(_0x45edc1[_0xeba6('0x36')][_0xeba6('0x4c')]){_0x270272['include']=[{'all':!![]}];}_0x270272=_[_0xeba6('0x44')]({},_0x270272,_0x45edc1[_0xeba6('0x45')]);return db[_0xeba6('0x31')][_0xeba6('0x4d')](_0x270272)[_0xeba6('0x27')](handleEntityNotFound(_0x59b8f3,null))[_0xeba6('0x27')](respondWithResult(_0x59b8f3,null))['catch'](handleError(_0x59b8f3,null));};exports[_0xeba6('0x4e')]=function(_0x1b3e28,_0x1ce105){return db[_0xeba6('0x31')][_0xeba6('0x4e')](_0x1b3e28[_0xeba6('0x4f')],{})[_0xeba6('0x27')](function(_0x3c314e){var _0x3cc7fd=_0x1b3e28[_0xeba6('0x50')][_0xeba6('0x29')]({'plain':!![]});if(!_0x3cc7fd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cc7fd[_0xeba6('0x51')]==='user'){var _0x2cc00c=_0x3c314e[_0xeba6('0x29')]({'plain':!![]});var _0x5a997d=_0xeba6('0x2a');return db[_0xeba6('0x52')]['find']({'where':{'name':_0x5a997d,'userProfileId':_0x3cc7fd[_0xeba6('0x53')]},'raw':!![]})[_0xeba6('0x27')](function(_0x181577){if(_0x181577&&_0x181577[_0xeba6('0x54')]===0x0){return db[_0xeba6('0x2b')]['create']({'name':_0x2cc00c[_0xeba6('0x2d')],'resourceId':_0x2cc00c['id'],'type':_0x181577[_0xeba6('0x2d')],'sectionId':_0x181577['id']},{})[_0xeba6('0x27')](function(){return _0x3c314e;});}else{return _0x3c314e;}})[_0xeba6('0x49')](function(_0xbb03d5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbb03d5);throw _0xbb03d5;});}return _0x3c314e;})[_0xeba6('0x27')](respondWithResult(_0x1ce105,0xc9))[_0xeba6('0x49')](handleError(_0x1ce105,null));};exports[_0xeba6('0x26')]=function(_0x6ddbb3,_0x4c8677){if(_0x6ddbb3['body']['id']){delete _0x6ddbb3['body']['id'];}return db['Disposition']['find']({'where':{'id':_0x6ddbb3[_0xeba6('0x4b')]['id']}})[_0xeba6('0x27')](handleEntityNotFound(_0x4c8677,null))[_0xeba6('0x27')](saveUpdates(_0x6ddbb3['body'],null))[_0xeba6('0x27')](respondWithResult(_0x4c8677,null))[_0xeba6('0x49')](handleError(_0x4c8677,null));};exports[_0xeba6('0x28')]=function(_0x50f873,_0x314363){return db[_0xeba6('0x31')][_0xeba6('0x4d')]({'where':{'id':_0x50f873[_0xeba6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x314363,null))[_0xeba6('0x27')](removeEntity(_0x314363,null))['catch'](handleError(_0x314363,null));};
\ No newline at end of file