Built motion from commit a61a4a20.|2.5.46
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index 4b62399..ef10ae8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf323=['sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','SquareOdbc','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','body','user','role','UserProfileSection','userProfileId','autoAssociation','dsn','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x576170,_0x3ed831){var _0x487d98=function(_0x1674a3){while(--_0x1674a3){_0x576170['push'](_0x576170['shift']());}};_0x487d98(++_0x3ed831);}(_0xf323,0x9f));var _0x3f32=function(_0x5d50b2,_0x34cc1b){_0x5d50b2=_0x5d50b2-0x0;var _0x40c9ba=_0xf323[_0x5d50b2];return _0x40c9ba;};'use strict';var pdf=require(_0x3f32('0x0'));var emlformat=require(_0x3f32('0x1'));var rimraf=require(_0x3f32('0x2'));var zipdir=require(_0x3f32('0x3'));var jsonpatch=require(_0x3f32('0x4'));var rp=require(_0x3f32('0x5'));var moment=require(_0x3f32('0x6'));var BPromise=require(_0x3f32('0x7'));var Mustache=require(_0x3f32('0x8'));var util=require(_0x3f32('0x9'));var path=require(_0x3f32('0xa'));var sox=require(_0x3f32('0xb'));var csv=require(_0x3f32('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3f32('0xd'));var squel=require(_0x3f32('0xe'));var crypto=require(_0x3f32('0xf'));var jsforce=require(_0x3f32('0x10'));var deskjs=require(_0x3f32('0x11'));var toCsv=require(_0x3f32('0xc'));var querystring=require(_0x3f32('0x12'));var Papa=require('papaparse');var Redis=require(_0x3f32('0x13'));var authService=require(_0x3f32('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3f32('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f32('0x16'))(_0x3f32('0x17'));var utils=require(_0x3f32('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3f32('0x19'));var db=require(_0x3f32('0x1a'))['db'];function respondWithStatusCode(_0x16e2cd,_0x109ad2){_0x109ad2=_0x109ad2||0xcc;return function(_0x28ea0b){if(_0x28ea0b){return _0x16e2cd['sendStatus'](_0x109ad2);}return _0x16e2cd[_0x3f32('0x1b')](_0x109ad2)['end']();};}function respondWithResult(_0x10e99c,_0x1e796b){_0x1e796b=_0x1e796b||0xc8;return function(_0x2cff1f){if(_0x2cff1f){return _0x10e99c[_0x3f32('0x1b')](_0x1e796b)[_0x3f32('0x1c')](_0x2cff1f);}};}function respondWithFilteredResult(_0x414c63,_0x4915af){return function(_0x6768c){if(_0x6768c){var _0x3446fa=_0x6768c[_0x3f32('0x1d')],_0x3ca6d0=_0x4915af[_0x3f32('0x1e')],_0x35b196=_0x4915af[_0x3f32('0x1e')]+_0x4915af[_0x3f32('0x1f')],_0x385103;if(_0x35b196>=_0x3446fa){_0x35b196=_0x3446fa;_0x385103=0xc8;}else{_0x385103=0xce;}_0x414c63['status'](_0x385103);return _0x414c63[_0x3f32('0x20')](_0x3f32('0x21'),_0x3ca6d0+'-'+_0x35b196+'/'+_0x3446fa)['json'](_0x6768c);}return null;};}function patchUpdates(_0x3948fe){return function(_0x5003fa){try{jsonpatch[_0x3f32('0x22')](_0x5003fa,_0x3948fe,!![]);}catch(_0x4d87f3){return BPromise[_0x3f32('0x23')](_0x4d87f3);}return _0x5003fa[_0x3f32('0x24')]();};}function saveUpdates(_0x45c69f,_0x1ccef8){return function(_0x2c4184){if(_0x2c4184){return _0x2c4184[_0x3f32('0x25')](_0x45c69f)[_0x3f32('0x26')](function(_0x60a149){return _0x60a149;});}return null;};}function removeEntity(_0x24bfc2,_0x526b27){return function(_0x27ad75){if(_0x27ad75){return _0x27ad75['destroy']()[_0x3f32('0x26')](function(){var _0x3a7f23=_0x27ad75[_0x3f32('0x27')]({'plain':!![]});var _0x4b263='ODBC';return db[_0x3f32('0x28')]['destroy']({'where':{'type':_0x4b263,'resourceId':_0x3a7f23['id']}})[_0x3f32('0x26')](function(){return _0x27ad75;});})['then'](function(){_0x24bfc2[_0x3f32('0x1b')](0xcc)[_0x3f32('0x29')]();});}};}function handleEntityNotFound(_0x253a43,_0x23c035){return function(_0x3da563){if(!_0x3da563){_0x253a43[_0x3f32('0x2a')](0x194);}return _0x3da563;};}function handleError(_0x348717,_0x45acb3){_0x45acb3=_0x45acb3||0x1f4;return function(_0x5bcc2a){logger[_0x3f32('0x2b')](_0x5bcc2a[_0x3f32('0x2c')]);if(_0x5bcc2a[_0x3f32('0x2d')]){delete _0x5bcc2a[_0x3f32('0x2d')];}_0x348717[_0x3f32('0x1b')](_0x45acb3)[_0x3f32('0x2e')](_0x5bcc2a);};}exports[_0x3f32('0x2f')]=function(_0x488375,_0xaf1be9){var _0xb88888={},_0xd401a1={},_0x59b11b={'count':0x0,'rows':[]};var _0x6721df=_['map'](db[_0x3f32('0x30')]['rawAttributes'],function(_0x128a77){return{'name':_0x128a77[_0x3f32('0x31')],'type':_0x128a77[_0x3f32('0x32')]['key']};});_0xd401a1[_0x3f32('0x33')]=_['map'](_0x6721df,_0x3f32('0x2d'));_0xd401a1[_0x3f32('0x34')]=_[_0x3f32('0x35')](_0x488375[_0x3f32('0x34')]);_0xd401a1[_0x3f32('0x36')]=_['intersection'](_0xd401a1[_0x3f32('0x33')],_0xd401a1['query']);_0xb88888[_0x3f32('0x37')]=_[_0x3f32('0x38')](_0xd401a1[_0x3f32('0x33')],qs[_0x3f32('0x39')](_0x488375['query'][_0x3f32('0x39')]));_0xb88888[_0x3f32('0x37')]=_0xb88888[_0x3f32('0x37')]['length']?_0xb88888['attributes']:_0xd401a1[_0x3f32('0x33')];if(!_0x488375[_0x3f32('0x34')][_0x3f32('0x3a')]('nolimit')){_0xb88888[_0x3f32('0x1f')]=qs[_0x3f32('0x1f')](_0x488375[_0x3f32('0x34')][_0x3f32('0x1f')]);_0xb88888[_0x3f32('0x1e')]=qs[_0x3f32('0x1e')](_0x488375[_0x3f32('0x34')][_0x3f32('0x1e')]);}_0xb88888[_0x3f32('0x3b')]=qs[_0x3f32('0x3c')](_0x488375[_0x3f32('0x34')][_0x3f32('0x3c')]);_0xb88888[_0x3f32('0x3d')]=qs[_0x3f32('0x36')](_['pick'](_0x488375['query'],_0xd401a1[_0x3f32('0x36')]),_0x6721df);if(_0x488375[_0x3f32('0x34')]['filter']){_0xb88888[_0x3f32('0x3d')]=_['merge'](_0xb88888[_0x3f32('0x3d')],{'$or':_['map'](_0x6721df,function(_0x4eb083){if(_0x4eb083[_0x3f32('0x32')]!==_0x3f32('0x3e')){var _0xd9622a={};_0xd9622a[_0x4eb083['name']]={'$like':'%'+_0x488375[_0x3f32('0x34')][_0x3f32('0x3f')]+'%'};return _0xd9622a;}})});}_0xb88888=_[_0x3f32('0x40')]({},_0xb88888,_0x488375[_0x3f32('0x41')]);var _0x2429be={'where':_0xb88888[_0x3f32('0x3d')]};return db[_0x3f32('0x30')][_0x3f32('0x1d')](_0x2429be)['then'](function(_0x28aa6c){_0x59b11b['count']=_0x28aa6c;if(_0x488375[_0x3f32('0x34')][_0x3f32('0x42')]){_0xb88888[_0x3f32('0x43')]=[{'all':!![]}];}return db['SquareOdbc'][_0x3f32('0x44')](_0xb88888);})[_0x3f32('0x26')](function(_0x2e7ac6){_0x59b11b[_0x3f32('0x45')]=_0x2e7ac6;return _0x59b11b;})['then'](respondWithFilteredResult(_0xaf1be9,_0xb88888))[_0x3f32('0x46')](handleError(_0xaf1be9,null));};exports[_0x3f32('0x47')]=function(_0x3c1165,_0x57cf32){var _0x28a7b1={'raw':!![],'where':{'id':_0x3c1165[_0x3f32('0x48')]['id']}},_0x5c4592={};_0x5c4592[_0x3f32('0x33')]=_['keys'](db[_0x3f32('0x30')][_0x3f32('0x49')]);_0x5c4592[_0x3f32('0x34')]=_[_0x3f32('0x35')](_0x3c1165['query']);_0x5c4592[_0x3f32('0x36')]=_[_0x3f32('0x38')](_0x5c4592['model'],_0x5c4592['query']);_0x28a7b1['attributes']=_['intersection'](_0x5c4592['model'],qs['fields'](_0x3c1165[_0x3f32('0x34')][_0x3f32('0x39')]));_0x28a7b1[_0x3f32('0x37')]=_0x28a7b1['attributes'][_0x3f32('0x4a')]?_0x28a7b1['attributes']:_0x5c4592[_0x3f32('0x33')];if(_0x3c1165['query']['includeAll']){_0x28a7b1['include']=[{'all':!![]}];}_0x28a7b1=_[_0x3f32('0x40')]({},_0x28a7b1,_0x3c1165['options']);return db['SquareOdbc'][_0x3f32('0x4b')](_0x28a7b1)[_0x3f32('0x26')](handleEntityNotFound(_0x57cf32,null))['then'](respondWithResult(_0x57cf32,null))['catch'](handleError(_0x57cf32,null));};exports['create']=function(_0x1b5a08,_0x4bda1b){return db['SquareOdbc']['create'](_0x1b5a08[_0x3f32('0x4c')],{})[_0x3f32('0x26')](function(_0x528dfe){var _0x2a5cbe=_0x1b5a08[_0x3f32('0x4d')][_0x3f32('0x27')]({'plain':!![]});if(!_0x2a5cbe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a5cbe[_0x3f32('0x4e')]===_0x3f32('0x4d')){var _0x700087=_0x528dfe[_0x3f32('0x27')]({'plain':!![]});var _0x513287='ODBC';return db[_0x3f32('0x4f')][_0x3f32('0x4b')]({'where':{'name':_0x513287,'userProfileId':_0x2a5cbe[_0x3f32('0x50')]},'raw':!![]})[_0x3f32('0x26')](function(_0x9be0a8){if(_0x9be0a8&&_0x9be0a8[_0x3f32('0x51')]===0x0){return db[_0x3f32('0x28')]['create']({'name':_0x700087['name'],'resourceId':_0x700087['id'],'type':_0x9be0a8['name'],'sectionId':_0x9be0a8['id']},{})[_0x3f32('0x26')](function(){return _0x528dfe;});}else{return _0x528dfe;}})[_0x3f32('0x46')](function(_0x5511ba){logger[_0x3f32('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5511ba);throw _0x5511ba;});}return _0x528dfe;})[_0x3f32('0x26')](respondWithResult(_0x4bda1b,0xc9))[_0x3f32('0x46')](handleError(_0x4bda1b,null));};exports['update']=function(_0x51239f,_0x140561){if(_0x51239f[_0x3f32('0x4c')]['id']){delete _0x51239f['body']['id'];}return db[_0x3f32('0x30')][_0x3f32('0x4b')]({'where':{'id':_0x51239f[_0x3f32('0x48')]['id']}})['then'](handleEntityNotFound(_0x140561,null))[_0x3f32('0x26')](saveUpdates(_0x51239f[_0x3f32('0x4c')],null))[_0x3f32('0x26')](respondWithResult(_0x140561,null))[_0x3f32('0x46')](handleError(_0x140561,null));};exports['destroy']=function(_0x3ee20a,_0x4a52a0){return db[_0x3f32('0x30')][_0x3f32('0x4b')]({'where':{'id':_0x3ee20a[_0x3f32('0x48')]['id']}})[_0x3f32('0x26')](handleEntityNotFound(_0x4a52a0,null))['then'](removeEntity(_0x4a52a0,null))[_0x3f32('0x46')](handleError(_0x4a52a0,null));};exports['test']=function(_0x4d9d5f,_0x31d6fa,_0x5216f9){var _0x15b730;return db[_0x3f32('0x30')][_0x3f32('0x4b')]({'where':{'id':_0x4d9d5f[_0x3f32('0x48')]['id']},'attributes':['id',_0x3f32('0x52')]})['then'](handleEntityNotFound(_0x31d6fa,null))[_0x3f32('0x26')](function(_0x3e3544){if(_0x3e3544){var _0x51e8ab=require('odbc')();_0x51e8ab[_0x3f32('0x53')](_0x3e3544[_0x3f32('0x52')]);_0x51e8ab[_0x3f32('0x54')]();return _0x3e3544;}})['then'](respondWithResult(_0x31d6fa,null))[_0x3f32('0x46')](handleError(_0x31d6fa,null));};
\ No newline at end of file
+var _0x6043=['ODBC','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get'];(function(_0x509fdb,_0x2230ae){var _0xf0af2d=function(_0x444a5c){while(--_0x444a5c){_0x509fdb['push'](_0x509fdb['shift']());}};_0xf0af2d(++_0x2230ae);}(_0x6043,0x136));var _0x3604=function(_0x32986,_0x4489c8){_0x32986=_0x32986-0x0;var _0x355ebb=_0x6043[_0x32986];return _0x355ebb;};'use strict';var emlformat=require(_0x3604('0x0'));var rimraf=require(_0x3604('0x1'));var zipdir=require(_0x3604('0x2'));var jsonpatch=require(_0x3604('0x3'));var rp=require(_0x3604('0x4'));var moment=require(_0x3604('0x5'));var BPromise=require(_0x3604('0x6'));var Mustache=require(_0x3604('0x7'));var util=require(_0x3604('0x8'));var path=require('path');var sox=require(_0x3604('0x9'));var csv=require(_0x3604('0xa'));var ejs=require(_0x3604('0xb'));var fs=require('fs');var fs_extra=require(_0x3604('0xc'));var _=require(_0x3604('0xd'));var squel=require(_0x3604('0xe'));var crypto=require(_0x3604('0xf'));var jsforce=require(_0x3604('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x3604('0xa'));var querystring=require(_0x3604('0x11'));var Papa=require(_0x3604('0x12'));var Redis=require('ioredis');var authService=require(_0x3604('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3604('0x14'));var hardwareService=require(_0x3604('0x15'));var logger=require('../../config/logger')(_0x3604('0x16'));var utils=require(_0x3604('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3604('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4461cf,_0x5da40b){_0x5da40b=_0x5da40b||0xcc;return function(_0x4a51aa){if(_0x4a51aa){return _0x4461cf[_0x3604('0x19')](_0x5da40b);}return _0x4461cf[_0x3604('0x1a')](_0x5da40b)[_0x3604('0x1b')]();};}function respondWithResult(_0x24a4b6,_0x5618a3){_0x5618a3=_0x5618a3||0xc8;return function(_0x157862){if(_0x157862){return _0x24a4b6[_0x3604('0x1a')](_0x5618a3)['json'](_0x157862);}};}function respondWithFilteredResult(_0x4d18b8,_0x1a8db2){return function(_0x1200b5){if(_0x1200b5){var _0x143e7c=typeof _0x1a8db2[_0x3604('0x1c')]===_0x3604('0x1d')&&typeof _0x1a8db2['limit']===_0x3604('0x1d');var _0x5a85f8=_0x1200b5[_0x3604('0x1e')];var _0x2f5e4d=_0x143e7c?0x0:_0x1a8db2[_0x3604('0x1c')];var _0x3ee8cc=_0x143e7c?_0x1200b5[_0x3604('0x1e')]:_0x1a8db2['offset']+_0x1a8db2[_0x3604('0x1f')];var _0x23aefb;if(_0x3ee8cc>=_0x5a85f8){_0x3ee8cc=_0x5a85f8;_0x23aefb=0xc8;}else{_0x23aefb=0xce;}_0x4d18b8[_0x3604('0x1a')](_0x23aefb);return _0x4d18b8[_0x3604('0x20')](_0x3604('0x21'),_0x2f5e4d+'-'+_0x3ee8cc+'/'+_0x5a85f8)[_0x3604('0x22')](_0x1200b5);}return null;};}function patchUpdates(_0x4eb6e1){return function(_0x5ca30f){try{jsonpatch[_0x3604('0x23')](_0x5ca30f,_0x4eb6e1,!![]);}catch(_0x3ec019){return BPromise[_0x3604('0x24')](_0x3ec019);}return _0x5ca30f[_0x3604('0x25')]();};}function saveUpdates(_0x47dc19,_0x1d82ce){return function(_0xeb1606){if(_0xeb1606){return _0xeb1606[_0x3604('0x26')](_0x47dc19)[_0x3604('0x27')](function(_0x590deb){return _0x590deb;});}return null;};}function removeEntity(_0x2f0d52,_0x307039){return function(_0x381717){if(_0x381717){return _0x381717[_0x3604('0x28')]()[_0x3604('0x27')](function(){var _0x5dc9a8=_0x381717[_0x3604('0x29')]({'plain':!![]});var _0x469852=_0x3604('0x2a');return db['UserProfileResource'][_0x3604('0x28')]({'where':{'type':_0x469852,'resourceId':_0x5dc9a8['id']}})[_0x3604('0x27')](function(){return _0x381717;});})[_0x3604('0x27')](function(){_0x2f0d52['status'](0xcc)[_0x3604('0x1b')]();});}};}function handleEntityNotFound(_0x1f6a1d,_0x2cd8b6){return function(_0x3bff32){if(!_0x3bff32){_0x1f6a1d['sendStatus'](0x194);}return _0x3bff32;};}function handleError(_0x30923b,_0x420870){_0x420870=_0x420870||0x1f4;return function(_0x425215){logger['error'](_0x425215[_0x3604('0x2b')]);if(_0x425215[_0x3604('0x2c')]){delete _0x425215[_0x3604('0x2c')];}_0x30923b[_0x3604('0x1a')](_0x420870)[_0x3604('0x2d')](_0x425215);};}exports[_0x3604('0x2e')]=function(_0x337db8,_0x20d8d1){var _0x111d99={},_0x20fa66={},_0x5e8acd={'count':0x0,'rows':[]};var _0x298aa8=_[_0x3604('0x2f')](db[_0x3604('0x30')][_0x3604('0x31')],function(_0x1f5bf7){return{'name':_0x1f5bf7[_0x3604('0x32')],'type':_0x1f5bf7['type']['key']};});_0x20fa66[_0x3604('0x33')]=_[_0x3604('0x2f')](_0x298aa8,_0x3604('0x2c'));_0x20fa66['query']=_[_0x3604('0x34')](_0x337db8[_0x3604('0x35')]);_0x20fa66[_0x3604('0x36')]=_[_0x3604('0x37')](_0x20fa66[_0x3604('0x33')],_0x20fa66['query']);_0x111d99['attributes']=_[_0x3604('0x37')](_0x20fa66[_0x3604('0x33')],qs[_0x3604('0x38')](_0x337db8['query'][_0x3604('0x38')]));_0x111d99['attributes']=_0x111d99[_0x3604('0x39')][_0x3604('0x3a')]?_0x111d99[_0x3604('0x39')]:_0x20fa66[_0x3604('0x33')];if(!_0x337db8[_0x3604('0x35')][_0x3604('0x3b')](_0x3604('0x3c'))){_0x111d99[_0x3604('0x1f')]=qs[_0x3604('0x1f')](_0x337db8['query'][_0x3604('0x1f')]);_0x111d99['offset']=qs[_0x3604('0x1c')](_0x337db8[_0x3604('0x35')][_0x3604('0x1c')]);}_0x111d99[_0x3604('0x3d')]=qs[_0x3604('0x3e')](_0x337db8[_0x3604('0x35')]['sort']);_0x111d99[_0x3604('0x3f')]=qs['filters'](_[_0x3604('0x40')](_0x337db8[_0x3604('0x35')],_0x20fa66['filters']),_0x298aa8);if(_0x337db8['query'][_0x3604('0x41')]){_0x111d99[_0x3604('0x3f')]=_[_0x3604('0x42')](_0x111d99[_0x3604('0x3f')],{'$or':_['map'](_0x298aa8,function(_0x763fcf){if(_0x763fcf[_0x3604('0x43')]!==_0x3604('0x44')){var _0x21d0d9={};_0x21d0d9[_0x763fcf[_0x3604('0x2c')]]={'$like':'%'+_0x337db8[_0x3604('0x35')][_0x3604('0x41')]+'%'};return _0x21d0d9;}})});}_0x111d99=_[_0x3604('0x42')]({},_0x111d99,_0x337db8[_0x3604('0x45')]);var _0x1893e4={'where':_0x111d99[_0x3604('0x3f')]};return db[_0x3604('0x30')][_0x3604('0x1e')](_0x1893e4)[_0x3604('0x27')](function(_0x3244fa){_0x5e8acd[_0x3604('0x1e')]=_0x3244fa;if(_0x337db8[_0x3604('0x35')][_0x3604('0x46')]){_0x111d99[_0x3604('0x47')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x111d99);})[_0x3604('0x27')](function(_0x171ca9){_0x5e8acd[_0x3604('0x48')]=_0x171ca9;return _0x5e8acd;})[_0x3604('0x27')](respondWithFilteredResult(_0x20d8d1,_0x111d99))[_0x3604('0x49')](handleError(_0x20d8d1,null));};exports[_0x3604('0x4a')]=function(_0x2bb460,_0x3105ac){var _0x1606d7={'raw':!![],'where':{'id':_0x2bb460[_0x3604('0x4b')]['id']}},_0x2fc29a={};_0x2fc29a[_0x3604('0x33')]=_[_0x3604('0x34')](db[_0x3604('0x30')]['rawAttributes']);_0x2fc29a[_0x3604('0x35')]=_['keys'](_0x2bb460[_0x3604('0x35')]);_0x2fc29a[_0x3604('0x36')]=_['intersection'](_0x2fc29a[_0x3604('0x33')],_0x2fc29a[_0x3604('0x35')]);_0x1606d7[_0x3604('0x39')]=_[_0x3604('0x37')](_0x2fc29a[_0x3604('0x33')],qs[_0x3604('0x38')](_0x2bb460[_0x3604('0x35')][_0x3604('0x38')]));_0x1606d7[_0x3604('0x39')]=_0x1606d7[_0x3604('0x39')][_0x3604('0x3a')]?_0x1606d7[_0x3604('0x39')]:_0x2fc29a['model'];if(_0x2bb460[_0x3604('0x35')][_0x3604('0x46')]){_0x1606d7['include']=[{'all':!![]}];}_0x1606d7=_[_0x3604('0x42')]({},_0x1606d7,_0x2bb460[_0x3604('0x45')]);return db[_0x3604('0x30')]['find'](_0x1606d7)[_0x3604('0x27')](handleEntityNotFound(_0x3105ac,null))[_0x3604('0x27')](respondWithResult(_0x3105ac,null))['catch'](handleError(_0x3105ac,null));};exports[_0x3604('0x4c')]=function(_0x41ccf4,_0x500f73){return db[_0x3604('0x30')][_0x3604('0x4c')](_0x41ccf4['body'],{})['then'](function(_0x388e70){var _0x3f1684=_0x41ccf4[_0x3604('0x4d')][_0x3604('0x29')]({'plain':!![]});if(!_0x3f1684)throw new Error(_0x3604('0x4e'));if(_0x3f1684[_0x3604('0x4f')]===_0x3604('0x4d')){var _0x13247d=_0x388e70['get']({'plain':!![]});var _0x53eea0=_0x3604('0x2a');return db[_0x3604('0x50')][_0x3604('0x51')]({'where':{'name':_0x53eea0,'userProfileId':_0x3f1684['userProfileId']},'raw':!![]})['then'](function(_0x5413d0){if(_0x5413d0&&_0x5413d0[_0x3604('0x52')]===0x0){return db['UserProfileResource'][_0x3604('0x4c')]({'name':_0x13247d[_0x3604('0x2c')],'resourceId':_0x13247d['id'],'type':_0x5413d0[_0x3604('0x2c')],'sectionId':_0x5413d0['id']},{})['then'](function(){return _0x388e70;});}else{return _0x388e70;}})[_0x3604('0x49')](function(_0x30a692){logger['error'](_0x3604('0x53'),_0x30a692);throw _0x30a692;});}return _0x388e70;})['then'](respondWithResult(_0x500f73,0xc9))[_0x3604('0x49')](handleError(_0x500f73,null));};exports[_0x3604('0x26')]=function(_0x1fcc3e,_0x3e6859){if(_0x1fcc3e['body']['id']){delete _0x1fcc3e[_0x3604('0x54')]['id'];}return db[_0x3604('0x30')]['find']({'where':{'id':_0x1fcc3e[_0x3604('0x4b')]['id']}})[_0x3604('0x27')](handleEntityNotFound(_0x3e6859,null))['then'](saveUpdates(_0x1fcc3e['body'],null))['then'](respondWithResult(_0x3e6859,null))['catch'](handleError(_0x3e6859,null));};exports[_0x3604('0x28')]=function(_0x516fd7,_0x32d7c1){return db[_0x3604('0x30')][_0x3604('0x51')]({'where':{'id':_0x516fd7[_0x3604('0x4b')]['id']}})[_0x3604('0x27')](handleEntityNotFound(_0x32d7c1,null))[_0x3604('0x27')](removeEntity(_0x32d7c1,null))[_0x3604('0x49')](handleError(_0x32d7c1,null));};exports[_0x3604('0x55')]=function(_0x308fc1,_0x5b5584,_0xb0511d){var _0x36da52;return db[_0x3604('0x30')][_0x3604('0x51')]({'where':{'id':_0x308fc1['params']['id']},'attributes':['id',_0x3604('0x56')]})[_0x3604('0x27')](handleEntityNotFound(_0x5b5584,null))[_0x3604('0x27')](function(_0x501e33){if(_0x501e33){var _0x146938=require(_0x3604('0x57'))();_0x146938['openSync'](_0x501e33[_0x3604('0x56')]);_0x146938['closeSync']();return _0x501e33;}})[_0x3604('0x27')](respondWithResult(_0x5b5584,null))['catch'](handleError(_0x5b5584,null));};
\ No newline at end of file