Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / api / voiceChanSpy / voiceChanSpy.controller.js
index 5b8261a..1c25de4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x582c=['rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','VoiceChanSpy','findAll','rows','catch','show','params','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','get','UserProfileResource','destroy','then','end','error','stack','name','send','render','merge','body','contact','message','agent','account','index'];(function(_0x485dae,_0x1213d2){var _0x2927a1=function(_0x597886){while(--_0x597886){_0x485dae['push'](_0x485dae['shift']());}};_0x2927a1(++_0x1213d2);}(_0x582c,0xdc));var _0xc582=function(_0x49beea,_0x47add1){_0x49beea=_0x49beea-0x0;var _0x27693a=_0x582c[_0x49beea];return _0x27693a;};'use strict';var emlformat=require(_0xc582('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc582('0x1'));var jsonpatch=require(_0xc582('0x2'));var rp=require('request-promise');var moment=require(_0xc582('0x3'));var BPromise=require(_0xc582('0x4'));var Mustache=require(_0xc582('0x5'));var util=require('util');var path=require(_0xc582('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc582('0x7'));var fs=require('fs');var fs_extra=require(_0xc582('0x8'));var _=require('lodash');var squel=require(_0xc582('0x9'));var crypto=require(_0xc582('0xa'));var jsforce=require(_0xc582('0xb'));var deskjs=require(_0xc582('0xc'));var toCsv=require(_0xc582('0xd'));var querystring=require('querystring');var Papa=require(_0xc582('0xe'));var Redis=require(_0xc582('0xf'));var authService=require(_0xc582('0x10'));var qs=require(_0xc582('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc582('0x12'));var logger=require(_0xc582('0x13'))(_0xc582('0x14'));var utils=require(_0xc582('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc582('0x16'));var db=require(_0xc582('0x17'))['db'];function respondWithStatusCode(_0x142bb,_0x5f5d1a){_0x5f5d1a=_0x5f5d1a||0xcc;return function(_0xf1f0f6){if(_0xf1f0f6){return _0x142bb[_0xc582('0x18')](_0x5f5d1a);}return _0x142bb[_0xc582('0x19')](_0x5f5d1a)['end']();};}function respondWithResult(_0x12de6d,_0x25eb8a){_0x25eb8a=_0x25eb8a||0xc8;return function(_0x3ae41e){if(_0x3ae41e){return _0x12de6d[_0xc582('0x19')](_0x25eb8a)['json'](_0x3ae41e);}};}function respondWithFilteredResult(_0x1b5414,_0x3336b){return function(_0x1067e6){if(_0x1067e6){var _0x3a439b=typeof _0x3336b[_0xc582('0x1a')]===_0xc582('0x1b')&&typeof _0x3336b[_0xc582('0x1c')]===_0xc582('0x1b');var _0x44a0c6=_0x1067e6['count'];var _0x15ed01=_0x3a439b?0x0:_0x3336b[_0xc582('0x1a')];var _0x18aebd=_0x3a439b?_0x1067e6[_0xc582('0x1d')]:_0x3336b[_0xc582('0x1a')]+_0x3336b[_0xc582('0x1c')];var _0x2f4707;if(_0x18aebd>=_0x44a0c6){_0x18aebd=_0x44a0c6;_0x2f4707=0xc8;}else{_0x2f4707=0xce;}_0x1b5414[_0xc582('0x19')](_0x2f4707);return _0x1b5414[_0xc582('0x1e')](_0xc582('0x1f'),_0x15ed01+'-'+_0x18aebd+'/'+_0x44a0c6)[_0xc582('0x20')](_0x1067e6);}return null;};}function patchUpdates(_0x478991){return function(_0x6e2d11){try{jsonpatch[_0xc582('0x21')](_0x6e2d11,_0x478991,!![]);}catch(_0x3f6711){return BPromise[_0xc582('0x22')](_0x3f6711);}return _0x6e2d11['save']();};}function saveUpdates(_0x2c8050,_0xeb98a3){return function(_0x5a87af){if(_0x5a87af){return _0x5a87af[_0xc582('0x23')](_0x2c8050)['then'](function(_0x19e478){return _0x19e478;});}return null;};}function removeEntity(_0x83cb83,_0x464fa3){return function(_0x3e5491){if(_0x3e5491){return _0x3e5491['destroy']()['then'](function(){var _0x44162b=_0x3e5491[_0xc582('0x24')]({'plain':!![]});var _0x30fdad='ChanSpies';return db[_0xc582('0x25')][_0xc582('0x26')]({'where':{'type':_0x30fdad,'resourceId':_0x44162b['id']}})['then'](function(){return _0x3e5491;});})[_0xc582('0x27')](function(){_0x83cb83[_0xc582('0x19')](0xcc)[_0xc582('0x28')]();});}};}function handleEntityNotFound(_0x46b289,_0x41a242){return function(_0x5351ff){if(!_0x5351ff){_0x46b289[_0xc582('0x18')](0x194);}return _0x5351ff;};}function handleError(_0x575144,_0x46235f){_0x46235f=_0x46235f||0x1f4;return function(_0x579008){logger[_0xc582('0x29')](_0x579008[_0xc582('0x2a')]);if(_0x579008[_0xc582('0x2b')]){delete _0x579008[_0xc582('0x2b')];}_0x575144[_0xc582('0x19')](_0x46235f)[_0xc582('0x2c')](_0x579008);};}function getMustacheRender(_0x321f84,_0x3d2ac4){return Mustache[_0xc582('0x2d')](_0x321f84,_[_0xc582('0x2e')](_0x3d2ac4[_0xc582('0x2f')],{'contact':_0x3d2ac4[_0xc582('0x30')],'message':_0x3d2ac4[_0xc582('0x31')],'agent':_0x3d2ac4[_0xc582('0x32')],'interaction':_0x3d2ac4['interaction'],'account':_0x3d2ac4[_0xc582('0x33')]}))||'';}exports[_0xc582('0x34')]=function(_0x3f5b66,_0x1d56be){var _0x116d0b={},_0x219c15={},_0x2e778={'count':0x0,'rows':[]};var _0x15eaa2=_['map'](db['VoiceChanSpy'][_0xc582('0x35')],function(_0x1074d2){return{'name':_0x1074d2[_0xc582('0x36')],'type':_0x1074d2[_0xc582('0x37')]['key']};});_0x219c15[_0xc582('0x38')]=_[_0xc582('0x39')](_0x15eaa2,'name');_0x219c15['query']=_[_0xc582('0x3a')](_0x3f5b66[_0xc582('0x3b')]);_0x219c15[_0xc582('0x3c')]=_[_0xc582('0x3d')](_0x219c15[_0xc582('0x38')],_0x219c15['query']);_0x116d0b['attributes']=_['intersection'](_0x219c15[_0xc582('0x38')],qs[_0xc582('0x3e')](_0x3f5b66[_0xc582('0x3b')]['fields']));_0x116d0b[_0xc582('0x3f')]=_0x116d0b['attributes'][_0xc582('0x40')]?_0x116d0b[_0xc582('0x3f')]:_0x219c15[_0xc582('0x38')];if(!_0x3f5b66[_0xc582('0x3b')]['hasOwnProperty'](_0xc582('0x41'))){_0x116d0b[_0xc582('0x1c')]=qs['limit'](_0x3f5b66['query'][_0xc582('0x1c')]);_0x116d0b[_0xc582('0x1a')]=qs[_0xc582('0x1a')](_0x3f5b66[_0xc582('0x3b')][_0xc582('0x1a')]);}_0x116d0b[_0xc582('0x42')]=qs[_0xc582('0x43')](_0x3f5b66[_0xc582('0x3b')]['sort']);_0x116d0b['where']=qs[_0xc582('0x3c')](_[_0xc582('0x44')](_0x3f5b66[_0xc582('0x3b')],_0x219c15['filters']),_0x15eaa2);if(_0x3f5b66[_0xc582('0x3b')][_0xc582('0x45')]){_0x116d0b[_0xc582('0x46')]=_[_0xc582('0x2e')](_0x116d0b[_0xc582('0x46')],{'$or':_[_0xc582('0x39')](_0x15eaa2,function(_0xeba8e6){if(_0xeba8e6[_0xc582('0x37')]!==_0xc582('0x47')){var _0x5ceff5={};_0x5ceff5[_0xeba8e6[_0xc582('0x2b')]]={'$like':'%'+_0x3f5b66[_0xc582('0x3b')][_0xc582('0x45')]+'%'};return _0x5ceff5;}})});}_0x116d0b=_[_0xc582('0x2e')]({},_0x116d0b,_0x3f5b66[_0xc582('0x48')]);var _0x4a82d1={'where':_0x116d0b[_0xc582('0x46')]};return db['VoiceChanSpy'][_0xc582('0x1d')](_0x4a82d1)[_0xc582('0x27')](function(_0x70fea4){_0x2e778['count']=_0x70fea4;if(_0x3f5b66['query'][_0xc582('0x49')]){_0x116d0b[_0xc582('0x4a')]=[{'all':!![]}];}return db[_0xc582('0x4b')][_0xc582('0x4c')](_0x116d0b);})[_0xc582('0x27')](function(_0x464de0){_0x2e778[_0xc582('0x4d')]=_0x464de0;return _0x2e778;})[_0xc582('0x27')](respondWithFilteredResult(_0x1d56be,_0x116d0b))[_0xc582('0x4e')](handleError(_0x1d56be,null));};exports[_0xc582('0x4f')]=function(_0xeb3662,_0x28b377){var _0x59fff9={'raw':![],'where':{'id':_0xeb3662[_0xc582('0x50')]['id']}},_0x5d5b80={};_0x5d5b80[_0xc582('0x38')]=_[_0xc582('0x3a')](db[_0xc582('0x4b')][_0xc582('0x35')]);_0x5d5b80[_0xc582('0x3b')]=_['keys'](_0xeb3662[_0xc582('0x3b')]);_0x5d5b80[_0xc582('0x3c')]=_[_0xc582('0x3d')](_0x5d5b80[_0xc582('0x38')],_0x5d5b80['query']);_0x59fff9['attributes']=_['intersection'](_0x5d5b80[_0xc582('0x38')],qs[_0xc582('0x3e')](_0xeb3662[_0xc582('0x3b')][_0xc582('0x3e')]));_0x59fff9[_0xc582('0x3f')]=_0x59fff9[_0xc582('0x3f')][_0xc582('0x40')]?_0x59fff9[_0xc582('0x3f')]:_0x5d5b80[_0xc582('0x38')];if(_0xeb3662[_0xc582('0x3b')][_0xc582('0x49')]){_0x59fff9[_0xc582('0x4a')]=[{'all':!![]}];}_0x59fff9=_[_0xc582('0x2e')]({},_0x59fff9,_0xeb3662[_0xc582('0x48')]);return db['VoiceChanSpy']['find'](_0x59fff9)[_0xc582('0x27')](handleEntityNotFound(_0x28b377,null))[_0xc582('0x27')](respondWithResult(_0x28b377,null))['catch'](handleError(_0x28b377,null));};exports[_0xc582('0x51')]=function(_0x4acc99,_0x1ea313){return db[_0xc582('0x4b')][_0xc582('0x51')](_0x4acc99[_0xc582('0x2f')],{})['then'](function(_0x45270){var _0x282602=_0x4acc99['user'][_0xc582('0x24')]({'plain':!![]});if(!_0x282602)throw new Error(_0xc582('0x52'));if(_0x282602[_0xc582('0x53')]===_0xc582('0x54')){var _0x3188d5=_0x45270[_0xc582('0x24')]({'plain':!![]});var _0xf2d2c2=_0xc582('0x55');return db[_0xc582('0x56')][_0xc582('0x57')]({'where':{'name':_0xf2d2c2,'userProfileId':_0x282602[_0xc582('0x58')]},'raw':!![]})[_0xc582('0x27')](function(_0xd166bc){if(_0xd166bc&&_0xd166bc[_0xc582('0x59')]===0x0){return db['UserProfileResource'][_0xc582('0x51')]({'name':_0x3188d5[_0xc582('0x2b')],'resourceId':_0x3188d5['id'],'type':_0xd166bc[_0xc582('0x2b')],'sectionId':_0xd166bc['id']},{})[_0xc582('0x27')](function(){return _0x45270;});}else{return _0x45270;}})['catch'](function(_0x130096){logger['error'](_0xc582('0x5a'),_0x130096);throw _0x130096;});}return _0x45270;})[_0xc582('0x27')](respondWithResult(_0x1ea313,0xc9))[_0xc582('0x4e')](handleError(_0x1ea313,null));};exports['update']=function(_0x29c93f,_0x1f2a6c){if(_0x29c93f[_0xc582('0x2f')]['id']){delete _0x29c93f[_0xc582('0x2f')]['id'];}return db['VoiceChanSpy'][_0xc582('0x57')]({'where':{'id':_0x29c93f[_0xc582('0x50')]['id']}})['then'](handleEntityNotFound(_0x1f2a6c,null))['then'](saveUpdates(_0x29c93f[_0xc582('0x2f')],null))[_0xc582('0x27')](respondWithResult(_0x1f2a6c,null))[_0xc582('0x4e')](handleError(_0x1f2a6c,null));};exports[_0xc582('0x26')]=function(_0x4b9179,_0x2ebe63){return db[_0xc582('0x4b')][_0xc582('0x57')]({'where':{'id':_0x4b9179[_0xc582('0x50')]['id']}})['then'](handleEntityNotFound(_0x2ebe63,null))[_0xc582('0x27')](removeEntity(_0x2ebe63,null))[_0xc582('0x4e')](handleError(_0x2ebe63,null));};
\ No newline at end of file
+var _0x45ff=['UserProfileResource','error','name','send','merge','body','contact','message','agent','interaction','account','index','map','VoiceChanSpy','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','keys','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies'];(function(_0x81480d,_0x44cb9a){var _0x26d57f=function(_0x158e6b){while(--_0x158e6b){_0x81480d['push'](_0x81480d['shift']());}};_0x26d57f(++_0x44cb9a);}(_0x45ff,0xe1));var _0xf45f=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x45ff[_0x3747ae];return _0x339035;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf45f('0x0'));var zipdir=require(_0xf45f('0x1'));var jsonpatch=require(_0xf45f('0x2'));var rp=require(_0xf45f('0x3'));var moment=require('moment');var BPromise=require(_0xf45f('0x4'));var Mustache=require(_0xf45f('0x5'));var util=require(_0xf45f('0x6'));var path=require(_0xf45f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf45f('0x8'));var fs=require('fs');var fs_extra=require(_0xf45f('0x9'));var _=require(_0xf45f('0xa'));var squel=require(_0xf45f('0xb'));var crypto=require(_0xf45f('0xc'));var jsforce=require(_0xf45f('0xd'));var deskjs=require(_0xf45f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf45f('0xf'));var authService=require(_0xf45f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf45f('0x11'));var hardwareService=require(_0xf45f('0x12'));var logger=require(_0xf45f('0x13'))(_0xf45f('0x14'));var utils=require(_0xf45f('0x15'));var config=require(_0xf45f('0x16'));var licenseUtil=require(_0xf45f('0x17'));var db=require(_0xf45f('0x18'))['db'];function respondWithStatusCode(_0x31aa9b,_0x1bc94e){_0x1bc94e=_0x1bc94e||0xcc;return function(_0x4599d2){if(_0x4599d2){return _0x31aa9b[_0xf45f('0x19')](_0x1bc94e);}return _0x31aa9b[_0xf45f('0x1a')](_0x1bc94e)[_0xf45f('0x1b')]();};}function respondWithResult(_0x7a4931,_0x5061d4){_0x5061d4=_0x5061d4||0xc8;return function(_0x504802){if(_0x504802){return _0x7a4931[_0xf45f('0x1a')](_0x5061d4)[_0xf45f('0x1c')](_0x504802);}};}function respondWithFilteredResult(_0x4b6c06,_0x13fefc){return function(_0x599f37){if(_0x599f37){var _0x1c3a18=typeof _0x13fefc[_0xf45f('0x1d')]===_0xf45f('0x1e')&&typeof _0x13fefc[_0xf45f('0x1f')]===_0xf45f('0x1e');var _0xa1dbc7=_0x599f37[_0xf45f('0x20')];var _0x4a192b=_0x1c3a18?0x0:_0x13fefc['offset'];var _0x4ba4b6=_0x1c3a18?_0x599f37[_0xf45f('0x20')]:_0x13fefc['offset']+_0x13fefc[_0xf45f('0x1f')];var _0x3a6d9c;if(_0x4ba4b6>=_0xa1dbc7){_0x4ba4b6=_0xa1dbc7;_0x3a6d9c=0xc8;}else{_0x3a6d9c=0xce;}_0x4b6c06[_0xf45f('0x1a')](_0x3a6d9c);return _0x4b6c06['set'](_0xf45f('0x21'),_0x4a192b+'-'+_0x4ba4b6+'/'+_0xa1dbc7)[_0xf45f('0x1c')](_0x599f37);}return null;};}function patchUpdates(_0x2e7420){return function(_0xb72ccc){try{jsonpatch[_0xf45f('0x22')](_0xb72ccc,_0x2e7420,!![]);}catch(_0x21d0bb){return BPromise[_0xf45f('0x23')](_0x21d0bb);}return _0xb72ccc[_0xf45f('0x24')]();};}function saveUpdates(_0xd3699,_0x31cfe2){return function(_0x1d3ff7){if(_0x1d3ff7){return _0x1d3ff7[_0xf45f('0x25')](_0xd3699)[_0xf45f('0x26')](function(_0x2630cf){return _0x2630cf;});}return null;};}function removeEntity(_0x1c4368,_0x48a9a5){return function(_0x57fb8a){if(_0x57fb8a){return _0x57fb8a[_0xf45f('0x27')]()[_0xf45f('0x26')](function(){var _0x1eacc4=_0x57fb8a[_0xf45f('0x28')]({'plain':!![]});var _0x5e6b76=_0xf45f('0x29');return db[_0xf45f('0x2a')][_0xf45f('0x27')]({'where':{'type':_0x5e6b76,'resourceId':_0x1eacc4['id']}})[_0xf45f('0x26')](function(){return _0x57fb8a;});})[_0xf45f('0x26')](function(){_0x1c4368[_0xf45f('0x1a')](0xcc)[_0xf45f('0x1b')]();});}};}function handleEntityNotFound(_0x30116e,_0x61e572){return function(_0xf2e1c){if(!_0xf2e1c){_0x30116e[_0xf45f('0x19')](0x194);}return _0xf2e1c;};}function handleError(_0x3264a3,_0x28071c){_0x28071c=_0x28071c||0x1f4;return function(_0x3fb7af){logger[_0xf45f('0x2b')](_0x3fb7af['stack']);if(_0x3fb7af[_0xf45f('0x2c')]){delete _0x3fb7af[_0xf45f('0x2c')];}_0x3264a3[_0xf45f('0x1a')](_0x28071c)[_0xf45f('0x2d')](_0x3fb7af);};}function getMustacheRender(_0x26a305,_0x5e10d1){return Mustache['render'](_0x26a305,_[_0xf45f('0x2e')](_0x5e10d1[_0xf45f('0x2f')],{'contact':_0x5e10d1[_0xf45f('0x30')],'message':_0x5e10d1[_0xf45f('0x31')],'agent':_0x5e10d1[_0xf45f('0x32')],'interaction':_0x5e10d1[_0xf45f('0x33')],'account':_0x5e10d1[_0xf45f('0x34')]}))||'';}exports[_0xf45f('0x35')]=function(_0x2143c5,_0x4cb1c5){var _0x2d2650={},_0xb72378={},_0x5576fa={'count':0x0,'rows':[]};var _0xa74eb1=_[_0xf45f('0x36')](db[_0xf45f('0x37')]['rawAttributes'],function(_0x2044a7){return{'name':_0x2044a7[_0xf45f('0x38')],'type':_0x2044a7[_0xf45f('0x39')][_0xf45f('0x3a')]};});_0xb72378['model']=_[_0xf45f('0x36')](_0xa74eb1,_0xf45f('0x2c'));_0xb72378[_0xf45f('0x3b')]=_['keys'](_0x2143c5[_0xf45f('0x3b')]);_0xb72378[_0xf45f('0x3c')]=_['intersection'](_0xb72378[_0xf45f('0x3d')],_0xb72378[_0xf45f('0x3b')]);_0x2d2650['attributes']=_[_0xf45f('0x3e')](_0xb72378['model'],qs[_0xf45f('0x3f')](_0x2143c5[_0xf45f('0x3b')]['fields']));_0x2d2650[_0xf45f('0x40')]=_0x2d2650[_0xf45f('0x40')][_0xf45f('0x41')]?_0x2d2650['attributes']:_0xb72378[_0xf45f('0x3d')];if(!_0x2143c5[_0xf45f('0x3b')][_0xf45f('0x42')](_0xf45f('0x43'))){_0x2d2650['limit']=qs[_0xf45f('0x1f')](_0x2143c5[_0xf45f('0x3b')][_0xf45f('0x1f')]);_0x2d2650[_0xf45f('0x1d')]=qs[_0xf45f('0x1d')](_0x2143c5[_0xf45f('0x3b')][_0xf45f('0x1d')]);}_0x2d2650[_0xf45f('0x44')]=qs[_0xf45f('0x45')](_0x2143c5['query'][_0xf45f('0x45')]);_0x2d2650['where']=qs[_0xf45f('0x3c')](_[_0xf45f('0x46')](_0x2143c5[_0xf45f('0x3b')],_0xb72378[_0xf45f('0x3c')]),_0xa74eb1);if(_0x2143c5[_0xf45f('0x3b')]['filter']){_0x2d2650['where']=_[_0xf45f('0x2e')](_0x2d2650[_0xf45f('0x47')],{'$or':_['map'](_0xa74eb1,function(_0x26ea88){if(_0x26ea88['type']!=='VIRTUAL'){var _0x146b03={};_0x146b03[_0x26ea88['name']]={'$like':'%'+_0x2143c5[_0xf45f('0x3b')][_0xf45f('0x48')]+'%'};return _0x146b03;}})});}_0x2d2650=_['merge']({},_0x2d2650,_0x2143c5[_0xf45f('0x49')]);var _0x2c66d1={'where':_0x2d2650[_0xf45f('0x47')]};return db[_0xf45f('0x37')][_0xf45f('0x20')](_0x2c66d1)[_0xf45f('0x26')](function(_0x499c85){_0x5576fa[_0xf45f('0x20')]=_0x499c85;if(_0x2143c5['query'][_0xf45f('0x4a')]){_0x2d2650[_0xf45f('0x4b')]=[{'all':!![]}];}return db[_0xf45f('0x37')]['findAll'](_0x2d2650);})[_0xf45f('0x26')](function(_0x4b8fe8){_0x5576fa[_0xf45f('0x4c')]=_0x4b8fe8;return _0x5576fa;})[_0xf45f('0x26')](respondWithFilteredResult(_0x4cb1c5,_0x2d2650))[_0xf45f('0x4d')](handleError(_0x4cb1c5,null));};exports[_0xf45f('0x4e')]=function(_0x595d85,_0xa34a0){var _0x17e3db={'raw':![],'where':{'id':_0x595d85[_0xf45f('0x4f')]['id']}},_0x1dd2a3={};_0x1dd2a3[_0xf45f('0x3d')]=_['keys'](db[_0xf45f('0x37')][_0xf45f('0x50')]);_0x1dd2a3[_0xf45f('0x3b')]=_[_0xf45f('0x51')](_0x595d85[_0xf45f('0x3b')]);_0x1dd2a3[_0xf45f('0x3c')]=_[_0xf45f('0x3e')](_0x1dd2a3['model'],_0x1dd2a3[_0xf45f('0x3b')]);_0x17e3db['attributes']=_[_0xf45f('0x3e')](_0x1dd2a3['model'],qs['fields'](_0x595d85['query'][_0xf45f('0x3f')]));_0x17e3db[_0xf45f('0x40')]=_0x17e3db[_0xf45f('0x40')][_0xf45f('0x41')]?_0x17e3db[_0xf45f('0x40')]:_0x1dd2a3[_0xf45f('0x3d')];if(_0x595d85[_0xf45f('0x3b')][_0xf45f('0x4a')]){_0x17e3db[_0xf45f('0x4b')]=[{'all':!![]}];}_0x17e3db=_[_0xf45f('0x2e')]({},_0x17e3db,_0x595d85[_0xf45f('0x49')]);return db[_0xf45f('0x37')][_0xf45f('0x52')](_0x17e3db)[_0xf45f('0x26')](handleEntityNotFound(_0xa34a0,null))[_0xf45f('0x26')](respondWithResult(_0xa34a0,null))[_0xf45f('0x4d')](handleError(_0xa34a0,null));};exports['create']=function(_0x34d09a,_0x4ac6ff){return db[_0xf45f('0x37')]['create'](_0x34d09a['body'],{})['then'](function(_0x65f1cc){var _0x4212c0=_0x34d09a[_0xf45f('0x53')][_0xf45f('0x28')]({'plain':!![]});if(!_0x4212c0)throw new Error(_0xf45f('0x54'));if(_0x4212c0['role']===_0xf45f('0x53')){var _0xedbb6d=_0x65f1cc[_0xf45f('0x28')]({'plain':!![]});var _0x5a0c64=_0xf45f('0x29');return db[_0xf45f('0x55')]['find']({'where':{'name':_0x5a0c64,'userProfileId':_0x4212c0[_0xf45f('0x56')]},'raw':!![]})['then'](function(_0x183c0e){if(_0x183c0e&&_0x183c0e[_0xf45f('0x57')]===0x0){return db[_0xf45f('0x2a')][_0xf45f('0x58')]({'name':_0xedbb6d['name'],'resourceId':_0xedbb6d['id'],'type':_0x183c0e['name'],'sectionId':_0x183c0e['id']},{})[_0xf45f('0x26')](function(){return _0x65f1cc;});}else{return _0x65f1cc;}})[_0xf45f('0x4d')](function(_0x3a99d3){logger[_0xf45f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a99d3);throw _0x3a99d3;});}return _0x65f1cc;})[_0xf45f('0x26')](respondWithResult(_0x4ac6ff,0xc9))[_0xf45f('0x4d')](handleError(_0x4ac6ff,null));};exports['update']=function(_0x379fd0,_0x44bdca){if(_0x379fd0[_0xf45f('0x2f')]['id']){delete _0x379fd0['body']['id'];}return db[_0xf45f('0x37')]['find']({'where':{'id':_0x379fd0[_0xf45f('0x4f')]['id']}})[_0xf45f('0x26')](handleEntityNotFound(_0x44bdca,null))[_0xf45f('0x26')](saveUpdates(_0x379fd0[_0xf45f('0x2f')],null))[_0xf45f('0x26')](respondWithResult(_0x44bdca,null))[_0xf45f('0x4d')](handleError(_0x44bdca,null));};exports['destroy']=function(_0x3e1cfb,_0x3faf83){return db[_0xf45f('0x37')]['find']({'where':{'id':_0x3e1cfb['params']['id']}})[_0xf45f('0x26')](handleEntityNotFound(_0x3faf83,null))[_0xf45f('0x26')](removeEntity(_0x3faf83,null))[_0xf45f('0x4d')](handleError(_0x3faf83,null));};
\ No newline at end of file