Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / disposition / disposition.controller.js
index 2c49c1e..a50c3d9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0ba7=['then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','options','include','Disposition','findAll','catch','show','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','save','update'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0x0ba7,0x16d));var _0x70ba=function(_0xcb1f41,_0x1b0780){_0xcb1f41=_0xcb1f41-0x0;var _0x1ee017=_0x0ba7[_0xcb1f41];return _0x1ee017;};'use strict';var pdf=require(_0x70ba('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x70ba('0x1'));var zipdir=require(_0x70ba('0x2'));var jsonpatch=require(_0x70ba('0x3'));var rp=require(_0x70ba('0x4'));var moment=require('moment');var BPromise=require(_0x70ba('0x5'));var Mustache=require(_0x70ba('0x6'));var util=require(_0x70ba('0x7'));var path=require(_0x70ba('0x8'));var sox=require(_0x70ba('0x9'));var csv=require(_0x70ba('0xa'));var ejs=require(_0x70ba('0xb'));var fs=require('fs');var _=require(_0x70ba('0xc'));var squel=require(_0x70ba('0xd'));var crypto=require(_0x70ba('0xe'));var jsforce=require(_0x70ba('0xf'));var deskjs=require(_0x70ba('0x10'));var toCsv=require(_0x70ba('0xa'));var querystring=require(_0x70ba('0x11'));var Papa=require(_0x70ba('0x12'));var Redis=require('ioredis');var authService=require(_0x70ba('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x70ba('0x14'));var hardwareService=require(_0x70ba('0x15'));var logger=require(_0x70ba('0x16'))(_0x70ba('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x70ba('0x18'))['db'];function respondWithStatusCode(_0x4a2c2e,_0xd6580e){_0xd6580e=_0xd6580e||0xcc;return function(_0x5e94c7){if(_0x5e94c7){return _0x4a2c2e[_0x70ba('0x19')](_0xd6580e);}return _0x4a2c2e[_0x70ba('0x1a')](_0xd6580e)['end']();};}function respondWithResult(_0x1d674b,_0x57d84e){_0x57d84e=_0x57d84e||0xc8;return function(_0x51321d){if(_0x51321d){return _0x1d674b[_0x70ba('0x1a')](_0x57d84e)[_0x70ba('0x1b')](_0x51321d);}};}function respondWithFilteredResult(_0x10613f,_0x2516fd){return function(_0x29734b){if(_0x29734b){var _0x232138=_0x29734b[_0x70ba('0x1c')],_0x164521=_0x2516fd[_0x70ba('0x1d')],_0x18334a=_0x2516fd[_0x70ba('0x1d')]+_0x2516fd[_0x70ba('0x1e')],_0x3e27e8;if(_0x18334a>=_0x232138){_0x18334a=_0x232138;_0x3e27e8=0xc8;}else{_0x3e27e8=0xce;}_0x10613f['status'](_0x3e27e8);return _0x10613f['set']('Content-Range',_0x164521+'-'+_0x18334a+'/'+_0x232138)[_0x70ba('0x1b')](_0x29734b);}return null;};}function patchUpdates(_0x2dd33a){return function(_0x20c2aa){try{jsonpatch[_0x70ba('0x1f')](_0x20c2aa,_0x2dd33a,!![]);}catch(_0x43caa4){return BPromise[_0x70ba('0x20')](_0x43caa4);}return _0x20c2aa[_0x70ba('0x21')]();};}function saveUpdates(_0x2763f3,_0x415879){return function(_0x40b82c){if(_0x40b82c){return _0x40b82c[_0x70ba('0x22')](_0x2763f3)[_0x70ba('0x23')](function(_0x2a1328){return _0x2a1328;});}return null;};}function removeEntity(_0x4570b0,_0x273ce4){return function(_0x5ebe9d){if(_0x5ebe9d){return _0x5ebe9d[_0x70ba('0x24')]()[_0x70ba('0x23')](function(){var _0x52accf=_0x5ebe9d[_0x70ba('0x25')]({'plain':!![]});var _0x5519d4='Dispositions';return db[_0x70ba('0x26')]['destroy']({'where':{'type':_0x5519d4,'resourceId':_0x52accf['id']}})[_0x70ba('0x23')](function(){return _0x5ebe9d;});})[_0x70ba('0x23')](function(){_0x4570b0['status'](0xcc)[_0x70ba('0x27')]();});}};}function handleEntityNotFound(_0x4ef847,_0x5ad828){return function(_0x39482c){if(!_0x39482c){_0x4ef847['sendStatus'](0x194);}return _0x39482c;};}function handleError(_0x230d11,_0x441fed){_0x441fed=_0x441fed||0x1f4;return function(_0x44f1c0){logger[_0x70ba('0x28')](_0x44f1c0[_0x70ba('0x29')]);if(_0x44f1c0[_0x70ba('0x2a')]){delete _0x44f1c0['name'];}_0x230d11[_0x70ba('0x1a')](_0x441fed)[_0x70ba('0x2b')](_0x44f1c0);};}exports[_0x70ba('0x2c')]=function(_0x5179c6,_0x445fe5){var _0x51b5cb={},_0x5955dc={},_0x505f98={'count':0x0,'rows':[]};var _0x77e564=_[_0x70ba('0x2d')](db['Disposition']['rawAttributes'],function(_0x16dc2f){return{'name':_0x16dc2f['fieldName'],'type':_0x16dc2f[_0x70ba('0x2e')][_0x70ba('0x2f')]};});_0x5955dc[_0x70ba('0x30')]=_[_0x70ba('0x2d')](_0x77e564,_0x70ba('0x2a'));_0x5955dc[_0x70ba('0x31')]=_[_0x70ba('0x32')](_0x5179c6[_0x70ba('0x31')]);_0x5955dc[_0x70ba('0x33')]=_[_0x70ba('0x34')](_0x5955dc[_0x70ba('0x30')],_0x5955dc['query']);_0x51b5cb['attributes']=_[_0x70ba('0x34')](_0x5955dc[_0x70ba('0x30')],qs[_0x70ba('0x35')](_0x5179c6['query']['fields']));_0x51b5cb['attributes']=_0x51b5cb[_0x70ba('0x36')][_0x70ba('0x37')]?_0x51b5cb[_0x70ba('0x36')]:_0x5955dc['model'];if(!_0x5179c6[_0x70ba('0x31')]['hasOwnProperty']('nolimit')){_0x51b5cb[_0x70ba('0x1e')]=qs['limit'](_0x5179c6[_0x70ba('0x31')][_0x70ba('0x1e')]);_0x51b5cb['offset']=qs[_0x70ba('0x1d')](_0x5179c6[_0x70ba('0x31')][_0x70ba('0x1d')]);}_0x51b5cb['order']=qs[_0x70ba('0x38')](_0x5179c6[_0x70ba('0x31')][_0x70ba('0x38')]);_0x51b5cb[_0x70ba('0x39')]=qs['filters'](_[_0x70ba('0x3a')](_0x5179c6['query'],_0x5955dc[_0x70ba('0x33')]));if(_0x5179c6[_0x70ba('0x31')][_0x70ba('0x3b')]){_0x51b5cb[_0x70ba('0x39')]=_[_0x70ba('0x3c')](_0x51b5cb[_0x70ba('0x39')],{'$or':_[_0x70ba('0x2d')](_0x77e564,function(_0x5937b7){if(_0x5937b7[_0x70ba('0x2e')]!==_0x70ba('0x3d')){var _0x31e713={};_0x31e713[_0x5937b7[_0x70ba('0x2a')]]={'$like':'%'+_0x5179c6[_0x70ba('0x31')][_0x70ba('0x3b')]+'%'};return _0x31e713;}})});}_0x51b5cb=_['merge']({},_0x51b5cb,_0x5179c6[_0x70ba('0x3e')]);var _0x175152={'where':_0x51b5cb[_0x70ba('0x39')]};return db['Disposition']['count'](_0x175152)['then'](function(_0x215ccc){_0x505f98[_0x70ba('0x1c')]=_0x215ccc;if(_0x5179c6[_0x70ba('0x31')]['includeAll']){_0x51b5cb[_0x70ba('0x3f')]=[{'all':!![]}];}return db[_0x70ba('0x40')][_0x70ba('0x41')](_0x51b5cb);})[_0x70ba('0x23')](function(_0x112703){_0x505f98['rows']=_0x112703;return _0x505f98;})['then'](respondWithFilteredResult(_0x445fe5,_0x51b5cb))[_0x70ba('0x42')](handleError(_0x445fe5,null));};exports[_0x70ba('0x43')]=function(_0x3bdd66,_0x5a1edb){var _0x595645={'raw':!![],'where':{'id':_0x3bdd66['params']['id']}},_0x2fc262={};_0x2fc262[_0x70ba('0x30')]=_[_0x70ba('0x32')](db[_0x70ba('0x40')][_0x70ba('0x44')]);_0x2fc262[_0x70ba('0x31')]=_['keys'](_0x3bdd66[_0x70ba('0x31')]);_0x2fc262[_0x70ba('0x33')]=_[_0x70ba('0x34')](_0x2fc262[_0x70ba('0x30')],_0x2fc262[_0x70ba('0x31')]);_0x595645[_0x70ba('0x36')]=_[_0x70ba('0x34')](_0x2fc262[_0x70ba('0x30')],qs[_0x70ba('0x35')](_0x3bdd66[_0x70ba('0x31')][_0x70ba('0x35')]));_0x595645[_0x70ba('0x36')]=_0x595645[_0x70ba('0x36')][_0x70ba('0x37')]?_0x595645[_0x70ba('0x36')]:_0x2fc262['model'];if(_0x3bdd66[_0x70ba('0x31')][_0x70ba('0x45')]){_0x595645['include']=[{'all':!![]}];}_0x595645=_[_0x70ba('0x3c')]({},_0x595645,_0x3bdd66[_0x70ba('0x3e')]);return db[_0x70ba('0x40')][_0x70ba('0x46')](_0x595645)[_0x70ba('0x23')](handleEntityNotFound(_0x5a1edb,null))[_0x70ba('0x23')](respondWithResult(_0x5a1edb,null))[_0x70ba('0x42')](handleError(_0x5a1edb,null));};exports['create']=function(_0x2e2613,_0x21f462){return db[_0x70ba('0x40')][_0x70ba('0x47')](_0x2e2613[_0x70ba('0x48')],{})[_0x70ba('0x23')](function(_0x35bb91){var _0x400c37=_0x2e2613[_0x70ba('0x49')][_0x70ba('0x25')]({'plain':!![]});if(!_0x400c37)throw new Error(_0x70ba('0x4a'));if(_0x400c37[_0x70ba('0x4b')]===_0x70ba('0x49')){var _0x16af4d=_0x35bb91[_0x70ba('0x25')]({'plain':!![]});var _0x2536cd=_0x70ba('0x4c');return db['UserProfileSection'][_0x70ba('0x46')]({'where':{'name':_0x2536cd,'userProfileId':_0x400c37[_0x70ba('0x4d')]},'raw':!![]})[_0x70ba('0x23')](function(_0x19c99c){if(_0x19c99c&&_0x19c99c['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16af4d[_0x70ba('0x2a')],'resourceId':_0x16af4d['id'],'type':_0x19c99c[_0x70ba('0x2a')],'sectionId':_0x19c99c['id']},{})['then'](function(){return _0x35bb91;});}else{return _0x35bb91;}})['catch'](function(_0x6a3dc6){logger[_0x70ba('0x28')](_0x70ba('0x4e'),_0x6a3dc6);throw _0x6a3dc6;});}return _0x35bb91;})[_0x70ba('0x23')](respondWithResult(_0x21f462,0xc9))[_0x70ba('0x42')](handleError(_0x21f462,null));};exports[_0x70ba('0x22')]=function(_0x3b05c6,_0x5bb322){if(_0x3b05c6['body']['id']){delete _0x3b05c6[_0x70ba('0x48')]['id'];}return db[_0x70ba('0x40')][_0x70ba('0x46')]({'where':{'id':_0x3b05c6[_0x70ba('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5bb322,null))[_0x70ba('0x23')](saveUpdates(_0x3b05c6[_0x70ba('0x48')],null))['then'](respondWithResult(_0x5bb322,null))['catch'](handleError(_0x5bb322,null));};exports['destroy']=function(_0x4acb51,_0x2195d9){return db[_0x70ba('0x40')][_0x70ba('0x46')]({'where':{'id':_0x4acb51['params']['id']}})[_0x70ba('0x23')](handleEntityNotFound(_0x2195d9,null))[_0x70ba('0x23')](removeEntity(_0x2195d9,null))[_0x70ba('0x42')](handleError(_0x2195d9,null));};
\ No newline at end of file
+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