Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / api / contactItemType / contactItemType.controller.js
index c555d25..d8ccb73 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x348f=['Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy','UserProfileResource','error','stack','name','send','merge','body','contact','interaction','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','options','findAll','catch','show','params','include','ContactItemType','create','user'];(function(_0x81548b,_0x4c19c0){var _0x270149=function(_0x5948d1){while(--_0x5948d1){_0x81548b['push'](_0x81548b['shift']());}};_0x270149(++_0x4c19c0);}(_0x348f,0xa6));var _0xf348=function(_0x503b1c,_0x108080){_0x503b1c=_0x503b1c-0x0;var _0x1d9664=_0x348f[_0x503b1c];return _0x1d9664;};'use strict';var emlformat=require(_0xf348('0x0'));var rimraf=require(_0xf348('0x1'));var zipdir=require(_0xf348('0x2'));var jsonpatch=require(_0xf348('0x3'));var rp=require(_0xf348('0x4'));var moment=require(_0xf348('0x5'));var BPromise=require(_0xf348('0x6'));var Mustache=require(_0xf348('0x7'));var util=require(_0xf348('0x8'));var path=require(_0xf348('0x9'));var sox=require(_0xf348('0xa'));var csv=require(_0xf348('0xb'));var ejs=require(_0xf348('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf348('0xd'));var deskjs=require(_0xf348('0xe'));var toCsv=require(_0xf348('0xb'));var querystring=require(_0xf348('0xf'));var Papa=require(_0xf348('0x10'));var Redis=require(_0xf348('0x11'));var authService=require(_0xf348('0x12'));var qs=require(_0xf348('0x13'));var as=require(_0xf348('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf348('0x15'))(_0xf348('0x16'));var utils=require('../../config/utils');var config=require(_0xf348('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf348('0x18'))['db'];function respondWithStatusCode(_0x186139,_0x5f5b4d){_0x5f5b4d=_0x5f5b4d||0xcc;return function(_0x2283b4){if(_0x2283b4){return _0x186139[_0xf348('0x19')](_0x5f5b4d);}return _0x186139[_0xf348('0x1a')](_0x5f5b4d)[_0xf348('0x1b')]();};}function respondWithResult(_0x3de1c1,_0x49b81e){_0x49b81e=_0x49b81e||0xc8;return function(_0x1ff00a){if(_0x1ff00a){return _0x3de1c1['status'](_0x49b81e)[_0xf348('0x1c')](_0x1ff00a);}};}function respondWithFilteredResult(_0x2c8cb1,_0xc7c5a5){return function(_0x11600c){if(_0x11600c){var _0x1e4927=typeof _0xc7c5a5[_0xf348('0x1d')]==='undefined'&&typeof _0xc7c5a5[_0xf348('0x1e')]===_0xf348('0x1f');var _0x7a299e=_0x11600c[_0xf348('0x20')];var _0x41dafe=_0x1e4927?0x0:_0xc7c5a5[_0xf348('0x1d')];var _0x1ee6f3=_0x1e4927?_0x11600c[_0xf348('0x20')]:_0xc7c5a5[_0xf348('0x1d')]+_0xc7c5a5[_0xf348('0x1e')];var _0x2a3afa;if(_0x1ee6f3>=_0x7a299e){_0x1ee6f3=_0x7a299e;_0x2a3afa=0xc8;}else{_0x2a3afa=0xce;}_0x2c8cb1[_0xf348('0x1a')](_0x2a3afa);return _0x2c8cb1['set'](_0xf348('0x21'),_0x41dafe+'-'+_0x1ee6f3+'/'+_0x7a299e)[_0xf348('0x1c')](_0x11600c);}return null;};}function patchUpdates(_0x69e6ba){return function(_0x2ff208){try{jsonpatch['apply'](_0x2ff208,_0x69e6ba,!![]);}catch(_0x1ffd18){return BPromise['reject'](_0x1ffd18);}return _0x2ff208['save']();};}function saveUpdates(_0x399c95,_0x3f69a5){return function(_0x4ead34){if(_0x4ead34){return _0x4ead34[_0xf348('0x22')](_0x399c95)[_0xf348('0x23')](function(_0x5247b1){return _0x5247b1;});}return null;};}function removeEntity(_0x59f515,_0x29812b){return function(_0x29ba1a){if(_0x29ba1a){return _0x29ba1a[_0xf348('0x24')]()[_0xf348('0x23')](function(){var _0x16890c=_0x29ba1a['get']({'plain':!![]});var _0x48f1df='ContactItemTypes';return db[_0xf348('0x25')][_0xf348('0x24')]({'where':{'type':_0x48f1df,'resourceId':_0x16890c['id']}})[_0xf348('0x23')](function(){return _0x29ba1a;});})[_0xf348('0x23')](function(){_0x59f515[_0xf348('0x1a')](0xcc)[_0xf348('0x1b')]();});}};}function handleEntityNotFound(_0x5b22fb,_0x5430bd){return function(_0x237bf9){if(!_0x237bf9){_0x5b22fb[_0xf348('0x19')](0x194);}return _0x237bf9;};}function handleError(_0x2e682f,_0x4deb77){_0x4deb77=_0x4deb77||0x1f4;return function(_0x1ba972){logger[_0xf348('0x26')](_0x1ba972[_0xf348('0x27')]);if(_0x1ba972[_0xf348('0x28')]){delete _0x1ba972[_0xf348('0x28')];}_0x2e682f[_0xf348('0x1a')](_0x4deb77)[_0xf348('0x29')](_0x1ba972);};}function getMustacheRender(_0x127ede,_0x4bc801){return Mustache['render'](_0x127ede,_[_0xf348('0x2a')](_0x4bc801[_0xf348('0x2b')],{'contact':_0x4bc801[_0xf348('0x2c')],'message':_0x4bc801['message'],'agent':_0x4bc801['agent'],'interaction':_0x4bc801[_0xf348('0x2d')],'account':_0x4bc801['account']}))||'';}exports[_0xf348('0x2e')]=function(_0x1414ad,_0x2feea9){var _0xc5a204={},_0x56f454={},_0x5d61a9={'count':0x0,'rows':[]};var _0x2ecb36=_[_0xf348('0x2f')](db['ContactItemType'][_0xf348('0x30')],function(_0x5ce00d){return{'name':_0x5ce00d['fieldName'],'type':_0x5ce00d['type'][_0xf348('0x31')]};});_0x56f454[_0xf348('0x32')]=_[_0xf348('0x2f')](_0x2ecb36,_0xf348('0x28'));_0x56f454[_0xf348('0x33')]=_[_0xf348('0x34')](_0x1414ad['query']);_0x56f454[_0xf348('0x35')]=_[_0xf348('0x36')](_0x56f454[_0xf348('0x32')],_0x56f454['query']);_0xc5a204[_0xf348('0x37')]=_['intersection'](_0x56f454[_0xf348('0x32')],qs['fields'](_0x1414ad[_0xf348('0x33')][_0xf348('0x38')]));_0xc5a204[_0xf348('0x37')]=_0xc5a204['attributes'][_0xf348('0x39')]?_0xc5a204[_0xf348('0x37')]:_0x56f454[_0xf348('0x32')];if(!_0x1414ad[_0xf348('0x33')][_0xf348('0x3a')](_0xf348('0x3b'))){_0xc5a204[_0xf348('0x1e')]=qs[_0xf348('0x1e')](_0x1414ad[_0xf348('0x33')][_0xf348('0x1e')]);_0xc5a204[_0xf348('0x1d')]=qs[_0xf348('0x1d')](_0x1414ad[_0xf348('0x33')]['offset']);}_0xc5a204[_0xf348('0x3c')]=qs['sort'](_0x1414ad[_0xf348('0x33')]['sort']);_0xc5a204[_0xf348('0x3d')]=qs[_0xf348('0x35')](_[_0xf348('0x3e')](_0x1414ad[_0xf348('0x33')],_0x56f454[_0xf348('0x35')]),_0x2ecb36);if(_0x1414ad['query'][_0xf348('0x3f')]){_0xc5a204['where']=_[_0xf348('0x2a')](_0xc5a204['where'],{'$or':_['map'](_0x2ecb36,function(_0x372859){if(_0x372859['type']!==_0xf348('0x40')){var _0x26fffe={};_0x26fffe[_0x372859[_0xf348('0x28')]]={'$like':'%'+_0x1414ad[_0xf348('0x33')][_0xf348('0x3f')]+'%'};return _0x26fffe;}})});}_0xc5a204=_[_0xf348('0x2a')]({},_0xc5a204,_0x1414ad[_0xf348('0x41')]);var _0x1403cd={'where':_0xc5a204[_0xf348('0x3d')]};return db['ContactItemType']['count'](_0x1403cd)['then'](function(_0x59fd33){_0x5d61a9[_0xf348('0x20')]=_0x59fd33;if(_0x1414ad[_0xf348('0x33')]['includeAll']){_0xc5a204['include']=[{'all':!![]}];}return db['ContactItemType'][_0xf348('0x42')](_0xc5a204);})[_0xf348('0x23')](function(_0x12d60a){_0x5d61a9['rows']=_0x12d60a;return _0x5d61a9;})[_0xf348('0x23')](respondWithFilteredResult(_0x2feea9,_0xc5a204))[_0xf348('0x43')](handleError(_0x2feea9,null));};exports[_0xf348('0x44')]=function(_0x467e4a,_0x57ae31){var _0x2ef142={'raw':!![],'where':{'id':_0x467e4a[_0xf348('0x45')]['id']}},_0x518071={};_0x518071[_0xf348('0x32')]=_[_0xf348('0x34')](db['ContactItemType']['rawAttributes']);_0x518071[_0xf348('0x33')]=_[_0xf348('0x34')](_0x467e4a['query']);_0x518071[_0xf348('0x35')]=_[_0xf348('0x36')](_0x518071['model'],_0x518071['query']);_0x2ef142[_0xf348('0x37')]=_[_0xf348('0x36')](_0x518071[_0xf348('0x32')],qs[_0xf348('0x38')](_0x467e4a[_0xf348('0x33')][_0xf348('0x38')]));_0x2ef142['attributes']=_0x2ef142[_0xf348('0x37')][_0xf348('0x39')]?_0x2ef142['attributes']:_0x518071[_0xf348('0x32')];if(_0x467e4a[_0xf348('0x33')]['includeAll']){_0x2ef142[_0xf348('0x46')]=[{'all':!![]}];}_0x2ef142=_[_0xf348('0x2a')]({},_0x2ef142,_0x467e4a[_0xf348('0x41')]);return db[_0xf348('0x47')]['find'](_0x2ef142)[_0xf348('0x23')](handleEntityNotFound(_0x57ae31,null))[_0xf348('0x23')](respondWithResult(_0x57ae31,null))['catch'](handleError(_0x57ae31,null));};exports[_0xf348('0x48')]=function(_0x5f34cc,_0x1ce205){return db[_0xf348('0x47')][_0xf348('0x48')](_0x5f34cc['body'],{})[_0xf348('0x23')](function(_0x27ebe5){var _0x38c850=_0x5f34cc[_0xf348('0x49')]['get']({'plain':!![]});if(!_0x38c850)throw new Error(_0xf348('0x4a'));if(_0x38c850['role']===_0xf348('0x49')){var _0x3f57ec=_0x27ebe5[_0xf348('0x4b')]({'plain':!![]});var _0x304d23='ContactItemTypes';return db[_0xf348('0x4c')]['find']({'where':{'name':_0x304d23,'userProfileId':_0x38c850[_0xf348('0x4d')]},'raw':!![]})[_0xf348('0x23')](function(_0xa2e506){if(_0xa2e506&&_0xa2e506['autoAssociation']===0x0){return db[_0xf348('0x25')][_0xf348('0x48')]({'name':_0x3f57ec[_0xf348('0x28')],'resourceId':_0x3f57ec['id'],'type':_0xa2e506[_0xf348('0x28')],'sectionId':_0xa2e506['id']},{})[_0xf348('0x23')](function(){return _0x27ebe5;});}else{return _0x27ebe5;}})[_0xf348('0x43')](function(_0x33d4cc){logger['error'](_0xf348('0x4e'),_0x33d4cc);throw _0x33d4cc;});}return _0x27ebe5;})[_0xf348('0x23')](respondWithResult(_0x1ce205,0xc9))[_0xf348('0x43')](handleError(_0x1ce205,null));};exports[_0xf348('0x22')]=function(_0x54003b,_0x42d61a){if(_0x54003b[_0xf348('0x2b')]['id']){delete _0x54003b[_0xf348('0x2b')]['id'];}return db['ContactItemType'][_0xf348('0x4f')]({'where':{'id':_0x54003b[_0xf348('0x45')]['id']}})[_0xf348('0x23')](handleEntityNotFound(_0x42d61a,null))['then'](saveUpdates(_0x54003b[_0xf348('0x2b')],null))[_0xf348('0x23')](respondWithResult(_0x42d61a,null))['catch'](handleError(_0x42d61a,null));};exports[_0xf348('0x24')]=function(_0x5bb889,_0x506886){return db[_0xf348('0x47')][_0xf348('0x4f')]({'where':{'id':_0x5bb889['params']['id']}})[_0xf348('0x23')](handleEntityNotFound(_0x506886,null))[_0xf348('0x23')](removeEntity(_0x506886,null))[_0xf348('0x43')](handleError(_0x506886,null));};
\ No newline at end of file
+var _0x7763=['filter','options','ContactItemType','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','render','merge','message','interaction','index','map','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where'];(function(_0x18c08a,_0x46e340){var _0x388429=function(_0x27d239){while(--_0x27d239){_0x18c08a['push'](_0x18c08a['shift']());}};_0x388429(++_0x46e340);}(_0x7763,0x15d));var _0x3776=function(_0x2749a4,_0x1af2db){_0x2749a4=_0x2749a4-0x0;var _0x4c44d7=_0x7763[_0x2749a4];return _0x4c44d7;};'use strict';var emlformat=require(_0x3776('0x0'));var rimraf=require(_0x3776('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3776('0x2'));var rp=require(_0x3776('0x3'));var moment=require('moment');var BPromise=require(_0x3776('0x4'));var Mustache=require('mustache');var util=require(_0x3776('0x5'));var path=require(_0x3776('0x6'));var sox=require(_0x3776('0x7'));var csv=require(_0x3776('0x8'));var ejs=require(_0x3776('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3776('0xa'));var squel=require(_0x3776('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3776('0x8'));var querystring=require(_0x3776('0xc'));var Papa=require(_0x3776('0xd'));var Redis=require(_0x3776('0xe'));var authService=require(_0x3776('0xf'));var qs=require(_0x3776('0x10'));var as=require(_0x3776('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3776('0x12'))(_0x3776('0x13'));var utils=require('../../config/utils');var config=require(_0x3776('0x14'));var licenseUtil=require(_0x3776('0x15'));var db=require(_0x3776('0x16'))['db'];function respondWithStatusCode(_0x39c711,_0x40555e){_0x40555e=_0x40555e||0xcc;return function(_0x45b216){if(_0x45b216){return _0x39c711[_0x3776('0x17')](_0x40555e);}return _0x39c711[_0x3776('0x18')](_0x40555e)[_0x3776('0x19')]();};}function respondWithResult(_0x311494,_0x15c3a9){_0x15c3a9=_0x15c3a9||0xc8;return function(_0x5bf4a0){if(_0x5bf4a0){return _0x311494[_0x3776('0x18')](_0x15c3a9)[_0x3776('0x1a')](_0x5bf4a0);}};}function respondWithFilteredResult(_0x7a1200,_0x8ae292){return function(_0x18ef75){if(_0x18ef75){var _0x851a63=typeof _0x8ae292[_0x3776('0x1b')]==='undefined'&&typeof _0x8ae292['limit']==='undefined';var _0x4df89c=_0x18ef75[_0x3776('0x1c')];var _0x5eb62e=_0x851a63?0x0:_0x8ae292[_0x3776('0x1b')];var _0x535e2c=_0x851a63?_0x18ef75[_0x3776('0x1c')]:_0x8ae292[_0x3776('0x1b')]+_0x8ae292[_0x3776('0x1d')];var _0x407329;if(_0x535e2c>=_0x4df89c){_0x535e2c=_0x4df89c;_0x407329=0xc8;}else{_0x407329=0xce;}_0x7a1200[_0x3776('0x18')](_0x407329);return _0x7a1200[_0x3776('0x1e')](_0x3776('0x1f'),_0x5eb62e+'-'+_0x535e2c+'/'+_0x4df89c)[_0x3776('0x1a')](_0x18ef75);}return null;};}function patchUpdates(_0x5df116){return function(_0x2ef45f){try{jsonpatch['apply'](_0x2ef45f,_0x5df116,!![]);}catch(_0x589491){return BPromise[_0x3776('0x20')](_0x589491);}return _0x2ef45f[_0x3776('0x21')]();};}function saveUpdates(_0x3b2165,_0x1875b3){return function(_0x39f396){if(_0x39f396){return _0x39f396[_0x3776('0x22')](_0x3b2165)[_0x3776('0x23')](function(_0x83a8a0){return _0x83a8a0;});}return null;};}function removeEntity(_0x5d3b34,_0x461ebd){return function(_0xc4ca4c){if(_0xc4ca4c){return _0xc4ca4c[_0x3776('0x24')]()['then'](function(){var _0x100252=_0xc4ca4c['get']({'plain':!![]});var _0x124f7c='ContactItemTypes';return db[_0x3776('0x25')][_0x3776('0x24')]({'where':{'type':_0x124f7c,'resourceId':_0x100252['id']}})[_0x3776('0x23')](function(){return _0xc4ca4c;});})[_0x3776('0x23')](function(){_0x5d3b34[_0x3776('0x18')](0xcc)[_0x3776('0x19')]();});}};}function handleEntityNotFound(_0x468100,_0x180c74){return function(_0x28854f){if(!_0x28854f){_0x468100['sendStatus'](0x194);}return _0x28854f;};}function handleError(_0x315daa,_0x4feb2e){_0x4feb2e=_0x4feb2e||0x1f4;return function(_0x199d01){logger[_0x3776('0x26')](_0x199d01[_0x3776('0x27')]);if(_0x199d01['name']){delete _0x199d01[_0x3776('0x28')];}_0x315daa['status'](_0x4feb2e)[_0x3776('0x29')](_0x199d01);};}function getMustacheRender(_0x1ac7eb,_0x52710f){return Mustache[_0x3776('0x2a')](_0x1ac7eb,_[_0x3776('0x2b')](_0x52710f['body'],{'contact':_0x52710f['contact'],'message':_0x52710f[_0x3776('0x2c')],'agent':_0x52710f['agent'],'interaction':_0x52710f[_0x3776('0x2d')],'account':_0x52710f['account']}))||'';}exports[_0x3776('0x2e')]=function(_0x23adad,_0x3d661f){var _0x1b152b={},_0x1daf1d={},_0x3bd5a1={'count':0x0,'rows':[]};var _0x293f79=_[_0x3776('0x2f')](db['ContactItemType']['rawAttributes'],function(_0x47a159){return{'name':_0x47a159['fieldName'],'type':_0x47a159[_0x3776('0x30')]['key']};});_0x1daf1d['model']=_[_0x3776('0x2f')](_0x293f79,_0x3776('0x28'));_0x1daf1d[_0x3776('0x31')]=_[_0x3776('0x32')](_0x23adad['query']);_0x1daf1d[_0x3776('0x33')]=_[_0x3776('0x34')](_0x1daf1d[_0x3776('0x35')],_0x1daf1d['query']);_0x1b152b[_0x3776('0x36')]=_[_0x3776('0x34')](_0x1daf1d[_0x3776('0x35')],qs[_0x3776('0x37')](_0x23adad['query']['fields']));_0x1b152b[_0x3776('0x36')]=_0x1b152b[_0x3776('0x36')][_0x3776('0x38')]?_0x1b152b['attributes']:_0x1daf1d['model'];if(!_0x23adad[_0x3776('0x31')]['hasOwnProperty'](_0x3776('0x39'))){_0x1b152b['limit']=qs[_0x3776('0x1d')](_0x23adad['query'][_0x3776('0x1d')]);_0x1b152b[_0x3776('0x1b')]=qs['offset'](_0x23adad[_0x3776('0x31')]['offset']);}_0x1b152b[_0x3776('0x3a')]=qs[_0x3776('0x3b')](_0x23adad[_0x3776('0x31')][_0x3776('0x3b')]);_0x1b152b[_0x3776('0x3c')]=qs['filters'](_['pick'](_0x23adad[_0x3776('0x31')],_0x1daf1d[_0x3776('0x33')]),_0x293f79);if(_0x23adad['query'][_0x3776('0x3d')]){_0x1b152b[_0x3776('0x3c')]=_[_0x3776('0x2b')](_0x1b152b[_0x3776('0x3c')],{'$or':_[_0x3776('0x2f')](_0x293f79,function(_0x976708){if(_0x976708[_0x3776('0x30')]!=='VIRTUAL'){var _0x4a309a={};_0x4a309a[_0x976708[_0x3776('0x28')]]={'$like':'%'+_0x23adad[_0x3776('0x31')][_0x3776('0x3d')]+'%'};return _0x4a309a;}})});}_0x1b152b=_[_0x3776('0x2b')]({},_0x1b152b,_0x23adad[_0x3776('0x3e')]);var _0x18a4e9={'where':_0x1b152b['where']};return db[_0x3776('0x3f')][_0x3776('0x1c')](_0x18a4e9)[_0x3776('0x23')](function(_0x36b20f){_0x3bd5a1[_0x3776('0x1c')]=_0x36b20f;if(_0x23adad['query'][_0x3776('0x40')]){_0x1b152b['include']=[{'all':!![]}];}return db[_0x3776('0x3f')]['findAll'](_0x1b152b);})['then'](function(_0x5d582c){_0x3bd5a1[_0x3776('0x41')]=_0x5d582c;return _0x3bd5a1;})[_0x3776('0x23')](respondWithFilteredResult(_0x3d661f,_0x1b152b))[_0x3776('0x42')](handleError(_0x3d661f,null));};exports[_0x3776('0x43')]=function(_0x5ed7e3,_0x3c865f){var _0x1ebf73={'raw':!![],'where':{'id':_0x5ed7e3[_0x3776('0x44')]['id']}},_0x56797d={};_0x56797d[_0x3776('0x35')]=_[_0x3776('0x32')](db[_0x3776('0x3f')][_0x3776('0x45')]);_0x56797d[_0x3776('0x31')]=_[_0x3776('0x32')](_0x5ed7e3[_0x3776('0x31')]);_0x56797d['filters']=_[_0x3776('0x34')](_0x56797d['model'],_0x56797d[_0x3776('0x31')]);_0x1ebf73[_0x3776('0x36')]=_[_0x3776('0x34')](_0x56797d[_0x3776('0x35')],qs[_0x3776('0x37')](_0x5ed7e3[_0x3776('0x31')][_0x3776('0x37')]));_0x1ebf73[_0x3776('0x36')]=_0x1ebf73[_0x3776('0x36')]['length']?_0x1ebf73[_0x3776('0x36')]:_0x56797d['model'];if(_0x5ed7e3[_0x3776('0x31')][_0x3776('0x40')]){_0x1ebf73[_0x3776('0x46')]=[{'all':!![]}];}_0x1ebf73=_[_0x3776('0x2b')]({},_0x1ebf73,_0x5ed7e3[_0x3776('0x3e')]);return db[_0x3776('0x3f')][_0x3776('0x47')](_0x1ebf73)['then'](handleEntityNotFound(_0x3c865f,null))['then'](respondWithResult(_0x3c865f,null))[_0x3776('0x42')](handleError(_0x3c865f,null));};exports['create']=function(_0x110a39,_0x14c076){return db[_0x3776('0x3f')][_0x3776('0x48')](_0x110a39[_0x3776('0x49')],{})[_0x3776('0x23')](function(_0x1f3428){var _0x1488a6=_0x110a39['user'][_0x3776('0x4a')]({'plain':!![]});if(!_0x1488a6)throw new Error(_0x3776('0x4b'));if(_0x1488a6[_0x3776('0x4c')]==='user'){var _0xc61cd7=_0x1f3428[_0x3776('0x4a')]({'plain':!![]});var _0x57d02c=_0x3776('0x4d');return db[_0x3776('0x4e')][_0x3776('0x47')]({'where':{'name':_0x57d02c,'userProfileId':_0x1488a6[_0x3776('0x4f')]},'raw':!![]})[_0x3776('0x23')](function(_0x63b5cb){if(_0x63b5cb&&_0x63b5cb[_0x3776('0x50')]===0x0){return db[_0x3776('0x25')][_0x3776('0x48')]({'name':_0xc61cd7['name'],'resourceId':_0xc61cd7['id'],'type':_0x63b5cb['name'],'sectionId':_0x63b5cb['id']},{})[_0x3776('0x23')](function(){return _0x1f3428;});}else{return _0x1f3428;}})['catch'](function(_0x3b6dbd){logger[_0x3776('0x26')](_0x3776('0x51'),_0x3b6dbd);throw _0x3b6dbd;});}return _0x1f3428;})['then'](respondWithResult(_0x14c076,0xc9))[_0x3776('0x42')](handleError(_0x14c076,null));};exports[_0x3776('0x22')]=function(_0x405090,_0x366eec){if(_0x405090['body']['id']){delete _0x405090['body']['id'];}return db[_0x3776('0x3f')][_0x3776('0x47')]({'where':{'id':_0x405090[_0x3776('0x44')]['id']}})[_0x3776('0x23')](handleEntityNotFound(_0x366eec,null))[_0x3776('0x23')](saveUpdates(_0x405090['body'],null))[_0x3776('0x23')](respondWithResult(_0x366eec,null))[_0x3776('0x42')](handleError(_0x366eec,null));};exports[_0x3776('0x24')]=function(_0xc6372c,_0x346e93){return db[_0x3776('0x3f')][_0x3776('0x47')]({'where':{'id':_0xc6372c['params']['id']}})[_0x3776('0x23')](handleEntityNotFound(_0x346e93,null))[_0x3776('0x23')](removeEntity(_0x346e93,null))[_0x3776('0x42')](handleError(_0x346e93,null));};
\ No newline at end of file