Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index f1c7484..71bed70 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xea7d=['filters','pick','merge','filter','options','SquareOdbc','includeAll','include','rows','catch','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','closeSync','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','ODBC','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where'];(function(_0xe2d820,_0x5d7329){var _0x3698b3=function(_0x2858bb){while(--_0x2858bb){_0xe2d820['push'](_0xe2d820['shift']());}};_0x3698b3(++_0x5d7329);}(_0xea7d,0x12b));var _0xdea7=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0xea7d[_0x237da8];return _0x558825;};'use strict';var pdf=require(_0xdea7('0x0'));var emlformat=require(_0xdea7('0x1'));var rimraf=require(_0xdea7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdea7('0x3'));var moment=require(_0xdea7('0x4'));var BPromise=require(_0xdea7('0x5'));var Mustache=require(_0xdea7('0x6'));var util=require(_0xdea7('0x7'));var path=require(_0xdea7('0x8'));var sox=require('sox');var csv=require(_0xdea7('0x9'));var ejs=require(_0xdea7('0xa'));var fs=require('fs');var _=require(_0xdea7('0xb'));var squel=require(_0xdea7('0xc'));var crypto=require(_0xdea7('0xd'));var jsforce=require(_0xdea7('0xe'));var deskjs=require(_0xdea7('0xf'));var toCsv=require(_0xdea7('0x9'));var querystring=require(_0xdea7('0x10'));var Papa=require(_0xdea7('0x11'));var Redis=require(_0xdea7('0x12'));var authService=require(_0xdea7('0x13'));var qs=require(_0xdea7('0x14'));var as=require(_0xdea7('0x15'));var hardwareService=require(_0xdea7('0x16'));var logger=require(_0xdea7('0x17'))(_0xdea7('0x18'));var utils=require(_0xdea7('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xdea7('0x1a'));var db=require(_0xdea7('0x1b'))['db'];function respondWithStatusCode(_0xf14ed9,_0x376813){_0x376813=_0x376813||0xcc;return function(_0x3bae0c){if(_0x3bae0c){return _0xf14ed9[_0xdea7('0x1c')](_0x376813);}return _0xf14ed9['status'](_0x376813)[_0xdea7('0x1d')]();};}function respondWithResult(_0x11a7d8,_0x33df80){_0x33df80=_0x33df80||0xc8;return function(_0x29fe97){if(_0x29fe97){return _0x11a7d8[_0xdea7('0x1e')](_0x33df80)[_0xdea7('0x1f')](_0x29fe97);}};}function respondWithFilteredResult(_0xc31f44,_0x2eb052){return function(_0x58b86d){if(_0x58b86d){var _0x3c2548=_0x58b86d[_0xdea7('0x20')],_0xc4004d=_0x2eb052[_0xdea7('0x21')],_0x580fc1=_0x2eb052[_0xdea7('0x21')]+_0x2eb052[_0xdea7('0x22')],_0x53384f;if(_0x580fc1>=_0x3c2548){_0x580fc1=_0x3c2548;_0x53384f=0xc8;}else{_0x53384f=0xce;}_0xc31f44[_0xdea7('0x1e')](_0x53384f);return _0xc31f44[_0xdea7('0x23')](_0xdea7('0x24'),_0xc4004d+'-'+_0x580fc1+'/'+_0x3c2548)['json'](_0x58b86d);}return null;};}function patchUpdates(_0x287fa5){return function(_0x1aa5e0){try{jsonpatch[_0xdea7('0x25')](_0x1aa5e0,_0x287fa5,!![]);}catch(_0x4d0e2d){return BPromise[_0xdea7('0x26')](_0x4d0e2d);}return _0x1aa5e0[_0xdea7('0x27')]();};}function saveUpdates(_0xd4579c,_0x5cce63){return function(_0x4385fd){if(_0x4385fd){return _0x4385fd[_0xdea7('0x28')](_0xd4579c)[_0xdea7('0x29')](function(_0x2fec39){return _0x2fec39;});}return null;};}function removeEntity(_0x19e73f,_0x5492ce){return function(_0x1104ec){if(_0x1104ec){return _0x1104ec[_0xdea7('0x2a')]()['then'](function(){var _0x6842be=_0x1104ec['get']({'plain':!![]});var _0x5e2cbb=_0xdea7('0x2b');return db[_0xdea7('0x2c')]['destroy']({'where':{'type':_0x5e2cbb,'resourceId':_0x6842be['id']}})['then'](function(){return _0x1104ec;});})[_0xdea7('0x29')](function(){_0x19e73f[_0xdea7('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35da61,_0x5b61e1){return function(_0x8572d3){if(!_0x8572d3){_0x35da61['sendStatus'](0x194);}return _0x8572d3;};}function handleError(_0x1c1c35,_0x5e18af){_0x5e18af=_0x5e18af||0x1f4;return function(_0x577a17){logger[_0xdea7('0x2d')](_0x577a17[_0xdea7('0x2e')]);if(_0x577a17[_0xdea7('0x2f')]){delete _0x577a17[_0xdea7('0x2f')];}_0x1c1c35[_0xdea7('0x1e')](_0x5e18af)[_0xdea7('0x30')](_0x577a17);};}exports['index']=function(_0x282b9a,_0x3eb9bc){var _0x3e966b={},_0xb1b0d5={},_0x2ff79f={'count':0x0,'rows':[]};var _0x252c7b=_[_0xdea7('0x31')](db['SquareOdbc'][_0xdea7('0x32')],function(_0x1ce2fa){return{'name':_0x1ce2fa[_0xdea7('0x33')],'type':_0x1ce2fa[_0xdea7('0x34')][_0xdea7('0x35')]};});_0xb1b0d5[_0xdea7('0x36')]=_['map'](_0x252c7b,_0xdea7('0x2f'));_0xb1b0d5['query']=_[_0xdea7('0x37')](_0x282b9a[_0xdea7('0x38')]);_0xb1b0d5['filters']=_[_0xdea7('0x39')](_0xb1b0d5[_0xdea7('0x36')],_0xb1b0d5[_0xdea7('0x38')]);_0x3e966b['attributes']=_[_0xdea7('0x39')](_0xb1b0d5['model'],qs[_0xdea7('0x3a')](_0x282b9a[_0xdea7('0x38')][_0xdea7('0x3a')]));_0x3e966b[_0xdea7('0x3b')]=_0x3e966b[_0xdea7('0x3b')][_0xdea7('0x3c')]?_0x3e966b['attributes']:_0xb1b0d5[_0xdea7('0x36')];if(!_0x282b9a[_0xdea7('0x38')][_0xdea7('0x3d')]('nolimit')){_0x3e966b[_0xdea7('0x22')]=qs['limit'](_0x282b9a[_0xdea7('0x38')][_0xdea7('0x22')]);_0x3e966b[_0xdea7('0x21')]=qs[_0xdea7('0x21')](_0x282b9a['query'][_0xdea7('0x21')]);}_0x3e966b[_0xdea7('0x3e')]=qs[_0xdea7('0x3f')](_0x282b9a['query'][_0xdea7('0x3f')]);_0x3e966b[_0xdea7('0x40')]=qs[_0xdea7('0x41')](_[_0xdea7('0x42')](_0x282b9a['query'],_0xb1b0d5[_0xdea7('0x41')]),_0x252c7b);if(_0x282b9a['query']['filter']){_0x3e966b[_0xdea7('0x40')]=_[_0xdea7('0x43')](_0x3e966b['where'],{'$or':_['map'](_0x252c7b,function(_0xe372ce){if(_0xe372ce['type']!=='VIRTUAL'){var _0x3a8549={};_0x3a8549[_0xe372ce[_0xdea7('0x2f')]]={'$like':'%'+_0x282b9a[_0xdea7('0x38')][_0xdea7('0x44')]+'%'};return _0x3a8549;}})});}_0x3e966b=_[_0xdea7('0x43')]({},_0x3e966b,_0x282b9a[_0xdea7('0x45')]);var _0x266064={'where':_0x3e966b['where']};return db[_0xdea7('0x46')]['count'](_0x266064)['then'](function(_0xd1d2fe){_0x2ff79f[_0xdea7('0x20')]=_0xd1d2fe;if(_0x282b9a[_0xdea7('0x38')][_0xdea7('0x47')]){_0x3e966b[_0xdea7('0x48')]=[{'all':!![]}];}return db[_0xdea7('0x46')]['findAll'](_0x3e966b);})['then'](function(_0x40854c){_0x2ff79f[_0xdea7('0x49')]=_0x40854c;return _0x2ff79f;})['then'](respondWithFilteredResult(_0x3eb9bc,_0x3e966b))[_0xdea7('0x4a')](handleError(_0x3eb9bc,null));};exports[_0xdea7('0x4b')]=function(_0x34d891,_0x793dee){var _0x6181bc={'raw':!![],'where':{'id':_0x34d891[_0xdea7('0x4c')]['id']}},_0x55b38e={};_0x55b38e[_0xdea7('0x36')]=_[_0xdea7('0x37')](db['SquareOdbc'][_0xdea7('0x32')]);_0x55b38e[_0xdea7('0x38')]=_['keys'](_0x34d891[_0xdea7('0x38')]);_0x55b38e[_0xdea7('0x41')]=_[_0xdea7('0x39')](_0x55b38e[_0xdea7('0x36')],_0x55b38e['query']);_0x6181bc[_0xdea7('0x3b')]=_['intersection'](_0x55b38e[_0xdea7('0x36')],qs[_0xdea7('0x3a')](_0x34d891['query']['fields']));_0x6181bc['attributes']=_0x6181bc[_0xdea7('0x3b')][_0xdea7('0x3c')]?_0x6181bc['attributes']:_0x55b38e[_0xdea7('0x36')];if(_0x34d891[_0xdea7('0x38')]['includeAll']){_0x6181bc['include']=[{'all':!![]}];}_0x6181bc=_[_0xdea7('0x43')]({},_0x6181bc,_0x34d891[_0xdea7('0x45')]);return db['SquareOdbc'][_0xdea7('0x4d')](_0x6181bc)[_0xdea7('0x29')](handleEntityNotFound(_0x793dee,null))[_0xdea7('0x29')](respondWithResult(_0x793dee,null))[_0xdea7('0x4a')](handleError(_0x793dee,null));};exports[_0xdea7('0x4e')]=function(_0x1d3a91,_0x129129){return db[_0xdea7('0x46')][_0xdea7('0x4e')](_0x1d3a91[_0xdea7('0x4f')],{})[_0xdea7('0x29')](function(_0x29b077){var _0x18747f=_0x1d3a91['user'][_0xdea7('0x50')]({'plain':!![]});if(!_0x18747f)throw new Error(_0xdea7('0x51'));if(_0x18747f[_0xdea7('0x52')]===_0xdea7('0x53')){var _0x4e57d0=_0x29b077[_0xdea7('0x50')]({'plain':!![]});var _0x23ec4d=_0xdea7('0x2b');return db['UserProfileSection'][_0xdea7('0x4d')]({'where':{'name':_0x23ec4d,'userProfileId':_0x18747f[_0xdea7('0x54')]},'raw':!![]})[_0xdea7('0x29')](function(_0x47147f){if(_0x47147f&&_0x47147f[_0xdea7('0x55')]===0x0){return db[_0xdea7('0x2c')][_0xdea7('0x4e')]({'name':_0x4e57d0['name'],'resourceId':_0x4e57d0['id'],'type':_0x47147f['name'],'sectionId':_0x47147f['id']},{})[_0xdea7('0x29')](function(){return _0x29b077;});}else{return _0x29b077;}})[_0xdea7('0x4a')](function(_0x119194){logger['error'](_0xdea7('0x56'),_0x119194);throw _0x119194;});}return _0x29b077;})[_0xdea7('0x29')](respondWithResult(_0x129129,0xc9))[_0xdea7('0x4a')](handleError(_0x129129,null));};exports[_0xdea7('0x28')]=function(_0x275dfc,_0xe9ea1e){if(_0x275dfc[_0xdea7('0x4f')]['id']){delete _0x275dfc['body']['id'];}return db[_0xdea7('0x46')][_0xdea7('0x4d')]({'where':{'id':_0x275dfc[_0xdea7('0x4c')]['id']}})[_0xdea7('0x29')](handleEntityNotFound(_0xe9ea1e,null))[_0xdea7('0x29')](saveUpdates(_0x275dfc['body'],null))['then'](respondWithResult(_0xe9ea1e,null))[_0xdea7('0x4a')](handleError(_0xe9ea1e,null));};exports[_0xdea7('0x2a')]=function(_0x6f59cd,_0x243c70){return db[_0xdea7('0x46')][_0xdea7('0x4d')]({'where':{'id':_0x6f59cd[_0xdea7('0x4c')]['id']}})[_0xdea7('0x29')](handleEntityNotFound(_0x243c70,null))['then'](removeEntity(_0x243c70,null))[_0xdea7('0x4a')](handleError(_0x243c70,null));};exports[_0xdea7('0x57')]=function(_0x4ae2be,_0x3d4486,_0x23dd8c){var _0x11d036;return db[_0xdea7('0x46')][_0xdea7('0x4d')]({'where':{'id':_0x4ae2be[_0xdea7('0x4c')]['id']},'attributes':['id',_0xdea7('0x58')]})['then'](handleEntityNotFound(_0x3d4486,null))[_0xdea7('0x29')](function(_0x8331d3){if(_0x8331d3){var _0x3b5999=require('odbc')();_0x3b5999[_0xdea7('0x59')](_0x8331d3[_0xdea7('0x58')]);_0x3b5999[_0xdea7('0x5a')]();return _0x8331d3;}})[_0xdea7('0x29')](respondWithResult(_0x3d4486,null))['catch'](handleError(_0x3d4486,null));};
\ No newline at end of file
+var _0x2600=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','get','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','userProfileId','autoAssociation','destroy','test','odbc','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis'];(function(_0x5f06d2,_0x5efdad){var _0x5c766f=function(_0x1f4801){while(--_0x1f4801){_0x5f06d2['push'](_0x5f06d2['shift']());}};_0x5c766f(++_0x5efdad);}(_0x2600,0xa1));var _0x0260=function(_0x19d6f9,_0x1f3e4a){_0x19d6f9=_0x19d6f9-0x0;var _0xcc0e03=_0x2600[_0x19d6f9];return _0xcc0e03;};'use strict';var emlformat=require(_0x0260('0x0'));var rimraf=require(_0x0260('0x1'));var zipdir=require(_0x0260('0x2'));var jsonpatch=require(_0x0260('0x3'));var rp=require(_0x0260('0x4'));var moment=require(_0x0260('0x5'));var BPromise=require(_0x0260('0x6'));var Mustache=require('mustache');var util=require(_0x0260('0x7'));var path=require(_0x0260('0x8'));var sox=require(_0x0260('0x9'));var csv=require('to-csv');var ejs=require(_0x0260('0xa'));var fs=require('fs');var fs_extra=require(_0x0260('0xb'));var _=require(_0x0260('0xc'));var squel=require(_0x0260('0xd'));var crypto=require(_0x0260('0xe'));var jsforce=require(_0x0260('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0260('0x10'));var querystring=require(_0x0260('0x11'));var Papa=require('papaparse');var Redis=require(_0x0260('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0260('0x13'));var as=require(_0x0260('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0260('0x15'));var utils=require(_0x0260('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0260('0x17'));var db=require(_0x0260('0x18'))['db'];function respondWithStatusCode(_0x5076cb,_0x2f55bc){_0x2f55bc=_0x2f55bc||0xcc;return function(_0x294117){if(_0x294117){return _0x5076cb[_0x0260('0x19')](_0x2f55bc);}return _0x5076cb[_0x0260('0x1a')](_0x2f55bc)[_0x0260('0x1b')]();};}function respondWithResult(_0xaa8d7a,_0x53b2c1){_0x53b2c1=_0x53b2c1||0xc8;return function(_0x592e7f){if(_0x592e7f){return _0xaa8d7a['status'](_0x53b2c1)[_0x0260('0x1c')](_0x592e7f);}};}function respondWithFilteredResult(_0x37bea9,_0x518bf5){return function(_0x3815f4){if(_0x3815f4){var _0x3972b3=typeof _0x518bf5['offset']==='undefined'&&typeof _0x518bf5[_0x0260('0x1d')]===_0x0260('0x1e');var _0xcc7e=_0x3815f4[_0x0260('0x1f')];var _0x1425bd=_0x3972b3?0x0:_0x518bf5[_0x0260('0x20')];var _0x15b173=_0x3972b3?_0x3815f4[_0x0260('0x1f')]:_0x518bf5['offset']+_0x518bf5[_0x0260('0x1d')];var _0x3009f6;if(_0x15b173>=_0xcc7e){_0x15b173=_0xcc7e;_0x3009f6=0xc8;}else{_0x3009f6=0xce;}_0x37bea9['status'](_0x3009f6);return _0x37bea9[_0x0260('0x21')]('Content-Range',_0x1425bd+'-'+_0x15b173+'/'+_0xcc7e)[_0x0260('0x1c')](_0x3815f4);}return null;};}function patchUpdates(_0x369d48){return function(_0x18b33d){try{jsonpatch[_0x0260('0x22')](_0x18b33d,_0x369d48,!![]);}catch(_0x1f078b){return BPromise[_0x0260('0x23')](_0x1f078b);}return _0x18b33d[_0x0260('0x24')]();};}function saveUpdates(_0x4f5dec,_0x43a564){return function(_0x53a98b){if(_0x53a98b){return _0x53a98b[_0x0260('0x25')](_0x4f5dec)[_0x0260('0x26')](function(_0x4ac31f){return _0x4ac31f;});}return null;};}function removeEntity(_0x240b0f,_0x54033d){return function(_0x398b2a){if(_0x398b2a){return _0x398b2a['destroy']()[_0x0260('0x26')](function(){var _0x1246b1=_0x398b2a[_0x0260('0x27')]({'plain':!![]});var _0x49154a='ODBC';return db[_0x0260('0x28')]['destroy']({'where':{'type':_0x49154a,'resourceId':_0x1246b1['id']}})[_0x0260('0x26')](function(){return _0x398b2a;});})[_0x0260('0x26')](function(){_0x240b0f[_0x0260('0x1a')](0xcc)[_0x0260('0x1b')]();});}};}function handleEntityNotFound(_0x47f62f,_0x1e8621){return function(_0x1aa355){if(!_0x1aa355){_0x47f62f[_0x0260('0x19')](0x194);}return _0x1aa355;};}function handleError(_0x3b1b5,_0x29c4c7){_0x29c4c7=_0x29c4c7||0x1f4;return function(_0x3c3be4){logger[_0x0260('0x29')](_0x3c3be4[_0x0260('0x2a')]);if(_0x3c3be4[_0x0260('0x2b')]){delete _0x3c3be4[_0x0260('0x2b')];}_0x3b1b5[_0x0260('0x1a')](_0x29c4c7)[_0x0260('0x2c')](_0x3c3be4);};}exports[_0x0260('0x2d')]=function(_0x5a814d,_0x188f25){var _0x491560={},_0x13c225={},_0x31b764={'count':0x0,'rows':[]};var _0x434707=_[_0x0260('0x2e')](db[_0x0260('0x2f')][_0x0260('0x30')],function(_0x4f44b7){return{'name':_0x4f44b7[_0x0260('0x31')],'type':_0x4f44b7[_0x0260('0x32')][_0x0260('0x33')]};});_0x13c225[_0x0260('0x34')]=_[_0x0260('0x2e')](_0x434707,'name');_0x13c225['query']=_[_0x0260('0x35')](_0x5a814d[_0x0260('0x36')]);_0x13c225[_0x0260('0x37')]=_[_0x0260('0x38')](_0x13c225[_0x0260('0x34')],_0x13c225[_0x0260('0x36')]);_0x491560[_0x0260('0x39')]=_[_0x0260('0x38')](_0x13c225[_0x0260('0x34')],qs[_0x0260('0x3a')](_0x5a814d[_0x0260('0x36')][_0x0260('0x3a')]));_0x491560[_0x0260('0x39')]=_0x491560[_0x0260('0x39')][_0x0260('0x3b')]?_0x491560[_0x0260('0x39')]:_0x13c225[_0x0260('0x34')];if(!_0x5a814d[_0x0260('0x36')][_0x0260('0x3c')](_0x0260('0x3d'))){_0x491560['limit']=qs['limit'](_0x5a814d['query'][_0x0260('0x1d')]);_0x491560[_0x0260('0x20')]=qs[_0x0260('0x20')](_0x5a814d['query'][_0x0260('0x20')]);}_0x491560['order']=qs[_0x0260('0x3e')](_0x5a814d[_0x0260('0x36')]['sort']);_0x491560[_0x0260('0x3f')]=qs[_0x0260('0x37')](_[_0x0260('0x40')](_0x5a814d[_0x0260('0x36')],_0x13c225[_0x0260('0x37')]),_0x434707);if(_0x5a814d['query']['filter']){_0x491560[_0x0260('0x3f')]=_[_0x0260('0x41')](_0x491560[_0x0260('0x3f')],{'$or':_[_0x0260('0x2e')](_0x434707,function(_0xb43f2d){if(_0xb43f2d[_0x0260('0x32')]!=='VIRTUAL'){var _0x30a8f9={};_0x30a8f9[_0xb43f2d[_0x0260('0x2b')]]={'$like':'%'+_0x5a814d[_0x0260('0x36')][_0x0260('0x42')]+'%'};return _0x30a8f9;}})});}_0x491560=_[_0x0260('0x41')]({},_0x491560,_0x5a814d['options']);var _0x50f082={'where':_0x491560[_0x0260('0x3f')]};return db[_0x0260('0x2f')][_0x0260('0x1f')](_0x50f082)[_0x0260('0x26')](function(_0x192118){_0x31b764[_0x0260('0x1f')]=_0x192118;if(_0x5a814d[_0x0260('0x36')][_0x0260('0x43')]){_0x491560[_0x0260('0x44')]=[{'all':!![]}];}return db[_0x0260('0x2f')][_0x0260('0x45')](_0x491560);})[_0x0260('0x26')](function(_0x13bc6d){_0x31b764[_0x0260('0x46')]=_0x13bc6d;return _0x31b764;})[_0x0260('0x26')](respondWithFilteredResult(_0x188f25,_0x491560))[_0x0260('0x47')](handleError(_0x188f25,null));};exports['show']=function(_0x27c12e,_0x353278){var _0x495754={'raw':!![],'where':{'id':_0x27c12e[_0x0260('0x48')]['id']}},_0x32891a={};_0x32891a[_0x0260('0x34')]=_[_0x0260('0x35')](db[_0x0260('0x2f')][_0x0260('0x30')]);_0x32891a[_0x0260('0x36')]=_[_0x0260('0x35')](_0x27c12e[_0x0260('0x36')]);_0x32891a[_0x0260('0x37')]=_['intersection'](_0x32891a[_0x0260('0x34')],_0x32891a['query']);_0x495754[_0x0260('0x39')]=_['intersection'](_0x32891a[_0x0260('0x34')],qs[_0x0260('0x3a')](_0x27c12e[_0x0260('0x36')]['fields']));_0x495754[_0x0260('0x39')]=_0x495754[_0x0260('0x39')][_0x0260('0x3b')]?_0x495754['attributes']:_0x32891a['model'];if(_0x27c12e['query'][_0x0260('0x43')]){_0x495754[_0x0260('0x44')]=[{'all':!![]}];}_0x495754=_[_0x0260('0x41')]({},_0x495754,_0x27c12e[_0x0260('0x49')]);return db[_0x0260('0x2f')][_0x0260('0x4a')](_0x495754)[_0x0260('0x26')](handleEntityNotFound(_0x353278,null))[_0x0260('0x26')](respondWithResult(_0x353278,null))[_0x0260('0x47')](handleError(_0x353278,null));};exports['create']=function(_0x36450a,_0x46704b){return db[_0x0260('0x2f')][_0x0260('0x4b')](_0x36450a[_0x0260('0x4c')],{})['then'](function(_0x9efecb){var _0x5df8e0=_0x36450a[_0x0260('0x4d')]['get']({'plain':!![]});if(!_0x5df8e0)throw new Error(_0x0260('0x4e'));if(_0x5df8e0[_0x0260('0x4f')]===_0x0260('0x4d')){var _0x5a8ab3=_0x9efecb[_0x0260('0x27')]({'plain':!![]});var _0x5632e5=_0x0260('0x50');return db[_0x0260('0x51')][_0x0260('0x4a')]({'where':{'name':_0x5632e5,'userProfileId':_0x5df8e0[_0x0260('0x52')]},'raw':!![]})[_0x0260('0x26')](function(_0x44288d){if(_0x44288d&&_0x44288d[_0x0260('0x53')]===0x0){return db[_0x0260('0x28')][_0x0260('0x4b')]({'name':_0x5a8ab3['name'],'resourceId':_0x5a8ab3['id'],'type':_0x44288d['name'],'sectionId':_0x44288d['id']},{})[_0x0260('0x26')](function(){return _0x9efecb;});}else{return _0x9efecb;}})['catch'](function(_0x2952af){logger[_0x0260('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2952af);throw _0x2952af;});}return _0x9efecb;})[_0x0260('0x26')](respondWithResult(_0x46704b,0xc9))[_0x0260('0x47')](handleError(_0x46704b,null));};exports[_0x0260('0x25')]=function(_0x3d8332,_0x32b495){if(_0x3d8332['body']['id']){delete _0x3d8332['body']['id'];}return db[_0x0260('0x2f')][_0x0260('0x4a')]({'where':{'id':_0x3d8332['params']['id']}})[_0x0260('0x26')](handleEntityNotFound(_0x32b495,null))[_0x0260('0x26')](saveUpdates(_0x3d8332['body'],null))[_0x0260('0x26')](respondWithResult(_0x32b495,null))[_0x0260('0x47')](handleError(_0x32b495,null));};exports[_0x0260('0x54')]=function(_0x370890,_0x290f97){return db[_0x0260('0x2f')]['find']({'where':{'id':_0x370890[_0x0260('0x48')]['id']}})[_0x0260('0x26')](handleEntityNotFound(_0x290f97,null))[_0x0260('0x26')](removeEntity(_0x290f97,null))[_0x0260('0x47')](handleError(_0x290f97,null));};exports[_0x0260('0x55')]=function(_0x2b49ac,_0x58ce18,_0x28dfb3){var _0x4fe460;return db[_0x0260('0x2f')][_0x0260('0x4a')]({'where':{'id':_0x2b49ac[_0x0260('0x48')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x58ce18,null))[_0x0260('0x26')](function(_0xfe9f0d){if(_0xfe9f0d){var _0x39e3cd=require(_0x0260('0x56'))();_0x39e3cd[_0x0260('0x57')](_0xfe9f0d[_0x0260('0x58')]);_0x39e3cd[_0x0260('0x59')]();return _0xfe9f0d;}})['then'](respondWithResult(_0x58ce18,null))[_0x0260('0x47')](handleError(_0x58ce18,null));};
\ No newline at end of file