Built motion from commit a61a4a20.|2.5.46
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index ec5bf27..ef10ae8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x61f0=['Content-Range','apply','reject','save','update','destroy','then','get','ODBC','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x61f0,0x19b));var _0x061f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x61f0[_0x3b380d];return _0x54502b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x061f('0x0'));var rimraf=require(_0x061f('0x1'));var zipdir=require(_0x061f('0x2'));var jsonpatch=require(_0x061f('0x3'));var rp=require(_0x061f('0x4'));var moment=require(_0x061f('0x5'));var BPromise=require(_0x061f('0x6'));var Mustache=require('mustache');var util=require(_0x061f('0x7'));var path=require(_0x061f('0x8'));var sox=require(_0x061f('0x9'));var csv=require(_0x061f('0xa'));var ejs=require(_0x061f('0xb'));var fs=require('fs');var _=require(_0x061f('0xc'));var squel=require(_0x061f('0xd'));var crypto=require(_0x061f('0xe'));var jsforce=require(_0x061f('0xf'));var deskjs=require(_0x061f('0x10'));var toCsv=require(_0x061f('0xa'));var querystring=require(_0x061f('0x11'));var Papa=require('papaparse');var Redis=require(_0x061f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x061f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x061f('0x14'));var logger=require(_0x061f('0x15'))(_0x061f('0x16'));var utils=require(_0x061f('0x17'));var config=require('../../config/environment');var db=require(_0x061f('0x18'))['db'];function respondWithStatusCode(_0x5ab34e,_0x521922){_0x521922=_0x521922||0xcc;return function(_0x26cf9b){if(_0x26cf9b){return _0x5ab34e['sendStatus'](_0x521922);}return _0x5ab34e[_0x061f('0x19')](_0x521922)[_0x061f('0x1a')]();};}function respondWithResult(_0x43db6b,_0x53fd03){_0x53fd03=_0x53fd03||0xc8;return function(_0x57ab57){if(_0x57ab57){return _0x43db6b['status'](_0x53fd03)[_0x061f('0x1b')](_0x57ab57);}};}function respondWithFilteredResult(_0x36174a,_0x1dc669){return function(_0x56a385){if(_0x56a385){var _0x2c60f6=_0x56a385['count'],_0x1876d7=_0x1dc669[_0x061f('0x1c')],_0x9beb26=_0x1dc669[_0x061f('0x1c')]+_0x1dc669['limit'],_0x49d7cb;if(_0x9beb26>=_0x2c60f6){_0x9beb26=_0x2c60f6;_0x49d7cb=0xc8;}else{_0x49d7cb=0xce;}_0x36174a[_0x061f('0x19')](_0x49d7cb);return _0x36174a['set'](_0x061f('0x1d'),_0x1876d7+'-'+_0x9beb26+'/'+_0x2c60f6)[_0x061f('0x1b')](_0x56a385);}return null;};}function patchUpdates(_0x76bfa0){return function(_0x5e9e41){try{jsonpatch[_0x061f('0x1e')](_0x5e9e41,_0x76bfa0,!![]);}catch(_0x5a2b09){return BPromise[_0x061f('0x1f')](_0x5a2b09);}return _0x5e9e41[_0x061f('0x20')]();};}function saveUpdates(_0x1e81ac,_0x1bb63f){return function(_0x416534){if(_0x416534){return _0x416534[_0x061f('0x21')](_0x1e81ac)['then'](function(_0x49cae3){return _0x49cae3;});}return null;};}function removeEntity(_0x470559,_0x171cd7){return function(_0x1c3190){if(_0x1c3190){return _0x1c3190[_0x061f('0x22')]()[_0x061f('0x23')](function(){var _0x1d9fba=_0x1c3190[_0x061f('0x24')]({'plain':!![]});var _0x7865cf=_0x061f('0x25');return db[_0x061f('0x26')][_0x061f('0x22')]({'where':{'type':_0x7865cf,'resourceId':_0x1d9fba['id']}})[_0x061f('0x23')](function(){return _0x1c3190;});})['then'](function(){_0x470559[_0x061f('0x19')](0xcc)[_0x061f('0x1a')]();});}};}function handleEntityNotFound(_0x305d61,_0x54e426){return function(_0x4ae9b5){if(!_0x4ae9b5){_0x305d61['sendStatus'](0x194);}return _0x4ae9b5;};}function handleError(_0x13ad55,_0x185367){_0x185367=_0x185367||0x1f4;return function(_0x436ead){logger[_0x061f('0x27')](_0x436ead[_0x061f('0x28')]);if(_0x436ead[_0x061f('0x29')]){delete _0x436ead[_0x061f('0x29')];}_0x13ad55[_0x061f('0x19')](_0x185367)[_0x061f('0x2a')](_0x436ead);};}exports[_0x061f('0x2b')]=function(_0x13b9d5,_0x36a889){var _0x1b25b2={},_0x29e6a7={},_0x3b3a82={'count':0x0,'rows':[]};var _0xa926d4=_[_0x061f('0x2c')](db[_0x061f('0x2d')][_0x061f('0x2e')],function(_0x509078){return{'name':_0x509078[_0x061f('0x2f')],'type':_0x509078[_0x061f('0x30')][_0x061f('0x31')]};});_0x29e6a7[_0x061f('0x32')]=_[_0x061f('0x2c')](_0xa926d4,_0x061f('0x29'));_0x29e6a7[_0x061f('0x33')]=_[_0x061f('0x34')](_0x13b9d5[_0x061f('0x33')]);_0x29e6a7[_0x061f('0x35')]=_[_0x061f('0x36')](_0x29e6a7[_0x061f('0x32')],_0x29e6a7[_0x061f('0x33')]);_0x1b25b2[_0x061f('0x37')]=_['intersection'](_0x29e6a7[_0x061f('0x32')],qs[_0x061f('0x38')](_0x13b9d5[_0x061f('0x33')][_0x061f('0x38')]));_0x1b25b2[_0x061f('0x37')]=_0x1b25b2[_0x061f('0x37')][_0x061f('0x39')]?_0x1b25b2[_0x061f('0x37')]:_0x29e6a7[_0x061f('0x32')];if(!_0x13b9d5[_0x061f('0x33')][_0x061f('0x3a')](_0x061f('0x3b'))){_0x1b25b2['limit']=qs['limit'](_0x13b9d5[_0x061f('0x33')][_0x061f('0x3c')]);_0x1b25b2[_0x061f('0x1c')]=qs['offset'](_0x13b9d5['query'][_0x061f('0x1c')]);}_0x1b25b2['order']=qs[_0x061f('0x3d')](_0x13b9d5[_0x061f('0x33')]['sort']);_0x1b25b2[_0x061f('0x3e')]=qs[_0x061f('0x35')](_['pick'](_0x13b9d5[_0x061f('0x33')],_0x29e6a7['filters']),_0xa926d4);if(_0x13b9d5['query'][_0x061f('0x3f')]){_0x1b25b2[_0x061f('0x3e')]=_[_0x061f('0x40')](_0x1b25b2['where'],{'$or':_[_0x061f('0x2c')](_0xa926d4,function(_0x569eac){if(_0x569eac[_0x061f('0x30')]!==_0x061f('0x41')){var _0x56d7d9={};_0x56d7d9[_0x569eac[_0x061f('0x29')]]={'$like':'%'+_0x13b9d5[_0x061f('0x33')]['filter']+'%'};return _0x56d7d9;}})});}_0x1b25b2=_[_0x061f('0x40')]({},_0x1b25b2,_0x13b9d5[_0x061f('0x42')]);var _0x37669e={'where':_0x1b25b2[_0x061f('0x3e')]};return db['SquareOdbc'][_0x061f('0x43')](_0x37669e)['then'](function(_0x1c0aab){_0x3b3a82[_0x061f('0x43')]=_0x1c0aab;if(_0x13b9d5['query'][_0x061f('0x44')]){_0x1b25b2[_0x061f('0x45')]=[{'all':!![]}];}return db[_0x061f('0x2d')][_0x061f('0x46')](_0x1b25b2);})[_0x061f('0x23')](function(_0x564b0a){_0x3b3a82[_0x061f('0x47')]=_0x564b0a;return _0x3b3a82;})[_0x061f('0x23')](respondWithFilteredResult(_0x36a889,_0x1b25b2))[_0x061f('0x48')](handleError(_0x36a889,null));};exports[_0x061f('0x49')]=function(_0x3197db,_0x408856){var _0x289fae={'raw':!![],'where':{'id':_0x3197db[_0x061f('0x4a')]['id']}},_0x3ad718={};_0x3ad718[_0x061f('0x32')]=_[_0x061f('0x34')](db[_0x061f('0x2d')][_0x061f('0x2e')]);_0x3ad718[_0x061f('0x33')]=_['keys'](_0x3197db[_0x061f('0x33')]);_0x3ad718['filters']=_[_0x061f('0x36')](_0x3ad718[_0x061f('0x32')],_0x3ad718['query']);_0x289fae[_0x061f('0x37')]=_[_0x061f('0x36')](_0x3ad718[_0x061f('0x32')],qs['fields'](_0x3197db['query']['fields']));_0x289fae[_0x061f('0x37')]=_0x289fae[_0x061f('0x37')][_0x061f('0x39')]?_0x289fae['attributes']:_0x3ad718['model'];if(_0x3197db[_0x061f('0x33')][_0x061f('0x44')]){_0x289fae[_0x061f('0x45')]=[{'all':!![]}];}_0x289fae=_[_0x061f('0x40')]({},_0x289fae,_0x3197db[_0x061f('0x42')]);return db[_0x061f('0x2d')][_0x061f('0x4b')](_0x289fae)['then'](handleEntityNotFound(_0x408856,null))[_0x061f('0x23')](respondWithResult(_0x408856,null))['catch'](handleError(_0x408856,null));};exports[_0x061f('0x4c')]=function(_0x488871,_0x1615f9){return db[_0x061f('0x2d')][_0x061f('0x4c')](_0x488871[_0x061f('0x4d')],{})[_0x061f('0x23')](function(_0x260c50){var _0x15ac6d=_0x488871[_0x061f('0x4e')]['get']({'plain':!![]});if(!_0x15ac6d)throw new Error(_0x061f('0x4f'));if(_0x15ac6d[_0x061f('0x50')]==='user'){var _0x31457f=_0x260c50[_0x061f('0x24')]({'plain':!![]});var _0xf0653a=_0x061f('0x25');return db[_0x061f('0x51')][_0x061f('0x4b')]({'where':{'name':_0xf0653a,'userProfileId':_0x15ac6d[_0x061f('0x52')]},'raw':!![]})['then'](function(_0x5593f5){if(_0x5593f5&&_0x5593f5['autoAssociation']===0x0){return db[_0x061f('0x26')][_0x061f('0x4c')]({'name':_0x31457f[_0x061f('0x29')],'resourceId':_0x31457f['id'],'type':_0x5593f5['name'],'sectionId':_0x5593f5['id']},{})[_0x061f('0x23')](function(){return _0x260c50;});}else{return _0x260c50;}})['catch'](function(_0x38c967){logger[_0x061f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38c967);throw _0x38c967;});}return _0x260c50;})[_0x061f('0x23')](respondWithResult(_0x1615f9,0xc9))[_0x061f('0x48')](handleError(_0x1615f9,null));};exports[_0x061f('0x21')]=function(_0x3c2f92,_0x37937a){if(_0x3c2f92[_0x061f('0x4d')]['id']){delete _0x3c2f92[_0x061f('0x4d')]['id'];}return db['SquareOdbc'][_0x061f('0x4b')]({'where':{'id':_0x3c2f92[_0x061f('0x4a')]['id']}})[_0x061f('0x23')](handleEntityNotFound(_0x37937a,null))[_0x061f('0x23')](saveUpdates(_0x3c2f92['body'],null))['then'](respondWithResult(_0x37937a,null))['catch'](handleError(_0x37937a,null));};exports['destroy']=function(_0x4297a8,_0x109dd2){return db['SquareOdbc'][_0x061f('0x4b')]({'where':{'id':_0x4297a8[_0x061f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x109dd2,null))['then'](removeEntity(_0x109dd2,null))[_0x061f('0x48')](handleError(_0x109dd2,null));};exports[_0x061f('0x53')]=function(_0x2c4f0d,_0x54f91e,_0x562155){var _0xa11a5e;return db[_0x061f('0x2d')][_0x061f('0x4b')]({'where':{'id':_0x2c4f0d[_0x061f('0x4a')]['id']},'attributes':['id',_0x061f('0x54')]})['then'](handleEntityNotFound(_0x54f91e,null))[_0x061f('0x23')](function(_0x4a2c62){if(_0x4a2c62){var _0x3bf309=require(_0x061f('0x55'))();_0x3bf309[_0x061f('0x56')](_0x4a2c62[_0x061f('0x54')]);_0x3bf309[_0x061f('0x57')]();return _0x4a2c62;}})[_0x061f('0x23')](respondWithResult(_0x54f91e,null))['catch'](handleError(_0x54f91e,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