Built motion from commit 753c950e.|2.5.42
[motion2.git] / server / api / pause / pause.controller.js
index d606820..acf25c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf070=['../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','then','get','end','error','send','Pause','fieldName','map','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x1fbe05,_0x780c12){var _0x19ae69=function(_0x12a86c){while(--_0x12a86c){_0x1fbe05['push'](_0x1fbe05['shift']());}};_0x19ae69(++_0x780c12);}(_0xf070,0x172));var _0x0f07=function(_0x481da7,_0x3a90b6){_0x481da7=_0x481da7-0x0;var _0x1addf1=_0xf070[_0x481da7];return _0x1addf1;};'use strict';var pdf=require(_0x0f07('0x0'));var emlformat=require(_0x0f07('0x1'));var rimraf=require(_0x0f07('0x2'));var zipdir=require(_0x0f07('0x3'));var jsonpatch=require(_0x0f07('0x4'));var rp=require(_0x0f07('0x5'));var moment=require(_0x0f07('0x6'));var BPromise=require(_0x0f07('0x7'));var Mustache=require(_0x0f07('0x8'));var util=require('util');var path=require('path');var sox=require(_0x0f07('0x9'));var csv=require('to-csv');var ejs=require(_0x0f07('0xa'));var fs=require('fs');var _=require(_0x0f07('0xb'));var squel=require(_0x0f07('0xc'));var crypto=require(_0x0f07('0xd'));var jsforce=require(_0x0f07('0xe'));var deskjs=require(_0x0f07('0xf'));var toCsv=require(_0x0f07('0x10'));var querystring=require(_0x0f07('0x11'));var Papa=require(_0x0f07('0x12'));var Redis=require(_0x0f07('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0f07('0x14'));var as=require(_0x0f07('0x15'));var hardwareService=require(_0x0f07('0x16'));var logger=require('../../config/logger')(_0x0f07('0x17'));var utils=require(_0x0f07('0x18'));var config=require(_0x0f07('0x19'));var db=require(_0x0f07('0x1a'))['db'];function respondWithStatusCode(_0x252fa1,_0x5156eb){_0x5156eb=_0x5156eb||0xcc;return function(_0x4d9474){if(_0x4d9474){return _0x252fa1[_0x0f07('0x1b')](_0x5156eb);}return _0x252fa1['status'](_0x5156eb)['end']();};}function respondWithResult(_0x3574b4,_0x2e12e9){_0x2e12e9=_0x2e12e9||0xc8;return function(_0x2340fd){if(_0x2340fd){return _0x3574b4[_0x0f07('0x1c')](_0x2e12e9)['json'](_0x2340fd);}};}function respondWithFilteredResult(_0x28cb78,_0x9b027a){return function(_0x14bf77){if(_0x14bf77){var _0x4b035d=_0x14bf77[_0x0f07('0x1d')],_0x159c0b=_0x9b027a['offset'],_0x2ab5ca=_0x9b027a[_0x0f07('0x1e')]+_0x9b027a[_0x0f07('0x1f')],_0x7cf90;if(_0x2ab5ca>=_0x4b035d){_0x2ab5ca=_0x4b035d;_0x7cf90=0xc8;}else{_0x7cf90=0xce;}_0x28cb78['status'](_0x7cf90);return _0x28cb78[_0x0f07('0x20')](_0x0f07('0x21'),_0x159c0b+'-'+_0x2ab5ca+'/'+_0x4b035d)[_0x0f07('0x22')](_0x14bf77);}return null;};}function patchUpdates(_0x2d6a7c){return function(_0x317108){try{jsonpatch[_0x0f07('0x23')](_0x317108,_0x2d6a7c,!![]);}catch(_0xa0c97c){return BPromise[_0x0f07('0x24')](_0xa0c97c);}return _0x317108['save']();};}function saveUpdates(_0x4e6544,_0x18da0c){return function(_0x15dfc7){if(_0x15dfc7){return _0x15dfc7[_0x0f07('0x25')](_0x4e6544)['then'](function(_0x28a6dd){return _0x28a6dd;});}return null;};}function removeEntity(_0x295307,_0x3244de){return function(_0x1f29b8){if(_0x1f29b8){return _0x1f29b8[_0x0f07('0x26')]()[_0x0f07('0x27')](function(){var _0x311cf6=_0x1f29b8[_0x0f07('0x28')]({'plain':!![]});var _0xda7afc='Pauses';return db['UserProfileResource']['destroy']({'where':{'type':_0xda7afc,'resourceId':_0x311cf6['id']}})['then'](function(){return _0x1f29b8;});})[_0x0f07('0x27')](function(){_0x295307[_0x0f07('0x1c')](0xcc)[_0x0f07('0x29')]();});}};}function handleEntityNotFound(_0x28a5c6,_0x3f845f){return function(_0x17da82){if(!_0x17da82){_0x28a5c6[_0x0f07('0x1b')](0x194);}return _0x17da82;};}function handleError(_0x9e6a02,_0x38a527){_0x38a527=_0x38a527||0x1f4;return function(_0x3d3a59){logger[_0x0f07('0x2a')](_0x3d3a59['stack']);if(_0x3d3a59['name']){delete _0x3d3a59['name'];}_0x9e6a02[_0x0f07('0x1c')](_0x38a527)[_0x0f07('0x2b')](_0x3d3a59);};}exports['index']=function(_0x2d400d,_0x262acb){var _0x11b170={},_0x3aa207={},_0x5a3796={'count':0x0,'rows':[]};var _0x324cac=_['map'](db[_0x0f07('0x2c')]['rawAttributes'],function(_0x2f745d){return{'name':_0x2f745d[_0x0f07('0x2d')],'type':_0x2f745d['type']['key']};});_0x3aa207['model']=_[_0x0f07('0x2e')](_0x324cac,_0x0f07('0x2f'));_0x3aa207[_0x0f07('0x30')]=_[_0x0f07('0x31')](_0x2d400d[_0x0f07('0x30')]);_0x3aa207[_0x0f07('0x32')]=_[_0x0f07('0x33')](_0x3aa207[_0x0f07('0x34')],_0x3aa207[_0x0f07('0x30')]);_0x11b170[_0x0f07('0x35')]=_[_0x0f07('0x33')](_0x3aa207[_0x0f07('0x34')],qs[_0x0f07('0x36')](_0x2d400d[_0x0f07('0x30')][_0x0f07('0x36')]));_0x11b170[_0x0f07('0x35')]=_0x11b170[_0x0f07('0x35')][_0x0f07('0x37')]?_0x11b170[_0x0f07('0x35')]:_0x3aa207[_0x0f07('0x34')];if(!_0x2d400d[_0x0f07('0x30')][_0x0f07('0x38')]('nolimit')){_0x11b170[_0x0f07('0x1f')]=qs['limit'](_0x2d400d['query'][_0x0f07('0x1f')]);_0x11b170[_0x0f07('0x1e')]=qs[_0x0f07('0x1e')](_0x2d400d[_0x0f07('0x30')][_0x0f07('0x1e')]);}_0x11b170[_0x0f07('0x39')]=qs[_0x0f07('0x3a')](_0x2d400d['query'][_0x0f07('0x3a')]);_0x11b170['where']=qs[_0x0f07('0x32')](_[_0x0f07('0x3b')](_0x2d400d['query'],_0x3aa207[_0x0f07('0x32')]));if(_0x2d400d[_0x0f07('0x30')][_0x0f07('0x3c')]){_0x11b170[_0x0f07('0x3d')]=_[_0x0f07('0x3e')](_0x11b170[_0x0f07('0x3d')],{'$or':_['map'](_0x324cac,function(_0x207021){if(_0x207021[_0x0f07('0x3f')]!=='VIRTUAL'){var _0x338564={};_0x338564[_0x207021[_0x0f07('0x2f')]]={'$like':'%'+_0x2d400d[_0x0f07('0x30')][_0x0f07('0x3c')]+'%'};return _0x338564;}})});}_0x11b170=_[_0x0f07('0x3e')]({},_0x11b170,_0x2d400d[_0x0f07('0x40')]);var _0x22bfff={'where':_0x11b170[_0x0f07('0x3d')]};return db['Pause'][_0x0f07('0x1d')](_0x22bfff)['then'](function(_0x4bd54e){_0x5a3796[_0x0f07('0x1d')]=_0x4bd54e;if(_0x2d400d[_0x0f07('0x30')][_0x0f07('0x41')]){_0x11b170[_0x0f07('0x42')]=[{'all':!![]}];}return db['Pause'][_0x0f07('0x43')](_0x11b170);})['then'](function(_0x43ff5e){_0x5a3796['rows']=_0x43ff5e;return _0x5a3796;})[_0x0f07('0x27')](respondWithFilteredResult(_0x262acb,_0x11b170))[_0x0f07('0x44')](handleError(_0x262acb,null));};exports[_0x0f07('0x45')]=function(_0x315a8a,_0xe33416){var _0x480ff6={'raw':!![],'where':{'id':_0x315a8a[_0x0f07('0x46')]['id']}},_0x543f08={};_0x543f08[_0x0f07('0x34')]=_['keys'](db[_0x0f07('0x2c')][_0x0f07('0x47')]);_0x543f08['query']=_[_0x0f07('0x31')](_0x315a8a['query']);_0x543f08[_0x0f07('0x32')]=_['intersection'](_0x543f08[_0x0f07('0x34')],_0x543f08[_0x0f07('0x30')]);_0x480ff6[_0x0f07('0x35')]=_[_0x0f07('0x33')](_0x543f08[_0x0f07('0x34')],qs[_0x0f07('0x36')](_0x315a8a[_0x0f07('0x30')][_0x0f07('0x36')]));_0x480ff6['attributes']=_0x480ff6['attributes']['length']?_0x480ff6[_0x0f07('0x35')]:_0x543f08[_0x0f07('0x34')];if(_0x315a8a[_0x0f07('0x30')]['includeAll']){_0x480ff6[_0x0f07('0x42')]=[{'all':!![]}];}_0x480ff6=_[_0x0f07('0x3e')]({},_0x480ff6,_0x315a8a['options']);return db[_0x0f07('0x2c')][_0x0f07('0x48')](_0x480ff6)[_0x0f07('0x27')](handleEntityNotFound(_0xe33416,null))['then'](respondWithResult(_0xe33416,null))[_0x0f07('0x44')](handleError(_0xe33416,null));};exports[_0x0f07('0x49')]=function(_0x3a98bd,_0x27ceec){return db[_0x0f07('0x2c')][_0x0f07('0x49')](_0x3a98bd[_0x0f07('0x4a')],{})['then'](function(_0xcf1f38){var _0x2eb0f7=_0x3a98bd[_0x0f07('0x4b')]['get']({'plain':!![]});if(!_0x2eb0f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2eb0f7[_0x0f07('0x4c')]==='user'){var _0xabd54c=_0xcf1f38[_0x0f07('0x28')]({'plain':!![]});var _0x36a24d='Pauses';return db['UserProfileSection'][_0x0f07('0x48')]({'where':{'name':_0x36a24d,'userProfileId':_0x2eb0f7['userProfileId']},'raw':!![]})[_0x0f07('0x27')](function(_0x8d5400){if(_0x8d5400&&_0x8d5400[_0x0f07('0x4d')]===0x0){return db['UserProfileResource'][_0x0f07('0x49')]({'name':_0xabd54c['name'],'resourceId':_0xabd54c['id'],'type':_0x8d5400[_0x0f07('0x2f')],'sectionId':_0x8d5400['id']},{})[_0x0f07('0x27')](function(){return _0xcf1f38;});}else{return _0xcf1f38;}})[_0x0f07('0x44')](function(_0x15e90a){logger[_0x0f07('0x2a')](_0x0f07('0x4e'),_0x15e90a);throw _0x15e90a;});}return _0xcf1f38;})['then'](respondWithResult(_0x27ceec,0xc9))[_0x0f07('0x44')](handleError(_0x27ceec,null));};exports['update']=function(_0x37401e,_0x1e5d8f){if(_0x37401e[_0x0f07('0x4a')]['id']){delete _0x37401e[_0x0f07('0x4a')]['id'];}return db['Pause'][_0x0f07('0x48')]({'where':{'id':_0x37401e[_0x0f07('0x46')]['id']}})[_0x0f07('0x27')](handleEntityNotFound(_0x1e5d8f,null))[_0x0f07('0x27')](saveUpdates(_0x37401e['body'],null))[_0x0f07('0x27')](respondWithResult(_0x1e5d8f,null))['catch'](handleError(_0x1e5d8f,null));};exports[_0x0f07('0x26')]=function(_0x36ba4d,_0x56e0b0){return db['Pause'][_0x0f07('0x48')]({'where':{'id':_0x36ba4d[_0x0f07('0x46')]['id']}})['then'](handleEntityNotFound(_0x56e0b0,null))['then'](removeEntity(_0x56e0b0,null))[_0x0f07('0x44')](handleError(_0x56e0b0,null));};
\ No newline at end of file
+var _0x8127=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','destroy','then','get','Pauses','UserProfileResource','end','error','stack','name','send','index','map','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','Pause','includeAll','include','findAll','rows','rawAttributes','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x1be1f6,_0x5e7089){var _0x2bd577=function(_0x210461){while(--_0x210461){_0x1be1f6['push'](_0x1be1f6['shift']());}};_0x2bd577(++_0x5e7089);}(_0x8127,0xea));var _0x7812=function(_0x2f85ce,_0x251cab){_0x2f85ce=_0x2f85ce-0x0;var _0x232760=_0x8127[_0x2f85ce];return _0x232760;};'use strict';var emlformat=require(_0x7812('0x0'));var rimraf=require(_0x7812('0x1'));var zipdir=require(_0x7812('0x2'));var jsonpatch=require(_0x7812('0x3'));var rp=require(_0x7812('0x4'));var moment=require('moment');var BPromise=require(_0x7812('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7812('0x6'));var sox=require(_0x7812('0x7'));var csv=require(_0x7812('0x8'));var ejs=require(_0x7812('0x9'));var fs=require('fs');var fs_extra=require(_0x7812('0xa'));var _=require(_0x7812('0xb'));var squel=require(_0x7812('0xc'));var crypto=require('crypto');var jsforce=require(_0x7812('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7812('0x8'));var querystring=require(_0x7812('0xe'));var Papa=require(_0x7812('0xf'));var Redis=require(_0x7812('0x10'));var authService=require(_0x7812('0x11'));var qs=require(_0x7812('0x12'));var as=require(_0x7812('0x13'));var hardwareService=require(_0x7812('0x14'));var logger=require(_0x7812('0x15'))(_0x7812('0x16'));var utils=require(_0x7812('0x17'));var config=require(_0x7812('0x18'));var licenseUtil=require(_0x7812('0x19'));var db=require(_0x7812('0x1a'))['db'];function respondWithStatusCode(_0x4162d3,_0x32a995){_0x32a995=_0x32a995||0xcc;return function(_0x87d65f){if(_0x87d65f){return _0x4162d3[_0x7812('0x1b')](_0x32a995);}return _0x4162d3['status'](_0x32a995)['end']();};}function respondWithResult(_0x48e394,_0x42ad6a){_0x42ad6a=_0x42ad6a||0xc8;return function(_0x3da46d){if(_0x3da46d){return _0x48e394['status'](_0x42ad6a)[_0x7812('0x1c')](_0x3da46d);}};}function respondWithFilteredResult(_0x39411a,_0x303dbc){return function(_0x56e5c5){if(_0x56e5c5){var _0xe71909=typeof _0x303dbc[_0x7812('0x1d')]===_0x7812('0x1e')&&typeof _0x303dbc[_0x7812('0x1f')]===_0x7812('0x1e');var _0x20614e=_0x56e5c5[_0x7812('0x20')];var _0x5eedef=_0xe71909?0x0:_0x303dbc[_0x7812('0x1d')];var _0xa477ba=_0xe71909?_0x56e5c5[_0x7812('0x20')]:_0x303dbc[_0x7812('0x1d')]+_0x303dbc['limit'];var _0x11644e;if(_0xa477ba>=_0x20614e){_0xa477ba=_0x20614e;_0x11644e=0xc8;}else{_0x11644e=0xce;}_0x39411a[_0x7812('0x21')](_0x11644e);return _0x39411a[_0x7812('0x22')](_0x7812('0x23'),_0x5eedef+'-'+_0xa477ba+'/'+_0x20614e)[_0x7812('0x1c')](_0x56e5c5);}return null;};}function patchUpdates(_0x2a7f8c){return function(_0x42347a){try{jsonpatch[_0x7812('0x24')](_0x42347a,_0x2a7f8c,!![]);}catch(_0x3db044){return BPromise[_0x7812('0x25')](_0x3db044);}return _0x42347a[_0x7812('0x26')]();};}function saveUpdates(_0xa34664,_0x179b8b){return function(_0x516d4d){if(_0x516d4d){return _0x516d4d['update'](_0xa34664)['then'](function(_0xb94c0e){return _0xb94c0e;});}return null;};}function removeEntity(_0x55f989,_0x62f15a){return function(_0x1600f5){if(_0x1600f5){return _0x1600f5[_0x7812('0x27')]()[_0x7812('0x28')](function(){var _0x13da89=_0x1600f5[_0x7812('0x29')]({'plain':!![]});var _0x4268cb=_0x7812('0x2a');return db[_0x7812('0x2b')][_0x7812('0x27')]({'where':{'type':_0x4268cb,'resourceId':_0x13da89['id']}})['then'](function(){return _0x1600f5;});})[_0x7812('0x28')](function(){_0x55f989[_0x7812('0x21')](0xcc)[_0x7812('0x2c')]();});}};}function handleEntityNotFound(_0x17702b,_0x25cb5f){return function(_0x5d3fb5){if(!_0x5d3fb5){_0x17702b['sendStatus'](0x194);}return _0x5d3fb5;};}function handleError(_0x30f73a,_0x5c2e4e){_0x5c2e4e=_0x5c2e4e||0x1f4;return function(_0x5efd7e){logger[_0x7812('0x2d')](_0x5efd7e[_0x7812('0x2e')]);if(_0x5efd7e['name']){delete _0x5efd7e[_0x7812('0x2f')];}_0x30f73a['status'](_0x5c2e4e)[_0x7812('0x30')](_0x5efd7e);};}exports[_0x7812('0x31')]=function(_0x2cbc16,_0x2311fa){var _0x205a97={},_0x55cca3={},_0x588395={'count':0x0,'rows':[]};var _0x7757f3=_[_0x7812('0x32')](db['Pause']['rawAttributes'],function(_0x2e3d64){return{'name':_0x2e3d64['fieldName'],'type':_0x2e3d64[_0x7812('0x33')][_0x7812('0x34')]};});_0x55cca3['model']=_['map'](_0x7757f3,_0x7812('0x2f'));_0x55cca3[_0x7812('0x35')]=_[_0x7812('0x36')](_0x2cbc16[_0x7812('0x35')]);_0x55cca3[_0x7812('0x37')]=_['intersection'](_0x55cca3[_0x7812('0x38')],_0x55cca3['query']);_0x205a97['attributes']=_['intersection'](_0x55cca3[_0x7812('0x38')],qs['fields'](_0x2cbc16[_0x7812('0x35')][_0x7812('0x39')]));_0x205a97[_0x7812('0x3a')]=_0x205a97[_0x7812('0x3a')][_0x7812('0x3b')]?_0x205a97[_0x7812('0x3a')]:_0x55cca3[_0x7812('0x38')];if(!_0x2cbc16[_0x7812('0x35')][_0x7812('0x3c')]('nolimit')){_0x205a97['limit']=qs[_0x7812('0x1f')](_0x2cbc16[_0x7812('0x35')][_0x7812('0x1f')]);_0x205a97[_0x7812('0x1d')]=qs[_0x7812('0x1d')](_0x2cbc16['query'][_0x7812('0x1d')]);}_0x205a97[_0x7812('0x3d')]=qs['sort'](_0x2cbc16[_0x7812('0x35')][_0x7812('0x3e')]);_0x205a97[_0x7812('0x3f')]=qs[_0x7812('0x37')](_['pick'](_0x2cbc16[_0x7812('0x35')],_0x55cca3['filters']),_0x7757f3);if(_0x2cbc16['query'][_0x7812('0x40')]){_0x205a97[_0x7812('0x3f')]=_[_0x7812('0x41')](_0x205a97[_0x7812('0x3f')],{'$or':_[_0x7812('0x32')](_0x7757f3,function(_0x5da509){if(_0x5da509['type']!==_0x7812('0x42')){var _0x8a6c23={};_0x8a6c23[_0x5da509[_0x7812('0x2f')]]={'$like':'%'+_0x2cbc16[_0x7812('0x35')][_0x7812('0x40')]+'%'};return _0x8a6c23;}})});}_0x205a97=_[_0x7812('0x41')]({},_0x205a97,_0x2cbc16[_0x7812('0x43')]);var _0x1a5dee={'where':_0x205a97[_0x7812('0x3f')]};return db[_0x7812('0x44')][_0x7812('0x20')](_0x1a5dee)[_0x7812('0x28')](function(_0x20db12){_0x588395[_0x7812('0x20')]=_0x20db12;if(_0x2cbc16['query'][_0x7812('0x45')]){_0x205a97[_0x7812('0x46')]=[{'all':!![]}];}return db[_0x7812('0x44')][_0x7812('0x47')](_0x205a97);})[_0x7812('0x28')](function(_0x32fdba){_0x588395[_0x7812('0x48')]=_0x32fdba;return _0x588395;})['then'](respondWithFilteredResult(_0x2311fa,_0x205a97))['catch'](handleError(_0x2311fa,null));};exports['show']=function(_0x5c03ae,_0x554dac){var _0x35cc87={'raw':!![],'where':{'id':_0x5c03ae['params']['id']}},_0x3e5bd2={};_0x3e5bd2[_0x7812('0x38')]=_[_0x7812('0x36')](db[_0x7812('0x44')][_0x7812('0x49')]);_0x3e5bd2[_0x7812('0x35')]=_[_0x7812('0x36')](_0x5c03ae[_0x7812('0x35')]);_0x3e5bd2[_0x7812('0x37')]=_[_0x7812('0x4a')](_0x3e5bd2['model'],_0x3e5bd2['query']);_0x35cc87[_0x7812('0x3a')]=_[_0x7812('0x4a')](_0x3e5bd2['model'],qs['fields'](_0x5c03ae[_0x7812('0x35')][_0x7812('0x39')]));_0x35cc87['attributes']=_0x35cc87[_0x7812('0x3a')][_0x7812('0x3b')]?_0x35cc87['attributes']:_0x3e5bd2[_0x7812('0x38')];if(_0x5c03ae['query'][_0x7812('0x45')]){_0x35cc87[_0x7812('0x46')]=[{'all':!![]}];}_0x35cc87=_[_0x7812('0x41')]({},_0x35cc87,_0x5c03ae[_0x7812('0x43')]);return db[_0x7812('0x44')][_0x7812('0x4b')](_0x35cc87)['then'](handleEntityNotFound(_0x554dac,null))[_0x7812('0x28')](respondWithResult(_0x554dac,null))[_0x7812('0x4c')](handleError(_0x554dac,null));};exports[_0x7812('0x4d')]=function(_0x3b625e,_0x1b0f61){return db[_0x7812('0x44')][_0x7812('0x4d')](_0x3b625e[_0x7812('0x4e')],{})[_0x7812('0x28')](function(_0x153d63){var _0x4d0cf5=_0x3b625e[_0x7812('0x4f')][_0x7812('0x29')]({'plain':!![]});if(!_0x4d0cf5)throw new Error(_0x7812('0x50'));if(_0x4d0cf5['role']===_0x7812('0x4f')){var _0x3b00f1=_0x153d63['get']({'plain':!![]});var _0x579c55=_0x7812('0x2a');return db[_0x7812('0x51')][_0x7812('0x4b')]({'where':{'name':_0x579c55,'userProfileId':_0x4d0cf5[_0x7812('0x52')]},'raw':!![]})[_0x7812('0x28')](function(_0x4ebeea){if(_0x4ebeea&&_0x4ebeea['autoAssociation']===0x0){return db[_0x7812('0x2b')][_0x7812('0x4d')]({'name':_0x3b00f1['name'],'resourceId':_0x3b00f1['id'],'type':_0x4ebeea['name'],'sectionId':_0x4ebeea['id']},{})['then'](function(){return _0x153d63;});}else{return _0x153d63;}})[_0x7812('0x4c')](function(_0x27c104){logger['error'](_0x7812('0x53'),_0x27c104);throw _0x27c104;});}return _0x153d63;})[_0x7812('0x28')](respondWithResult(_0x1b0f61,0xc9))[_0x7812('0x4c')](handleError(_0x1b0f61,null));};exports[_0x7812('0x54')]=function(_0x45db14,_0x34c32f){if(_0x45db14['body']['id']){delete _0x45db14[_0x7812('0x4e')]['id'];}return db[_0x7812('0x44')][_0x7812('0x4b')]({'where':{'id':_0x45db14[_0x7812('0x55')]['id']}})[_0x7812('0x28')](handleEntityNotFound(_0x34c32f,null))[_0x7812('0x28')](saveUpdates(_0x45db14[_0x7812('0x4e')],null))['then'](respondWithResult(_0x34c32f,null))['catch'](handleError(_0x34c32f,null));};exports[_0x7812('0x27')]=function(_0x1291d4,_0x3dc32c){return db[_0x7812('0x44')][_0x7812('0x4b')]({'where':{'id':_0x1291d4[_0x7812('0x55')]['id']}})['then'](handleEntityNotFound(_0x3dc32c,null))[_0x7812('0x28')](removeEntity(_0x3dc32c,null))['catch'](handleError(_0x3dc32c,null));};
\ No newline at end of file