Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / pause / pause.controller.js
index 5ca4f75..767ea50 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4702=['send','index','map','rawAttributes','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','type','filter','merge','options','Pause','findAll','catch','show','keys','includeAll','include','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','count','limit','Content-Range','apply','reject','save','update','then','Pauses','UserProfileResource','destroy','end','error','name'];(function(_0x51674a,_0x77ccff){var _0x13fca6=function(_0x3d6c27){while(--_0x3d6c27){_0x51674a['push'](_0x51674a['shift']());}};_0x13fca6(++_0x77ccff);}(_0x4702,0x70));var _0x2470=function(_0x324f15,_0x37d5fa){_0x324f15=_0x324f15-0x0;var _0x5e3134=_0x4702[_0x324f15];return _0x5e3134;};'use strict';var emlformat=require(_0x2470('0x0'));var rimraf=require(_0x2470('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2470('0x2'));var rp=require('request-promise');var moment=require(_0x2470('0x3'));var BPromise=require(_0x2470('0x4'));var Mustache=require('mustache');var util=require(_0x2470('0x5'));var path=require(_0x2470('0x6'));var sox=require(_0x2470('0x7'));var csv=require(_0x2470('0x8'));var ejs=require(_0x2470('0x9'));var fs=require('fs');var fs_extra=require(_0x2470('0xa'));var _=require(_0x2470('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2470('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2470('0x8'));var querystring=require(_0x2470('0xd'));var Papa=require('papaparse');var Redis=require(_0x2470('0xe'));var authService=require(_0x2470('0xf'));var qs=require(_0x2470('0x10'));var as=require(_0x2470('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2470('0x12'))(_0x2470('0x13'));var utils=require(_0x2470('0x14'));var config=require(_0x2470('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2470('0x16'))['db'];function respondWithStatusCode(_0x2e72fb,_0x418b86){_0x418b86=_0x418b86||0xcc;return function(_0x29c15d){if(_0x29c15d){return _0x2e72fb['sendStatus'](_0x418b86);}return _0x2e72fb[_0x2470('0x17')](_0x418b86)['end']();};}function respondWithResult(_0x4fa132,_0x3d31f4){_0x3d31f4=_0x3d31f4||0xc8;return function(_0x2723cb){if(_0x2723cb){return _0x4fa132[_0x2470('0x17')](_0x3d31f4)[_0x2470('0x18')](_0x2723cb);}};}function respondWithFilteredResult(_0x2497c6,_0x4d6a6d){return function(_0x567082){if(_0x567082){var _0x18a849=typeof _0x4d6a6d[_0x2470('0x19')]==='undefined'&&typeof _0x4d6a6d['limit']==='undefined';var _0x20835f=_0x567082[_0x2470('0x1a')];var _0x4269c1=_0x18a849?0x0:_0x4d6a6d[_0x2470('0x19')];var _0x38d6b0=_0x18a849?_0x567082[_0x2470('0x1a')]:_0x4d6a6d[_0x2470('0x19')]+_0x4d6a6d[_0x2470('0x1b')];var _0x21e374;if(_0x38d6b0>=_0x20835f){_0x38d6b0=_0x20835f;_0x21e374=0xc8;}else{_0x21e374=0xce;}_0x2497c6[_0x2470('0x17')](_0x21e374);return _0x2497c6['set'](_0x2470('0x1c'),_0x4269c1+'-'+_0x38d6b0+'/'+_0x20835f)[_0x2470('0x18')](_0x567082);}return null;};}function patchUpdates(_0x4cc4a3){return function(_0x24b2a4){try{jsonpatch[_0x2470('0x1d')](_0x24b2a4,_0x4cc4a3,!![]);}catch(_0x2a329d){return BPromise[_0x2470('0x1e')](_0x2a329d);}return _0x24b2a4[_0x2470('0x1f')]();};}function saveUpdates(_0x2c6512,_0x51d376){return function(_0x46c3df){if(_0x46c3df){return _0x46c3df[_0x2470('0x20')](_0x2c6512)[_0x2470('0x21')](function(_0x42f61b){return _0x42f61b;});}return null;};}function removeEntity(_0x9a2765,_0x49cd90){return function(_0x546df5){if(_0x546df5){return _0x546df5['destroy']()[_0x2470('0x21')](function(){var _0x33997b=_0x546df5['get']({'plain':!![]});var _0x2278b1=_0x2470('0x22');return db[_0x2470('0x23')][_0x2470('0x24')]({'where':{'type':_0x2278b1,'resourceId':_0x33997b['id']}})[_0x2470('0x21')](function(){return _0x546df5;});})[_0x2470('0x21')](function(){_0x9a2765[_0x2470('0x17')](0xcc)[_0x2470('0x25')]();});}};}function handleEntityNotFound(_0x12ca8b,_0x5b36fb){return function(_0x2cb106){if(!_0x2cb106){_0x12ca8b['sendStatus'](0x194);}return _0x2cb106;};}function handleError(_0x381d91,_0x47fcce){_0x47fcce=_0x47fcce||0x1f4;return function(_0x3bb1de){logger[_0x2470('0x26')](_0x3bb1de['stack']);if(_0x3bb1de[_0x2470('0x27')]){delete _0x3bb1de[_0x2470('0x27')];}_0x381d91[_0x2470('0x17')](_0x47fcce)[_0x2470('0x28')](_0x3bb1de);};}exports[_0x2470('0x29')]=function(_0x4157aa,_0x260867){var _0x5e46d2={},_0x5c7825={},_0x42daff={'count':0x0,'rows':[]};var _0x13ec32=_[_0x2470('0x2a')](db['Pause'][_0x2470('0x2b')],function(_0x14beb5){return{'name':_0x14beb5['fieldName'],'type':_0x14beb5['type']['key']};});_0x5c7825[_0x2470('0x2c')]=_[_0x2470('0x2a')](_0x13ec32,_0x2470('0x27'));_0x5c7825[_0x2470('0x2d')]=_['keys'](_0x4157aa[_0x2470('0x2d')]);_0x5c7825['filters']=_[_0x2470('0x2e')](_0x5c7825[_0x2470('0x2c')],_0x5c7825[_0x2470('0x2d')]);_0x5e46d2[_0x2470('0x2f')]=_[_0x2470('0x2e')](_0x5c7825[_0x2470('0x2c')],qs['fields'](_0x4157aa[_0x2470('0x2d')][_0x2470('0x30')]));_0x5e46d2['attributes']=_0x5e46d2[_0x2470('0x2f')][_0x2470('0x31')]?_0x5e46d2['attributes']:_0x5c7825[_0x2470('0x2c')];if(!_0x4157aa[_0x2470('0x2d')][_0x2470('0x32')](_0x2470('0x33'))){_0x5e46d2[_0x2470('0x1b')]=qs[_0x2470('0x1b')](_0x4157aa[_0x2470('0x2d')][_0x2470('0x1b')]);_0x5e46d2[_0x2470('0x19')]=qs['offset'](_0x4157aa[_0x2470('0x2d')][_0x2470('0x19')]);}_0x5e46d2[_0x2470('0x34')]=qs['sort'](_0x4157aa[_0x2470('0x2d')]['sort']);_0x5e46d2[_0x2470('0x35')]=qs[_0x2470('0x36')](_[_0x2470('0x37')](_0x4157aa[_0x2470('0x2d')],_0x5c7825[_0x2470('0x36')]),_0x13ec32);if(_0x4157aa[_0x2470('0x2d')]['filter']){_0x5e46d2['where']=_['merge'](_0x5e46d2[_0x2470('0x35')],{'$or':_[_0x2470('0x2a')](_0x13ec32,function(_0x33acc6){if(_0x33acc6[_0x2470('0x38')]!=='VIRTUAL'){var _0x907bcc={};_0x907bcc[_0x33acc6[_0x2470('0x27')]]={'$like':'%'+_0x4157aa[_0x2470('0x2d')][_0x2470('0x39')]+'%'};return _0x907bcc;}})});}_0x5e46d2=_[_0x2470('0x3a')]({},_0x5e46d2,_0x4157aa[_0x2470('0x3b')]);var _0x4ce301={'where':_0x5e46d2['where']};return db[_0x2470('0x3c')]['count'](_0x4ce301)['then'](function(_0x3f7b84){_0x42daff[_0x2470('0x1a')]=_0x3f7b84;if(_0x4157aa[_0x2470('0x2d')]['includeAll']){_0x5e46d2['include']=[{'all':!![]}];}return db[_0x2470('0x3c')][_0x2470('0x3d')](_0x5e46d2);})[_0x2470('0x21')](function(_0x3183e5){_0x42daff['rows']=_0x3183e5;return _0x42daff;})[_0x2470('0x21')](respondWithFilteredResult(_0x260867,_0x5e46d2))[_0x2470('0x3e')](handleError(_0x260867,null));};exports[_0x2470('0x3f')]=function(_0x6c4dab,_0x2daa56){var _0x1c349b={'raw':!![],'where':{'id':_0x6c4dab['params']['id']}},_0x2621d1={};_0x2621d1['model']=_[_0x2470('0x40')](db['Pause'][_0x2470('0x2b')]);_0x2621d1[_0x2470('0x2d')]=_[_0x2470('0x40')](_0x6c4dab[_0x2470('0x2d')]);_0x2621d1[_0x2470('0x36')]=_[_0x2470('0x2e')](_0x2621d1['model'],_0x2621d1[_0x2470('0x2d')]);_0x1c349b[_0x2470('0x2f')]=_[_0x2470('0x2e')](_0x2621d1[_0x2470('0x2c')],qs['fields'](_0x6c4dab[_0x2470('0x2d')][_0x2470('0x30')]));_0x1c349b[_0x2470('0x2f')]=_0x1c349b[_0x2470('0x2f')][_0x2470('0x31')]?_0x1c349b[_0x2470('0x2f')]:_0x2621d1[_0x2470('0x2c')];if(_0x6c4dab[_0x2470('0x2d')][_0x2470('0x41')]){_0x1c349b[_0x2470('0x42')]=[{'all':!![]}];}_0x1c349b=_[_0x2470('0x3a')]({},_0x1c349b,_0x6c4dab[_0x2470('0x3b')]);return db['Pause']['find'](_0x1c349b)['then'](handleEntityNotFound(_0x2daa56,null))['then'](respondWithResult(_0x2daa56,null))[_0x2470('0x3e')](handleError(_0x2daa56,null));};exports['create']=function(_0x461fcf,_0x2569dc){return db[_0x2470('0x3c')]['create'](_0x461fcf[_0x2470('0x43')],{})['then'](function(_0x1117fc){var _0x8e1809=_0x461fcf[_0x2470('0x44')]['get']({'plain':!![]});if(!_0x8e1809)throw new Error(_0x2470('0x45'));if(_0x8e1809[_0x2470('0x46')]===_0x2470('0x44')){var _0x23ad5=_0x1117fc[_0x2470('0x47')]({'plain':!![]});var _0xa038d6=_0x2470('0x22');return db['UserProfileSection'][_0x2470('0x48')]({'where':{'name':_0xa038d6,'userProfileId':_0x8e1809['userProfileId']},'raw':!![]})['then'](function(_0x2e9f66){if(_0x2e9f66&&_0x2e9f66[_0x2470('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x23ad5[_0x2470('0x27')],'resourceId':_0x23ad5['id'],'type':_0x2e9f66[_0x2470('0x27')],'sectionId':_0x2e9f66['id']},{})[_0x2470('0x21')](function(){return _0x1117fc;});}else{return _0x1117fc;}})[_0x2470('0x3e')](function(_0x201124){logger[_0x2470('0x26')](_0x2470('0x4a'),_0x201124);throw _0x201124;});}return _0x1117fc;})['then'](respondWithResult(_0x2569dc,0xc9))[_0x2470('0x3e')](handleError(_0x2569dc,null));};exports[_0x2470('0x20')]=function(_0xbc8f97,_0x20bd74){if(_0xbc8f97[_0x2470('0x43')]['id']){delete _0xbc8f97[_0x2470('0x43')]['id'];}return db['Pause'][_0x2470('0x48')]({'where':{'id':_0xbc8f97[_0x2470('0x4b')]['id']}})[_0x2470('0x21')](handleEntityNotFound(_0x20bd74,null))['then'](saveUpdates(_0xbc8f97[_0x2470('0x43')],null))[_0x2470('0x21')](respondWithResult(_0x20bd74,null))[_0x2470('0x3e')](handleError(_0x20bd74,null));};exports[_0x2470('0x24')]=function(_0x2700bc,_0x3c2656){return db[_0x2470('0x3c')][_0x2470('0x48')]({'where':{'id':_0x2700bc[_0x2470('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3c2656,null))[_0x2470('0x21')](removeEntity(_0x3c2656,null))['catch'](handleError(_0x3c2656,null));};
\ No newline at end of file
+var _0xc18d=['VIRTUAL','merge','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','Pauses','UserProfileResource','destroy','error','stack','name','send','map','Pause','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where'];(function(_0x532575,_0x1c3f7e){var _0x52570b=function(_0x27109a){while(--_0x27109a){_0x532575['push'](_0x532575['shift']());}};_0x52570b(++_0x1c3f7e);}(_0xc18d,0xfb));var _0xdc18=function(_0x512a09,_0x240587){_0x512a09=_0x512a09-0x0;var _0x4d9c60=_0xc18d[_0x512a09];return _0x4d9c60;};'use strict';var emlformat=require(_0xdc18('0x0'));var rimraf=require(_0xdc18('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc18('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdc18('0x3'));var Mustache=require(_0xdc18('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdc18('0x5'));var ejs=require(_0xdc18('0x6'));var fs=require('fs');var fs_extra=require(_0xdc18('0x7'));var _=require(_0xdc18('0x8'));var squel=require(_0xdc18('0x9'));var crypto=require('crypto');var jsforce=require(_0xdc18('0xa'));var deskjs=require(_0xdc18('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdc18('0xc'));var Redis=require('ioredis');var authService=require(_0xdc18('0xd'));var qs=require(_0xdc18('0xe'));var as=require(_0xdc18('0xf'));var hardwareService=require(_0xdc18('0x10'));var logger=require(_0xdc18('0x11'))(_0xdc18('0x12'));var utils=require('../../config/utils');var config=require(_0xdc18('0x13'));var licenseUtil=require(_0xdc18('0x14'));var db=require(_0xdc18('0x15'))['db'];function respondWithStatusCode(_0x3b87a2,_0x437822){_0x437822=_0x437822||0xcc;return function(_0x306ec5){if(_0x306ec5){return _0x3b87a2[_0xdc18('0x16')](_0x437822);}return _0x3b87a2[_0xdc18('0x17')](_0x437822)[_0xdc18('0x18')]();};}function respondWithResult(_0x475806,_0x13bafb){_0x13bafb=_0x13bafb||0xc8;return function(_0xced517){if(_0xced517){return _0x475806[_0xdc18('0x17')](_0x13bafb)[_0xdc18('0x19')](_0xced517);}};}function respondWithFilteredResult(_0x5f3aa7,_0x4cae97){return function(_0x173c2d){if(_0x173c2d){var _0x32d94b=typeof _0x4cae97[_0xdc18('0x1a')]===_0xdc18('0x1b')&&typeof _0x4cae97['limit']===_0xdc18('0x1b');var _0x43d991=_0x173c2d[_0xdc18('0x1c')];var _0x183cc=_0x32d94b?0x0:_0x4cae97['offset'];var _0x76ff33=_0x32d94b?_0x173c2d[_0xdc18('0x1c')]:_0x4cae97[_0xdc18('0x1a')]+_0x4cae97[_0xdc18('0x1d')];var _0x1bff9b;if(_0x76ff33>=_0x43d991){_0x76ff33=_0x43d991;_0x1bff9b=0xc8;}else{_0x1bff9b=0xce;}_0x5f3aa7['status'](_0x1bff9b);return _0x5f3aa7[_0xdc18('0x1e')](_0xdc18('0x1f'),_0x183cc+'-'+_0x76ff33+'/'+_0x43d991)['json'](_0x173c2d);}return null;};}function patchUpdates(_0x3388d7){return function(_0x181cbe){try{jsonpatch['apply'](_0x181cbe,_0x3388d7,!![]);}catch(_0x30edbf){return BPromise[_0xdc18('0x20')](_0x30edbf);}return _0x181cbe[_0xdc18('0x21')]();};}function saveUpdates(_0x4a77af,_0x2d94f4){return function(_0x27b5ee){if(_0x27b5ee){return _0x27b5ee[_0xdc18('0x22')](_0x4a77af)[_0xdc18('0x23')](function(_0x4ae68e){return _0x4ae68e;});}return null;};}function removeEntity(_0x2c027b,_0x11ec8c){return function(_0x1f2f25){if(_0x1f2f25){return _0x1f2f25['destroy']()[_0xdc18('0x23')](function(){var _0x50acf9=_0x1f2f25['get']({'plain':!![]});var _0x3435c6=_0xdc18('0x24');return db[_0xdc18('0x25')][_0xdc18('0x26')]({'where':{'type':_0x3435c6,'resourceId':_0x50acf9['id']}})[_0xdc18('0x23')](function(){return _0x1f2f25;});})[_0xdc18('0x23')](function(){_0x2c027b[_0xdc18('0x17')](0xcc)[_0xdc18('0x18')]();});}};}function handleEntityNotFound(_0x3ea409,_0x182807){return function(_0xf57838){if(!_0xf57838){_0x3ea409[_0xdc18('0x16')](0x194);}return _0xf57838;};}function handleError(_0x56371a,_0x51eac9){_0x51eac9=_0x51eac9||0x1f4;return function(_0x24b696){logger[_0xdc18('0x27')](_0x24b696[_0xdc18('0x28')]);if(_0x24b696[_0xdc18('0x29')]){delete _0x24b696[_0xdc18('0x29')];}_0x56371a[_0xdc18('0x17')](_0x51eac9)[_0xdc18('0x2a')](_0x24b696);};}exports['index']=function(_0x152bac,_0x128578){var _0x3077f1={},_0x421bf3={},_0x528784={'count':0x0,'rows':[]};var _0x57f281=_[_0xdc18('0x2b')](db[_0xdc18('0x2c')][_0xdc18('0x2d')],function(_0x137d9c){return{'name':_0x137d9c[_0xdc18('0x2e')],'type':_0x137d9c[_0xdc18('0x2f')][_0xdc18('0x30')]};});_0x421bf3['model']=_['map'](_0x57f281,_0xdc18('0x29'));_0x421bf3[_0xdc18('0x31')]=_[_0xdc18('0x32')](_0x152bac['query']);_0x421bf3[_0xdc18('0x33')]=_[_0xdc18('0x34')](_0x421bf3[_0xdc18('0x35')],_0x421bf3['query']);_0x3077f1[_0xdc18('0x36')]=_[_0xdc18('0x34')](_0x421bf3[_0xdc18('0x35')],qs[_0xdc18('0x37')](_0x152bac[_0xdc18('0x31')]['fields']));_0x3077f1[_0xdc18('0x36')]=_0x3077f1[_0xdc18('0x36')][_0xdc18('0x38')]?_0x3077f1[_0xdc18('0x36')]:_0x421bf3[_0xdc18('0x35')];if(!_0x152bac[_0xdc18('0x31')]['hasOwnProperty'](_0xdc18('0x39'))){_0x3077f1[_0xdc18('0x1d')]=qs[_0xdc18('0x1d')](_0x152bac['query']['limit']);_0x3077f1[_0xdc18('0x1a')]=qs['offset'](_0x152bac['query'][_0xdc18('0x1a')]);}_0x3077f1[_0xdc18('0x3a')]=qs[_0xdc18('0x3b')](_0x152bac['query'][_0xdc18('0x3b')]);_0x3077f1[_0xdc18('0x3c')]=qs[_0xdc18('0x33')](_['pick'](_0x152bac['query'],_0x421bf3['filters']),_0x57f281);if(_0x152bac[_0xdc18('0x31')]['filter']){_0x3077f1[_0xdc18('0x3c')]=_['merge'](_0x3077f1['where'],{'$or':_[_0xdc18('0x2b')](_0x57f281,function(_0x43b9f4){if(_0x43b9f4[_0xdc18('0x2f')]!==_0xdc18('0x3d')){var _0x27cce7={};_0x27cce7[_0x43b9f4['name']]={'$like':'%'+_0x152bac[_0xdc18('0x31')]['filter']+'%'};return _0x27cce7;}})});}_0x3077f1=_[_0xdc18('0x3e')]({},_0x3077f1,_0x152bac['options']);var _0x55f4b1={'where':_0x3077f1['where']};return db[_0xdc18('0x2c')][_0xdc18('0x1c')](_0x55f4b1)[_0xdc18('0x23')](function(_0x34edf6){_0x528784[_0xdc18('0x1c')]=_0x34edf6;if(_0x152bac['query'][_0xdc18('0x3f')]){_0x3077f1[_0xdc18('0x40')]=[{'all':!![]}];}return db[_0xdc18('0x2c')]['findAll'](_0x3077f1);})[_0xdc18('0x23')](function(_0x2ab146){_0x528784[_0xdc18('0x41')]=_0x2ab146;return _0x528784;})[_0xdc18('0x23')](respondWithFilteredResult(_0x128578,_0x3077f1))[_0xdc18('0x42')](handleError(_0x128578,null));};exports[_0xdc18('0x43')]=function(_0x38e572,_0x2b196d){var _0x7dcefe={'raw':!![],'where':{'id':_0x38e572[_0xdc18('0x44')]['id']}},_0x631083={};_0x631083['model']=_[_0xdc18('0x32')](db[_0xdc18('0x2c')][_0xdc18('0x2d')]);_0x631083[_0xdc18('0x31')]=_[_0xdc18('0x32')](_0x38e572['query']);_0x631083['filters']=_[_0xdc18('0x34')](_0x631083[_0xdc18('0x35')],_0x631083[_0xdc18('0x31')]);_0x7dcefe[_0xdc18('0x36')]=_[_0xdc18('0x34')](_0x631083[_0xdc18('0x35')],qs[_0xdc18('0x37')](_0x38e572[_0xdc18('0x31')]['fields']));_0x7dcefe['attributes']=_0x7dcefe[_0xdc18('0x36')][_0xdc18('0x38')]?_0x7dcefe[_0xdc18('0x36')]:_0x631083[_0xdc18('0x35')];if(_0x38e572[_0xdc18('0x31')][_0xdc18('0x3f')]){_0x7dcefe[_0xdc18('0x40')]=[{'all':!![]}];}_0x7dcefe=_[_0xdc18('0x3e')]({},_0x7dcefe,_0x38e572['options']);return db[_0xdc18('0x2c')][_0xdc18('0x45')](_0x7dcefe)['then'](handleEntityNotFound(_0x2b196d,null))[_0xdc18('0x23')](respondWithResult(_0x2b196d,null))[_0xdc18('0x42')](handleError(_0x2b196d,null));};exports['create']=function(_0x452e01,_0x1fc821){return db[_0xdc18('0x2c')][_0xdc18('0x46')](_0x452e01[_0xdc18('0x47')],{})['then'](function(_0x1c0fb0){var _0x29f511=_0x452e01[_0xdc18('0x48')]['get']({'plain':!![]});if(!_0x29f511)throw new Error(_0xdc18('0x49'));if(_0x29f511[_0xdc18('0x4a')]==='user'){var _0x46611e=_0x1c0fb0[_0xdc18('0x4b')]({'plain':!![]});var _0xd5a2d8=_0xdc18('0x24');return db['UserProfileSection'][_0xdc18('0x45')]({'where':{'name':_0xd5a2d8,'userProfileId':_0x29f511[_0xdc18('0x4c')]},'raw':!![]})[_0xdc18('0x23')](function(_0x15aa97){if(_0x15aa97&&_0x15aa97[_0xdc18('0x4d')]===0x0){return db[_0xdc18('0x25')][_0xdc18('0x46')]({'name':_0x46611e[_0xdc18('0x29')],'resourceId':_0x46611e['id'],'type':_0x15aa97[_0xdc18('0x29')],'sectionId':_0x15aa97['id']},{})[_0xdc18('0x23')](function(){return _0x1c0fb0;});}else{return _0x1c0fb0;}})['catch'](function(_0x57c080){logger[_0xdc18('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57c080);throw _0x57c080;});}return _0x1c0fb0;})[_0xdc18('0x23')](respondWithResult(_0x1fc821,0xc9))[_0xdc18('0x42')](handleError(_0x1fc821,null));};exports[_0xdc18('0x22')]=function(_0x2b5ac6,_0x5c7d18){if(_0x2b5ac6[_0xdc18('0x47')]['id']){delete _0x2b5ac6['body']['id'];}return db[_0xdc18('0x2c')][_0xdc18('0x45')]({'where':{'id':_0x2b5ac6[_0xdc18('0x44')]['id']}})[_0xdc18('0x23')](handleEntityNotFound(_0x5c7d18,null))[_0xdc18('0x23')](saveUpdates(_0x2b5ac6[_0xdc18('0x47')],null))['then'](respondWithResult(_0x5c7d18,null))[_0xdc18('0x42')](handleError(_0x5c7d18,null));};exports[_0xdc18('0x26')]=function(_0x381c8d,_0x4d4bb3){return db[_0xdc18('0x2c')][_0xdc18('0x45')]({'where':{'id':_0x381c8d[_0xdc18('0x44')]['id']}})[_0xdc18('0x23')](handleEntityNotFound(_0x4d4bb3,null))[_0xdc18('0x23')](removeEntity(_0x4d4bb3,null))[_0xdc18('0x42')](handleError(_0x4d4bb3,null));};
\ No newline at end of file