Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / cmContactHasItem / cmContactHasItem.controller.js
index 021783b..b4e3b87 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x18b9=['Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasItems','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','stack','name','send','map','CmContactHasItem','rawAttributes','fieldName','type','keys','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','create','body','user'];(function(_0x5aada8,_0x460a35){var _0xf5247e=function(_0x507709){while(--_0x507709){_0x5aada8['push'](_0x5aada8['shift']());}};_0xf5247e(++_0x460a35);}(_0x18b9,0x148));var _0x918b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x18b9[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x918b('0x0'));var rimraf=require(_0x918b('0x1'));var zipdir=require(_0x918b('0x2'));var jsonpatch=require(_0x918b('0x3'));var rp=require(_0x918b('0x4'));var moment=require('moment');var BPromise=require(_0x918b('0x5'));var Mustache=require(_0x918b('0x6'));var util=require('util');var path=require(_0x918b('0x7'));var sox=require(_0x918b('0x8'));var csv=require(_0x918b('0x9'));var ejs=require(_0x918b('0xa'));var fs=require('fs');var fs_extra=require(_0x918b('0xb'));var _=require('lodash');var squel=require(_0x918b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x918b('0x9'));var querystring=require(_0x918b('0xd'));var Papa=require(_0x918b('0xe'));var Redis=require(_0x918b('0xf'));var authService=require(_0x918b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x918b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x918b('0x12'))(_0x918b('0x13'));var utils=require(_0x918b('0x14'));var config=require(_0x918b('0x15'));var licenseUtil=require(_0x918b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x532b37,_0x34f740){_0x34f740=_0x34f740||0xcc;return function(_0x392408){if(_0x392408){return _0x532b37[_0x918b('0x17')](_0x34f740);}return _0x532b37[_0x918b('0x18')](_0x34f740)[_0x918b('0x19')]();};}function respondWithResult(_0x446695,_0x4d695e){_0x4d695e=_0x4d695e||0xc8;return function(_0xd58cbe){if(_0xd58cbe){return _0x446695[_0x918b('0x18')](_0x4d695e)[_0x918b('0x1a')](_0xd58cbe);}};}function respondWithFilteredResult(_0x4b3232,_0x32667a){return function(_0x545228){if(_0x545228){var _0x3c8a27=typeof _0x32667a[_0x918b('0x1b')]==='undefined'&&typeof _0x32667a[_0x918b('0x1c')]==='undefined';var _0x153edc=_0x545228[_0x918b('0x1d')];var _0x291c39=_0x3c8a27?0x0:_0x32667a[_0x918b('0x1b')];var _0xb42b32=_0x3c8a27?_0x545228[_0x918b('0x1d')]:_0x32667a['offset']+_0x32667a[_0x918b('0x1c')];var _0x5d3090;if(_0xb42b32>=_0x153edc){_0xb42b32=_0x153edc;_0x5d3090=0xc8;}else{_0x5d3090=0xce;}_0x4b3232[_0x918b('0x18')](_0x5d3090);return _0x4b3232[_0x918b('0x1e')](_0x918b('0x1f'),_0x291c39+'-'+_0xb42b32+'/'+_0x153edc)[_0x918b('0x1a')](_0x545228);}return null;};}function patchUpdates(_0x5c8fbd){return function(_0x5b27de){try{jsonpatch['apply'](_0x5b27de,_0x5c8fbd,!![]);}catch(_0x28356e){return BPromise[_0x918b('0x20')](_0x28356e);}return _0x5b27de[_0x918b('0x21')]();};}function saveUpdates(_0x5e7d43,_0x5a9dce){return function(_0x1f16c4){if(_0x1f16c4){return _0x1f16c4[_0x918b('0x22')](_0x5e7d43)[_0x918b('0x23')](function(_0x47c828){return _0x47c828;});}return null;};}function removeEntity(_0x249f09,_0x38764b){return function(_0x862156){if(_0x862156){return _0x862156['destroy']()[_0x918b('0x23')](function(){var _0x175176=_0x862156[_0x918b('0x24')]({'plain':!![]});var _0x349ba0='CmContactHasItems';return db[_0x918b('0x25')][_0x918b('0x26')]({'where':{'type':_0x349ba0,'resourceId':_0x175176['id']}})[_0x918b('0x23')](function(){return _0x862156;});})[_0x918b('0x23')](function(){_0x249f09[_0x918b('0x18')](0xcc)[_0x918b('0x19')]();});}};}function handleEntityNotFound(_0x15521d,_0x460d06){return function(_0x18bdb2){if(!_0x18bdb2){_0x15521d[_0x918b('0x17')](0x194);}return _0x18bdb2;};}function handleError(_0x2064d8,_0x16136e){_0x16136e=_0x16136e||0x1f4;return function(_0x4557cf){logger['error'](_0x4557cf[_0x918b('0x27')]);if(_0x4557cf[_0x918b('0x28')]){delete _0x4557cf[_0x918b('0x28')];}_0x2064d8[_0x918b('0x18')](_0x16136e)[_0x918b('0x29')](_0x4557cf);};}exports['index']=function(_0x58e325,_0x47bbd4){var _0x34369a={},_0x277118={},_0x49e658={'count':0x0,'rows':[]};var _0x4a092e=_[_0x918b('0x2a')](db[_0x918b('0x2b')][_0x918b('0x2c')],function(_0x14c2de){return{'name':_0x14c2de[_0x918b('0x2d')],'type':_0x14c2de[_0x918b('0x2e')]['key']};});_0x277118['model']=_[_0x918b('0x2a')](_0x4a092e,_0x918b('0x28'));_0x277118['query']=_[_0x918b('0x2f')](_0x58e325[_0x918b('0x30')]);_0x277118[_0x918b('0x31')]=_[_0x918b('0x32')](_0x277118['model'],_0x277118[_0x918b('0x30')]);_0x34369a['attributes']=_[_0x918b('0x32')](_0x277118['model'],qs[_0x918b('0x33')](_0x58e325[_0x918b('0x30')][_0x918b('0x33')]));_0x34369a[_0x918b('0x34')]=_0x34369a['attributes'][_0x918b('0x35')]?_0x34369a[_0x918b('0x34')]:_0x277118[_0x918b('0x36')];if(!_0x58e325[_0x918b('0x30')][_0x918b('0x37')](_0x918b('0x38'))){_0x34369a[_0x918b('0x1c')]=qs[_0x918b('0x1c')](_0x58e325[_0x918b('0x30')][_0x918b('0x1c')]);_0x34369a['offset']=qs[_0x918b('0x1b')](_0x58e325[_0x918b('0x30')][_0x918b('0x1b')]);}_0x34369a['order']=qs[_0x918b('0x39')](_0x58e325[_0x918b('0x30')][_0x918b('0x39')]);_0x34369a['where']=qs['filters'](_[_0x918b('0x3a')](_0x58e325[_0x918b('0x30')],_0x277118[_0x918b('0x31')]),_0x4a092e);if(_0x58e325[_0x918b('0x30')][_0x918b('0x3b')]){_0x34369a[_0x918b('0x3c')]=_[_0x918b('0x3d')](_0x34369a[_0x918b('0x3c')],{'$or':_['map'](_0x4a092e,function(_0x227f3d){if(_0x227f3d[_0x918b('0x2e')]!==_0x918b('0x3e')){var _0x2f43d8={};_0x2f43d8[_0x227f3d[_0x918b('0x28')]]={'$like':'%'+_0x58e325[_0x918b('0x30')][_0x918b('0x3b')]+'%'};return _0x2f43d8;}})});}_0x34369a=_[_0x918b('0x3d')]({},_0x34369a,_0x58e325[_0x918b('0x3f')]);var _0x14fe7f={'where':_0x34369a[_0x918b('0x3c')]};return db[_0x918b('0x2b')][_0x918b('0x1d')](_0x14fe7f)['then'](function(_0xcac232){_0x49e658[_0x918b('0x1d')]=_0xcac232;if(_0x58e325[_0x918b('0x30')][_0x918b('0x40')]){_0x34369a[_0x918b('0x41')]=[{'all':!![]}];}return db[_0x918b('0x2b')][_0x918b('0x42')](_0x34369a);})['then'](function(_0x249455){_0x49e658['rows']=_0x249455;return _0x49e658;})[_0x918b('0x23')](respondWithFilteredResult(_0x47bbd4,_0x34369a))['catch'](handleError(_0x47bbd4,null));};exports[_0x918b('0x43')]=function(_0x296c12,_0x22945e){var _0x39d682={'raw':!![],'where':{'id':_0x296c12[_0x918b('0x44')]['id']}},_0x31566f={};_0x31566f['model']=_['keys'](db[_0x918b('0x2b')][_0x918b('0x2c')]);_0x31566f['query']=_[_0x918b('0x2f')](_0x296c12[_0x918b('0x30')]);_0x31566f[_0x918b('0x31')]=_['intersection'](_0x31566f[_0x918b('0x36')],_0x31566f['query']);_0x39d682[_0x918b('0x34')]=_[_0x918b('0x32')](_0x31566f[_0x918b('0x36')],qs[_0x918b('0x33')](_0x296c12[_0x918b('0x30')]['fields']));_0x39d682[_0x918b('0x34')]=_0x39d682['attributes'][_0x918b('0x35')]?_0x39d682[_0x918b('0x34')]:_0x31566f[_0x918b('0x36')];if(_0x296c12['query'][_0x918b('0x40')]){_0x39d682[_0x918b('0x41')]=[{'all':!![]}];}_0x39d682=_[_0x918b('0x3d')]({},_0x39d682,_0x296c12['options']);return db[_0x918b('0x2b')]['find'](_0x39d682)['then'](handleEntityNotFound(_0x22945e,null))[_0x918b('0x23')](respondWithResult(_0x22945e,null))['catch'](handleError(_0x22945e,null));};exports[_0x918b('0x45')]=function(_0xd69d9,_0x2aa018){return db[_0x918b('0x2b')]['create'](_0xd69d9[_0x918b('0x46')],{})[_0x918b('0x23')](function(_0x4400b5){var _0x4769cb=_0xd69d9[_0x918b('0x47')][_0x918b('0x24')]({'plain':!![]});if(!_0x4769cb)throw new Error(_0x918b('0x48'));if(_0x4769cb['role']===_0x918b('0x47')){var _0x6babca=_0x4400b5[_0x918b('0x24')]({'plain':!![]});var _0x1e7dfd=_0x918b('0x49');return db[_0x918b('0x4a')][_0x918b('0x4b')]({'where':{'name':_0x1e7dfd,'userProfileId':_0x4769cb[_0x918b('0x4c')]},'raw':!![]})['then'](function(_0x422e70){if(_0x422e70&&_0x422e70[_0x918b('0x4d')]===0x0){return db['UserProfileResource'][_0x918b('0x45')]({'name':_0x6babca[_0x918b('0x28')],'resourceId':_0x6babca['id'],'type':_0x422e70['name'],'sectionId':_0x422e70['id']},{})['then'](function(){return _0x4400b5;});}else{return _0x4400b5;}})[_0x918b('0x4e')](function(_0x2a81bc){logger['error'](_0x918b('0x4f'),_0x2a81bc);throw _0x2a81bc;});}return _0x4400b5;})['then'](respondWithResult(_0x2aa018,0xc9))[_0x918b('0x4e')](handleError(_0x2aa018,null));};exports['update']=function(_0x348cff,_0x5930d4){if(_0x348cff['body']['id']){delete _0x348cff[_0x918b('0x46')]['id'];}return db[_0x918b('0x2b')]['find']({'where':{'id':_0x348cff[_0x918b('0x44')]['id']}})[_0x918b('0x23')](handleEntityNotFound(_0x5930d4,null))['then'](saveUpdates(_0x348cff[_0x918b('0x46')],null))[_0x918b('0x23')](respondWithResult(_0x5930d4,null))[_0x918b('0x4e')](handleError(_0x5930d4,null));};exports[_0x918b('0x26')]=function(_0x264d78,_0x243722){return db[_0x918b('0x2b')][_0x918b('0x4b')]({'where':{'id':_0x264d78[_0x918b('0x44')]['id']}})[_0x918b('0x23')](handleEntityNotFound(_0x243722,null))[_0x918b('0x23')](removeEntity(_0x243722,null))[_0x918b('0x4e')](handleError(_0x243722,null));};
\ No newline at end of file
+var _0xa1de=['sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','show','params','rawAttributes','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','CmContactHasItems','name','map','CmContactHasItem','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa1de,0x1f1));var _0xea1d=function(_0x5f20d8,_0x500714){_0x5f20d8=_0x5f20d8-0x0;var _0x3065d1=_0xa1de[_0x5f20d8];return _0x3065d1;};'use strict';var emlformat=require(_0xea1d('0x0'));var rimraf=require(_0xea1d('0x1'));var zipdir=require(_0xea1d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea1d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xea1d('0x4'));var util=require(_0xea1d('0x5'));var path=require(_0xea1d('0x6'));var sox=require(_0xea1d('0x7'));var csv=require('to-csv');var ejs=require(_0xea1d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xea1d('0x9'));var squel=require('squel');var crypto=require(_0xea1d('0xa'));var jsforce=require(_0xea1d('0xb'));var deskjs=require(_0xea1d('0xc'));var toCsv=require(_0xea1d('0xd'));var querystring=require(_0xea1d('0xe'));var Papa=require(_0xea1d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xea1d('0x10'));var as=require(_0xea1d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea1d('0x12'))(_0xea1d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xea1d('0x14'));var db=require(_0xea1d('0x15'))['db'];function respondWithStatusCode(_0x76281c,_0x3cc70f){_0x3cc70f=_0x3cc70f||0xcc;return function(_0x388300){if(_0x388300){return _0x76281c[_0xea1d('0x16')](_0x3cc70f);}return _0x76281c[_0xea1d('0x17')](_0x3cc70f)[_0xea1d('0x18')]();};}function respondWithResult(_0x52c200,_0x30b663){_0x30b663=_0x30b663||0xc8;return function(_0x38a1c4){if(_0x38a1c4){return _0x52c200[_0xea1d('0x17')](_0x30b663)[_0xea1d('0x19')](_0x38a1c4);}};}function respondWithFilteredResult(_0x38c528,_0x48c9bb){return function(_0x401dee){if(_0x401dee){var _0x1f58f4=typeof _0x48c9bb[_0xea1d('0x1a')]===_0xea1d('0x1b')&&typeof _0x48c9bb[_0xea1d('0x1c')]===_0xea1d('0x1b');var _0x1fbc33=_0x401dee[_0xea1d('0x1d')];var _0x2ab401=_0x1f58f4?0x0:_0x48c9bb[_0xea1d('0x1a')];var _0x27e156=_0x1f58f4?_0x401dee[_0xea1d('0x1d')]:_0x48c9bb['offset']+_0x48c9bb[_0xea1d('0x1c')];var _0x55787f;if(_0x27e156>=_0x1fbc33){_0x27e156=_0x1fbc33;_0x55787f=0xc8;}else{_0x55787f=0xce;}_0x38c528[_0xea1d('0x17')](_0x55787f);return _0x38c528[_0xea1d('0x1e')](_0xea1d('0x1f'),_0x2ab401+'-'+_0x27e156+'/'+_0x1fbc33)['json'](_0x401dee);}return null;};}function patchUpdates(_0x5a19af){return function(_0x509eb6){try{jsonpatch[_0xea1d('0x20')](_0x509eb6,_0x5a19af,!![]);}catch(_0x9cf80){return BPromise['reject'](_0x9cf80);}return _0x509eb6[_0xea1d('0x21')]();};}function saveUpdates(_0x40a91a,_0x2d060e){return function(_0x3058ba){if(_0x3058ba){return _0x3058ba[_0xea1d('0x22')](_0x40a91a)['then'](function(_0x5f1b58){return _0x5f1b58;});}return null;};}function removeEntity(_0xede85f,_0x24d66c){return function(_0xe93ef0){if(_0xe93ef0){return _0xe93ef0[_0xea1d('0x23')]()[_0xea1d('0x24')](function(){var _0x1a00aa=_0xe93ef0[_0xea1d('0x25')]({'plain':!![]});var _0x37b1e7=_0xea1d('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x37b1e7,'resourceId':_0x1a00aa['id']}})[_0xea1d('0x24')](function(){return _0xe93ef0;});})[_0xea1d('0x24')](function(){_0xede85f[_0xea1d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x590c92,_0x54a5b9){return function(_0xec0b0b){if(!_0xec0b0b){_0x590c92[_0xea1d('0x16')](0x194);}return _0xec0b0b;};}function handleError(_0x12dadb,_0x1243d5){_0x1243d5=_0x1243d5||0x1f4;return function(_0x3a738f){logger['error'](_0x3a738f['stack']);if(_0x3a738f[_0xea1d('0x27')]){delete _0x3a738f['name'];}_0x12dadb[_0xea1d('0x17')](_0x1243d5)['send'](_0x3a738f);};}exports['index']=function(_0x5cd4f2,_0x371577){var _0x1d5d6d={},_0x378df5={},_0x5f3a36={'count':0x0,'rows':[]};var _0x1c1512=_[_0xea1d('0x28')](db[_0xea1d('0x29')]['rawAttributes'],function(_0x444222){return{'name':_0x444222[_0xea1d('0x2a')],'type':_0x444222[_0xea1d('0x2b')][_0xea1d('0x2c')]};});_0x378df5[_0xea1d('0x2d')]=_['map'](_0x1c1512,_0xea1d('0x27'));_0x378df5['query']=_[_0xea1d('0x2e')](_0x5cd4f2['query']);_0x378df5[_0xea1d('0x2f')]=_[_0xea1d('0x30')](_0x378df5[_0xea1d('0x2d')],_0x378df5[_0xea1d('0x31')]);_0x1d5d6d[_0xea1d('0x32')]=_[_0xea1d('0x30')](_0x378df5['model'],qs[_0xea1d('0x33')](_0x5cd4f2[_0xea1d('0x31')][_0xea1d('0x33')]));_0x1d5d6d[_0xea1d('0x32')]=_0x1d5d6d[_0xea1d('0x32')][_0xea1d('0x34')]?_0x1d5d6d['attributes']:_0x378df5['model'];if(!_0x5cd4f2[_0xea1d('0x31')][_0xea1d('0x35')](_0xea1d('0x36'))){_0x1d5d6d[_0xea1d('0x1c')]=qs[_0xea1d('0x1c')](_0x5cd4f2['query'][_0xea1d('0x1c')]);_0x1d5d6d[_0xea1d('0x1a')]=qs[_0xea1d('0x1a')](_0x5cd4f2[_0xea1d('0x31')][_0xea1d('0x1a')]);}_0x1d5d6d[_0xea1d('0x37')]=qs[_0xea1d('0x38')](_0x5cd4f2[_0xea1d('0x31')][_0xea1d('0x38')]);_0x1d5d6d['where']=qs[_0xea1d('0x2f')](_[_0xea1d('0x39')](_0x5cd4f2[_0xea1d('0x31')],_0x378df5['filters']),_0x1c1512);if(_0x5cd4f2['query'][_0xea1d('0x3a')]){_0x1d5d6d[_0xea1d('0x3b')]=_['merge'](_0x1d5d6d[_0xea1d('0x3b')],{'$or':_[_0xea1d('0x28')](_0x1c1512,function(_0x225236){if(_0x225236[_0xea1d('0x2b')]!==_0xea1d('0x3c')){var _0x4ee6b9={};_0x4ee6b9[_0x225236[_0xea1d('0x27')]]={'$like':'%'+_0x5cd4f2[_0xea1d('0x31')][_0xea1d('0x3a')]+'%'};return _0x4ee6b9;}})});}_0x1d5d6d=_[_0xea1d('0x3d')]({},_0x1d5d6d,_0x5cd4f2[_0xea1d('0x3e')]);var _0x12a05b={'where':_0x1d5d6d[_0xea1d('0x3b')]};return db[_0xea1d('0x29')]['count'](_0x12a05b)[_0xea1d('0x24')](function(_0x57255e){_0x5f3a36[_0xea1d('0x1d')]=_0x57255e;if(_0x5cd4f2[_0xea1d('0x31')][_0xea1d('0x3f')]){_0x1d5d6d[_0xea1d('0x40')]=[{'all':!![]}];}return db[_0xea1d('0x29')]['findAll'](_0x1d5d6d);})[_0xea1d('0x24')](function(_0x1ab3c3){_0x5f3a36['rows']=_0x1ab3c3;return _0x5f3a36;})[_0xea1d('0x24')](respondWithFilteredResult(_0x371577,_0x1d5d6d))['catch'](handleError(_0x371577,null));};exports[_0xea1d('0x41')]=function(_0x1a17c4,_0x33f46f){var _0xcc97ad={'raw':!![],'where':{'id':_0x1a17c4[_0xea1d('0x42')]['id']}},_0x24ab08={};_0x24ab08[_0xea1d('0x2d')]=_[_0xea1d('0x2e')](db[_0xea1d('0x29')][_0xea1d('0x43')]);_0x24ab08[_0xea1d('0x31')]=_[_0xea1d('0x2e')](_0x1a17c4[_0xea1d('0x31')]);_0x24ab08[_0xea1d('0x2f')]=_['intersection'](_0x24ab08[_0xea1d('0x2d')],_0x24ab08[_0xea1d('0x31')]);_0xcc97ad[_0xea1d('0x32')]=_[_0xea1d('0x30')](_0x24ab08[_0xea1d('0x2d')],qs[_0xea1d('0x33')](_0x1a17c4['query'][_0xea1d('0x33')]));_0xcc97ad[_0xea1d('0x32')]=_0xcc97ad[_0xea1d('0x32')][_0xea1d('0x34')]?_0xcc97ad['attributes']:_0x24ab08['model'];if(_0x1a17c4[_0xea1d('0x31')][_0xea1d('0x3f')]){_0xcc97ad['include']=[{'all':!![]}];}_0xcc97ad=_['merge']({},_0xcc97ad,_0x1a17c4[_0xea1d('0x3e')]);return db[_0xea1d('0x29')][_0xea1d('0x44')](_0xcc97ad)['then'](handleEntityNotFound(_0x33f46f,null))[_0xea1d('0x24')](respondWithResult(_0x33f46f,null))[_0xea1d('0x45')](handleError(_0x33f46f,null));};exports[_0xea1d('0x46')]=function(_0x4c6088,_0x4caf16){return db['CmContactHasItem'][_0xea1d('0x46')](_0x4c6088['body'],{})[_0xea1d('0x24')](function(_0x5cab8c){var _0x160583=_0x4c6088['user']['get']({'plain':!![]});if(!_0x160583)throw new Error(_0xea1d('0x47'));if(_0x160583[_0xea1d('0x48')]===_0xea1d('0x49')){var _0x293f30=_0x5cab8c[_0xea1d('0x25')]({'plain':!![]});var _0x3ce76f=_0xea1d('0x26');return db[_0xea1d('0x4a')][_0xea1d('0x44')]({'where':{'name':_0x3ce76f,'userProfileId':_0x160583['userProfileId']},'raw':!![]})[_0xea1d('0x24')](function(_0x5bc6ff){if(_0x5bc6ff&&_0x5bc6ff[_0xea1d('0x4b')]===0x0){return db[_0xea1d('0x4c')][_0xea1d('0x46')]({'name':_0x293f30['name'],'resourceId':_0x293f30['id'],'type':_0x5bc6ff[_0xea1d('0x27')],'sectionId':_0x5bc6ff['id']},{})[_0xea1d('0x24')](function(){return _0x5cab8c;});}else{return _0x5cab8c;}})[_0xea1d('0x45')](function(_0xcbb5ca){logger['error'](_0xea1d('0x4d'),_0xcbb5ca);throw _0xcbb5ca;});}return _0x5cab8c;})[_0xea1d('0x24')](respondWithResult(_0x4caf16,0xc9))[_0xea1d('0x45')](handleError(_0x4caf16,null));};exports[_0xea1d('0x22')]=function(_0x2b0530,_0x40bb15){if(_0x2b0530[_0xea1d('0x4e')]['id']){delete _0x2b0530[_0xea1d('0x4e')]['id'];}return db[_0xea1d('0x29')][_0xea1d('0x44')]({'where':{'id':_0x2b0530['params']['id']}})[_0xea1d('0x24')](handleEntityNotFound(_0x40bb15,null))[_0xea1d('0x24')](saveUpdates(_0x2b0530[_0xea1d('0x4e')],null))[_0xea1d('0x24')](respondWithResult(_0x40bb15,null))[_0xea1d('0x45')](handleError(_0x40bb15,null));};exports['destroy']=function(_0x4217d0,_0x23a583){return db[_0xea1d('0x29')][_0xea1d('0x44')]({'where':{'id':_0x4217d0[_0xea1d('0x42')]['id']}})[_0xea1d('0x24')](handleEntityNotFound(_0x23a583,null))[_0xea1d('0x24')](removeEntity(_0x23a583,null))['catch'](handleError(_0x23a583,null));};
\ No newline at end of file