Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / cmContactHasItem / cmContactHasItem.controller.js
index f9b9d76..af16624 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe90a=['type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','CmContactHasItem','rawAttributes'];(function(_0x80ed33,_0x1fe114){var _0x1f4eae=function(_0x4fd943){while(--_0x4fd943){_0x80ed33['push'](_0x80ed33['shift']());}};_0x1f4eae(++_0x1fe114);}(_0xe90a,0x79));var _0xae90=function(_0x11ba32,_0x5a7ba6){_0x11ba32=_0x11ba32-0x0;var _0x296558=_0xe90a[_0x11ba32];return _0x296558;};'use strict';var emlformat=require(_0xae90('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae90('0x1'));var jsonpatch=require(_0xae90('0x2'));var rp=require(_0xae90('0x3'));var moment=require(_0xae90('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xae90('0x5'));var path=require(_0xae90('0x6'));var sox=require(_0xae90('0x7'));var csv=require(_0xae90('0x8'));var ejs=require(_0xae90('0x9'));var fs=require('fs');var fs_extra=require(_0xae90('0xa'));var _=require(_0xae90('0xb'));var squel=require(_0xae90('0xc'));var crypto=require('crypto');var jsforce=require(_0xae90('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xae90('0x8'));var querystring=require(_0xae90('0xe'));var Papa=require('papaparse');var Redis=require(_0xae90('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xae90('0x10'));var as=require(_0xae90('0x11'));var hardwareService=require(_0xae90('0x12'));var logger=require(_0xae90('0x13'))(_0xae90('0x14'));var utils=require(_0xae90('0x15'));var config=require(_0xae90('0x16'));var licenseUtil=require(_0xae90('0x17'));var db=require(_0xae90('0x18'))['db'];function respondWithStatusCode(_0x4520dc,_0x127f3a){_0x127f3a=_0x127f3a||0xcc;return function(_0x32a4ba){if(_0x32a4ba){return _0x4520dc[_0xae90('0x19')](_0x127f3a);}return _0x4520dc['status'](_0x127f3a)[_0xae90('0x1a')]();};}function respondWithResult(_0x3d2c8f,_0x26f8c6){_0x26f8c6=_0x26f8c6||0xc8;return function(_0x57526d){if(_0x57526d){return _0x3d2c8f[_0xae90('0x1b')](_0x26f8c6)['json'](_0x57526d);}};}function respondWithFilteredResult(_0x2d9685,_0x451c65){return function(_0x1a182a){if(_0x1a182a){var _0x300558=typeof _0x451c65[_0xae90('0x1c')]===_0xae90('0x1d')&&typeof _0x451c65[_0xae90('0x1e')]===_0xae90('0x1d');var _0x180ba1=_0x1a182a[_0xae90('0x1f')];var _0x363c84=_0x300558?0x0:_0x451c65[_0xae90('0x1c')];var _0x1a5762=_0x300558?_0x1a182a[_0xae90('0x1f')]:_0x451c65[_0xae90('0x1c')]+_0x451c65[_0xae90('0x1e')];var _0x48e2d6;if(_0x1a5762>=_0x180ba1){_0x1a5762=_0x180ba1;_0x48e2d6=0xc8;}else{_0x48e2d6=0xce;}_0x2d9685['status'](_0x48e2d6);return _0x2d9685[_0xae90('0x20')](_0xae90('0x21'),_0x363c84+'-'+_0x1a5762+'/'+_0x180ba1)['json'](_0x1a182a);}return null;};}function patchUpdates(_0x23c547){return function(_0x38495c){try{jsonpatch['apply'](_0x38495c,_0x23c547,!![]);}catch(_0x11fab9){return BPromise[_0xae90('0x22')](_0x11fab9);}return _0x38495c[_0xae90('0x23')]();};}function saveUpdates(_0x28ac3b,_0x5f0c48){return function(_0x540dab){if(_0x540dab){return _0x540dab[_0xae90('0x24')](_0x28ac3b)[_0xae90('0x25')](function(_0x5f3659){return _0x5f3659;});}return null;};}function removeEntity(_0x4399a5,_0xfbe2ab){return function(_0x39f9e2){if(_0x39f9e2){return _0x39f9e2[_0xae90('0x26')]()[_0xae90('0x25')](function(){var _0x345b41=_0x39f9e2[_0xae90('0x27')]({'plain':!![]});var _0x3969d7=_0xae90('0x28');return db[_0xae90('0x29')][_0xae90('0x26')]({'where':{'type':_0x3969d7,'resourceId':_0x345b41['id']}})['then'](function(){return _0x39f9e2;});})[_0xae90('0x25')](function(){_0x4399a5[_0xae90('0x1b')](0xcc)[_0xae90('0x1a')]();});}};}function handleEntityNotFound(_0x53bba3,_0x38c276){return function(_0x136d05){if(!_0x136d05){_0x53bba3[_0xae90('0x19')](0x194);}return _0x136d05;};}function handleError(_0x31ae3a,_0x202681){_0x202681=_0x202681||0x1f4;return function(_0x58a6d1){logger[_0xae90('0x2a')](_0x58a6d1[_0xae90('0x2b')]);if(_0x58a6d1[_0xae90('0x2c')]){delete _0x58a6d1[_0xae90('0x2c')];}_0x31ae3a[_0xae90('0x1b')](_0x202681)[_0xae90('0x2d')](_0x58a6d1);};}exports[_0xae90('0x2e')]=function(_0x1c8228,_0x1eb757){var _0x27720d={},_0x33fb4a={},_0x43c4da={'count':0x0,'rows':[]};var _0x30805a=_['map'](db[_0xae90('0x2f')][_0xae90('0x30')],function(_0xaad970){return{'name':_0xaad970['fieldName'],'type':_0xaad970[_0xae90('0x31')][_0xae90('0x32')]};});_0x33fb4a[_0xae90('0x33')]=_[_0xae90('0x34')](_0x30805a,_0xae90('0x2c'));_0x33fb4a[_0xae90('0x35')]=_[_0xae90('0x36')](_0x1c8228[_0xae90('0x35')]);_0x33fb4a[_0xae90('0x37')]=_[_0xae90('0x38')](_0x33fb4a['model'],_0x33fb4a['query']);_0x27720d[_0xae90('0x39')]=_['intersection'](_0x33fb4a[_0xae90('0x33')],qs[_0xae90('0x3a')](_0x1c8228['query'][_0xae90('0x3a')]));_0x27720d[_0xae90('0x39')]=_0x27720d['attributes'][_0xae90('0x3b')]?_0x27720d['attributes']:_0x33fb4a[_0xae90('0x33')];if(!_0x1c8228[_0xae90('0x35')][_0xae90('0x3c')](_0xae90('0x3d'))){_0x27720d[_0xae90('0x1e')]=qs[_0xae90('0x1e')](_0x1c8228[_0xae90('0x35')]['limit']);_0x27720d[_0xae90('0x1c')]=qs[_0xae90('0x1c')](_0x1c8228['query'][_0xae90('0x1c')]);}_0x27720d[_0xae90('0x3e')]=qs['sort'](_0x1c8228['query'][_0xae90('0x3f')]);_0x27720d['where']=qs[_0xae90('0x37')](_['pick'](_0x1c8228['query'],_0x33fb4a[_0xae90('0x37')]),_0x30805a);if(_0x1c8228[_0xae90('0x35')][_0xae90('0x40')]){_0x27720d[_0xae90('0x41')]=_[_0xae90('0x42')](_0x27720d['where'],{'$or':_[_0xae90('0x34')](_0x30805a,function(_0x41f6f1){if(_0x41f6f1[_0xae90('0x31')]!==_0xae90('0x43')){var _0x42b52a={};_0x42b52a[_0x41f6f1['name']]={'$like':'%'+_0x1c8228[_0xae90('0x35')]['filter']+'%'};return _0x42b52a;}})});}_0x27720d=_[_0xae90('0x42')]({},_0x27720d,_0x1c8228[_0xae90('0x44')]);var _0x3d5047={'where':_0x27720d['where']};return db['CmContactHasItem'][_0xae90('0x1f')](_0x3d5047)[_0xae90('0x25')](function(_0x158c16){_0x43c4da[_0xae90('0x1f')]=_0x158c16;if(_0x1c8228[_0xae90('0x35')]['includeAll']){_0x27720d[_0xae90('0x45')]=[{'all':!![]}];}return db[_0xae90('0x2f')][_0xae90('0x46')](_0x27720d);})['then'](function(_0x3063ad){_0x43c4da[_0xae90('0x47')]=_0x3063ad;return _0x43c4da;})[_0xae90('0x25')](respondWithFilteredResult(_0x1eb757,_0x27720d))['catch'](handleError(_0x1eb757,null));};exports[_0xae90('0x48')]=function(_0x2f53d6,_0x22b20d){var _0x36bbfb={'raw':!![],'where':{'id':_0x2f53d6['params']['id']}},_0x2cc2ed={};_0x2cc2ed[_0xae90('0x33')]=_[_0xae90('0x36')](db['CmContactHasItem'][_0xae90('0x30')]);_0x2cc2ed[_0xae90('0x35')]=_[_0xae90('0x36')](_0x2f53d6[_0xae90('0x35')]);_0x2cc2ed['filters']=_['intersection'](_0x2cc2ed[_0xae90('0x33')],_0x2cc2ed[_0xae90('0x35')]);_0x36bbfb[_0xae90('0x39')]=_[_0xae90('0x38')](_0x2cc2ed['model'],qs[_0xae90('0x3a')](_0x2f53d6['query'][_0xae90('0x3a')]));_0x36bbfb[_0xae90('0x39')]=_0x36bbfb['attributes']['length']?_0x36bbfb[_0xae90('0x39')]:_0x2cc2ed[_0xae90('0x33')];if(_0x2f53d6[_0xae90('0x35')]['includeAll']){_0x36bbfb[_0xae90('0x45')]=[{'all':!![]}];}_0x36bbfb=_[_0xae90('0x42')]({},_0x36bbfb,_0x2f53d6[_0xae90('0x44')]);return db[_0xae90('0x2f')][_0xae90('0x49')](_0x36bbfb)[_0xae90('0x25')](handleEntityNotFound(_0x22b20d,null))[_0xae90('0x25')](respondWithResult(_0x22b20d,null))[_0xae90('0x4a')](handleError(_0x22b20d,null));};exports[_0xae90('0x4b')]=function(_0x4aca9f,_0x36eaac){return db['CmContactHasItem'][_0xae90('0x4b')](_0x4aca9f['body'],{})[_0xae90('0x25')](function(_0x475989){var _0xc0f9c8=_0x4aca9f[_0xae90('0x4c')][_0xae90('0x27')]({'plain':!![]});if(!_0xc0f9c8)throw new Error(_0xae90('0x4d'));if(_0xc0f9c8[_0xae90('0x4e')]==='user'){var _0x2eda45=_0x475989[_0xae90('0x27')]({'plain':!![]});var _0x5a51ab='CmContactHasItems';return db[_0xae90('0x4f')][_0xae90('0x49')]({'where':{'name':_0x5a51ab,'userProfileId':_0xc0f9c8[_0xae90('0x50')]},'raw':!![]})['then'](function(_0x2bfd85){if(_0x2bfd85&&_0x2bfd85[_0xae90('0x51')]===0x0){return db[_0xae90('0x29')][_0xae90('0x4b')]({'name':_0x2eda45[_0xae90('0x2c')],'resourceId':_0x2eda45['id'],'type':_0x2bfd85[_0xae90('0x2c')],'sectionId':_0x2bfd85['id']},{})['then'](function(){return _0x475989;});}else{return _0x475989;}})['catch'](function(_0x22879d){logger[_0xae90('0x2a')](_0xae90('0x52'),_0x22879d);throw _0x22879d;});}return _0x475989;})[_0xae90('0x25')](respondWithResult(_0x36eaac,0xc9))[_0xae90('0x4a')](handleError(_0x36eaac,null));};exports[_0xae90('0x24')]=function(_0x373842,_0x2f6fbc){if(_0x373842['body']['id']){delete _0x373842['body']['id'];}return db['CmContactHasItem'][_0xae90('0x49')]({'where':{'id':_0x373842[_0xae90('0x53')]['id']}})['then'](handleEntityNotFound(_0x2f6fbc,null))[_0xae90('0x25')](saveUpdates(_0x373842[_0xae90('0x54')],null))[_0xae90('0x25')](respondWithResult(_0x2f6fbc,null))[_0xae90('0x4a')](handleError(_0x2f6fbc,null));};exports['destroy']=function(_0x5736fd,_0x4ee4ab){return db[_0xae90('0x2f')][_0xae90('0x49')]({'where':{'id':_0x5736fd[_0xae90('0x53')]['id']}})[_0xae90('0x25')](handleEntityNotFound(_0x4ee4ab,null))[_0xae90('0x25')](removeEntity(_0x4ee4ab,null))[_0xae90('0x4a')](handleError(_0x4ee4ab,null));};
\ No newline at end of file
+var _0xa393=['sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','then','destroy','CmContactHasItems','UserProfileResource','error','stack','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x584a8f,_0x374ca4){var _0x464df9=function(_0x3630c9){while(--_0x3630c9){_0x584a8f['push'](_0x584a8f['shift']());}};_0x464df9(++_0x374ca4);}(_0xa393,0x107));var _0x3a39=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xa393[_0xda464c];return _0x19e222;};'use strict';var emlformat=require(_0x3a39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3a39('0x1'));var jsonpatch=require(_0x3a39('0x2'));var rp=require(_0x3a39('0x3'));var moment=require(_0x3a39('0x4'));var BPromise=require(_0x3a39('0x5'));var Mustache=require(_0x3a39('0x6'));var util=require('util');var path=require(_0x3a39('0x7'));var sox=require('sox');var csv=require(_0x3a39('0x8'));var ejs=require(_0x3a39('0x9'));var fs=require('fs');var fs_extra=require(_0x3a39('0xa'));var _=require(_0x3a39('0xb'));var squel=require(_0x3a39('0xc'));var crypto=require(_0x3a39('0xd'));var jsforce=require(_0x3a39('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3a39('0xf'));var Papa=require(_0x3a39('0x10'));var Redis=require(_0x3a39('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3a39('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3a39('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3a39('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27b8f4,_0x3e8d77){_0x3e8d77=_0x3e8d77||0xcc;return function(_0x5db9af){if(_0x5db9af){return _0x27b8f4[_0x3a39('0x15')](_0x3e8d77);}return _0x27b8f4[_0x3a39('0x16')](_0x3e8d77)[_0x3a39('0x17')]();};}function respondWithResult(_0x1346a0,_0x1f85e5){_0x1f85e5=_0x1f85e5||0xc8;return function(_0x2a1194){if(_0x2a1194){return _0x1346a0[_0x3a39('0x16')](_0x1f85e5)['json'](_0x2a1194);}};}function respondWithFilteredResult(_0x4e9ceb,_0x2a7afa){return function(_0x14242c){if(_0x14242c){var _0x46fa9c=typeof _0x2a7afa[_0x3a39('0x18')]==='undefined'&&typeof _0x2a7afa[_0x3a39('0x19')]===_0x3a39('0x1a');var _0x52026d=_0x14242c[_0x3a39('0x1b')];var _0x227b80=_0x46fa9c?0x0:_0x2a7afa[_0x3a39('0x18')];var _0x38e072=_0x46fa9c?_0x14242c['count']:_0x2a7afa[_0x3a39('0x18')]+_0x2a7afa[_0x3a39('0x19')];var _0x526cdc;if(_0x38e072>=_0x52026d){_0x38e072=_0x52026d;_0x526cdc=0xc8;}else{_0x526cdc=0xce;}_0x4e9ceb[_0x3a39('0x16')](_0x526cdc);return _0x4e9ceb[_0x3a39('0x1c')](_0x3a39('0x1d'),_0x227b80+'-'+_0x38e072+'/'+_0x52026d)[_0x3a39('0x1e')](_0x14242c);}return null;};}function patchUpdates(_0x288ac3){return function(_0x5df108){try{jsonpatch['apply'](_0x5df108,_0x288ac3,!![]);}catch(_0xc7024){return BPromise[_0x3a39('0x1f')](_0xc7024);}return _0x5df108[_0x3a39('0x20')]();};}function saveUpdates(_0xdbf579,_0x18ddd3){return function(_0x4e47a2){if(_0x4e47a2){return _0x4e47a2['update'](_0xdbf579)[_0x3a39('0x21')](function(_0x59e243){return _0x59e243;});}return null;};}function removeEntity(_0x4e8eb1,_0x5bfb94){return function(_0x360e21){if(_0x360e21){return _0x360e21[_0x3a39('0x22')]()['then'](function(){var _0x1f0190=_0x360e21['get']({'plain':!![]});var _0x4c7562=_0x3a39('0x23');return db[_0x3a39('0x24')]['destroy']({'where':{'type':_0x4c7562,'resourceId':_0x1f0190['id']}})['then'](function(){return _0x360e21;});})['then'](function(){_0x4e8eb1[_0x3a39('0x16')](0xcc)[_0x3a39('0x17')]();});}};}function handleEntityNotFound(_0x51c48a,_0x5906a2){return function(_0x22538f){if(!_0x22538f){_0x51c48a[_0x3a39('0x15')](0x194);}return _0x22538f;};}function handleError(_0x55d6e9,_0x58597){_0x58597=_0x58597||0x1f4;return function(_0x522653){logger[_0x3a39('0x25')](_0x522653[_0x3a39('0x26')]);if(_0x522653['name']){delete _0x522653['name'];}_0x55d6e9[_0x3a39('0x16')](_0x58597)[_0x3a39('0x27')](_0x522653);};}exports[_0x3a39('0x28')]=function(_0x2fd321,_0xb7f56d){var _0x249b14={},_0x2a54d0={},_0x5bd5f7={'count':0x0,'rows':[]};var _0x4104be=_[_0x3a39('0x29')](db[_0x3a39('0x2a')][_0x3a39('0x2b')],function(_0x3e8ba8){return{'name':_0x3e8ba8[_0x3a39('0x2c')],'type':_0x3e8ba8[_0x3a39('0x2d')]['key']};});_0x2a54d0[_0x3a39('0x2e')]=_[_0x3a39('0x29')](_0x4104be,_0x3a39('0x2f'));_0x2a54d0['query']=_[_0x3a39('0x30')](_0x2fd321[_0x3a39('0x31')]);_0x2a54d0[_0x3a39('0x32')]=_[_0x3a39('0x33')](_0x2a54d0['model'],_0x2a54d0[_0x3a39('0x31')]);_0x249b14['attributes']=_[_0x3a39('0x33')](_0x2a54d0[_0x3a39('0x2e')],qs['fields'](_0x2fd321['query']['fields']));_0x249b14['attributes']=_0x249b14[_0x3a39('0x34')][_0x3a39('0x35')]?_0x249b14[_0x3a39('0x34')]:_0x2a54d0[_0x3a39('0x2e')];if(!_0x2fd321[_0x3a39('0x31')][_0x3a39('0x36')](_0x3a39('0x37'))){_0x249b14[_0x3a39('0x19')]=qs[_0x3a39('0x19')](_0x2fd321[_0x3a39('0x31')][_0x3a39('0x19')]);_0x249b14[_0x3a39('0x18')]=qs[_0x3a39('0x18')](_0x2fd321[_0x3a39('0x31')]['offset']);}_0x249b14[_0x3a39('0x38')]=qs['sort'](_0x2fd321[_0x3a39('0x31')][_0x3a39('0x39')]);_0x249b14[_0x3a39('0x3a')]=qs[_0x3a39('0x32')](_['pick'](_0x2fd321['query'],_0x2a54d0[_0x3a39('0x32')]),_0x4104be);if(_0x2fd321[_0x3a39('0x31')][_0x3a39('0x3b')]){_0x249b14[_0x3a39('0x3a')]=_[_0x3a39('0x3c')](_0x249b14[_0x3a39('0x3a')],{'$or':_['map'](_0x4104be,function(_0x50b168){if(_0x50b168[_0x3a39('0x2d')]!==_0x3a39('0x3d')){var _0x5ee126={};_0x5ee126[_0x50b168[_0x3a39('0x2f')]]={'$like':'%'+_0x2fd321['query'][_0x3a39('0x3b')]+'%'};return _0x5ee126;}})});}_0x249b14=_[_0x3a39('0x3c')]({},_0x249b14,_0x2fd321[_0x3a39('0x3e')]);var _0x279b37={'where':_0x249b14[_0x3a39('0x3a')]};return db[_0x3a39('0x2a')][_0x3a39('0x1b')](_0x279b37)['then'](function(_0x340467){_0x5bd5f7[_0x3a39('0x1b')]=_0x340467;if(_0x2fd321['query'][_0x3a39('0x3f')]){_0x249b14[_0x3a39('0x40')]=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x249b14);})['then'](function(_0x1ae433){_0x5bd5f7[_0x3a39('0x41')]=_0x1ae433;return _0x5bd5f7;})['then'](respondWithFilteredResult(_0xb7f56d,_0x249b14))[_0x3a39('0x42')](handleError(_0xb7f56d,null));};exports[_0x3a39('0x43')]=function(_0x1ee862,_0x2a5f96){var _0x2572bb={'raw':!![],'where':{'id':_0x1ee862[_0x3a39('0x44')]['id']}},_0x11b93a={};_0x11b93a[_0x3a39('0x2e')]=_['keys'](db[_0x3a39('0x2a')]['rawAttributes']);_0x11b93a[_0x3a39('0x31')]=_[_0x3a39('0x30')](_0x1ee862[_0x3a39('0x31')]);_0x11b93a[_0x3a39('0x32')]=_['intersection'](_0x11b93a[_0x3a39('0x2e')],_0x11b93a[_0x3a39('0x31')]);_0x2572bb[_0x3a39('0x34')]=_['intersection'](_0x11b93a[_0x3a39('0x2e')],qs['fields'](_0x1ee862[_0x3a39('0x31')][_0x3a39('0x45')]));_0x2572bb[_0x3a39('0x34')]=_0x2572bb[_0x3a39('0x34')][_0x3a39('0x35')]?_0x2572bb[_0x3a39('0x34')]:_0x11b93a['model'];if(_0x1ee862[_0x3a39('0x31')][_0x3a39('0x3f')]){_0x2572bb['include']=[{'all':!![]}];}_0x2572bb=_[_0x3a39('0x3c')]({},_0x2572bb,_0x1ee862[_0x3a39('0x3e')]);return db[_0x3a39('0x2a')][_0x3a39('0x46')](_0x2572bb)[_0x3a39('0x21')](handleEntityNotFound(_0x2a5f96,null))['then'](respondWithResult(_0x2a5f96,null))['catch'](handleError(_0x2a5f96,null));};exports['create']=function(_0x16b435,_0x291f46){return db['CmContactHasItem'][_0x3a39('0x47')](_0x16b435[_0x3a39('0x48')],{})[_0x3a39('0x21')](function(_0x18c31e){var _0x54e7d6=_0x16b435[_0x3a39('0x49')]['get']({'plain':!![]});if(!_0x54e7d6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54e7d6[_0x3a39('0x4a')]==='user'){var _0x1fd91e=_0x18c31e['get']({'plain':!![]});var _0x410904=_0x3a39('0x23');return db[_0x3a39('0x4b')][_0x3a39('0x46')]({'where':{'name':_0x410904,'userProfileId':_0x54e7d6[_0x3a39('0x4c')]},'raw':!![]})[_0x3a39('0x21')](function(_0x413beb){if(_0x413beb&&_0x413beb[_0x3a39('0x4d')]===0x0){return db[_0x3a39('0x24')][_0x3a39('0x47')]({'name':_0x1fd91e['name'],'resourceId':_0x1fd91e['id'],'type':_0x413beb[_0x3a39('0x2f')],'sectionId':_0x413beb['id']},{})[_0x3a39('0x21')](function(){return _0x18c31e;});}else{return _0x18c31e;}})['catch'](function(_0x4d762e){logger[_0x3a39('0x25')](_0x3a39('0x4e'),_0x4d762e);throw _0x4d762e;});}return _0x18c31e;})[_0x3a39('0x21')](respondWithResult(_0x291f46,0xc9))[_0x3a39('0x42')](handleError(_0x291f46,null));};exports[_0x3a39('0x4f')]=function(_0x41d146,_0x26b3b7){if(_0x41d146['body']['id']){delete _0x41d146[_0x3a39('0x48')]['id'];}return db[_0x3a39('0x2a')][_0x3a39('0x46')]({'where':{'id':_0x41d146[_0x3a39('0x44')]['id']}})[_0x3a39('0x21')](handleEntityNotFound(_0x26b3b7,null))[_0x3a39('0x21')](saveUpdates(_0x41d146[_0x3a39('0x48')],null))[_0x3a39('0x21')](respondWithResult(_0x26b3b7,null))[_0x3a39('0x42')](handleError(_0x26b3b7,null));};exports[_0x3a39('0x22')]=function(_0x10a538,_0x572a57){return db[_0x3a39('0x2a')][_0x3a39('0x46')]({'where':{'id':_0x10a538[_0x3a39('0x44')]['id']}})['then'](handleEntityNotFound(_0x572a57,null))[_0x3a39('0x21')](removeEntity(_0x572a57,null))[_0x3a39('0x42')](handleError(_0x572a57,null));};
\ No newline at end of file