Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / contactItemType / contactItemType.controller.js
index 42c75cb..40d363f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb78e=['find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','CmContactHasItem','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','json','apply','reject','save','destroy','ContactItemTypes','UserProfileResource','then','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show'];(function(_0x4a70c3,_0x6b0d4f){var _0x3e0aec=function(_0x3a96cf){while(--_0x3a96cf){_0x4a70c3['push'](_0x4a70c3['shift']());}};_0x3e0aec(++_0x6b0d4f);}(_0xb78e,0x1c9));var _0xeb78=function(_0x5a9aff,_0x11e48c){_0x5a9aff=_0x5a9aff-0x0;var _0x4824d1=_0xb78e[_0x5a9aff];return _0x4824d1;};'use strict';var emlformat=require(_0xeb78('0x0'));var rimraf=require(_0xeb78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb78('0x2'));var rp=require(_0xeb78('0x3'));var moment=require(_0xeb78('0x4'));var BPromise=require(_0xeb78('0x5'));var Mustache=require(_0xeb78('0x6'));var util=require(_0xeb78('0x7'));var path=require(_0xeb78('0x8'));var sox=require(_0xeb78('0x9'));var csv=require('to-csv');var ejs=require(_0xeb78('0xa'));var fs=require('fs');var fs_extra=require(_0xeb78('0xb'));var _=require(_0xeb78('0xc'));var squel=require(_0xeb78('0xd'));var crypto=require(_0xeb78('0xe'));var jsforce=require(_0xeb78('0xf'));var deskjs=require(_0xeb78('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeb78('0x11'));var Papa=require(_0xeb78('0x12'));var Redis=require(_0xeb78('0x13'));var authService=require(_0xeb78('0x14'));var qs=require(_0xeb78('0x15'));var as=require(_0xeb78('0x16'));var hardwareService=require(_0xeb78('0x17'));var logger=require(_0xeb78('0x18'))(_0xeb78('0x19'));var utils=require('../../config/utils');var config=require(_0xeb78('0x1a'));var licenseUtil=require(_0xeb78('0x1b'));var db=require(_0xeb78('0x1c'))['db'];function respondWithStatusCode(_0x259df2,_0x9dbe51){_0x9dbe51=_0x9dbe51||0xcc;return function(_0x28c58c){if(_0x28c58c){return _0x259df2[_0xeb78('0x1d')](_0x9dbe51);}return _0x259df2[_0xeb78('0x1e')](_0x9dbe51)[_0xeb78('0x1f')]();};}function respondWithResult(_0x9bcc79,_0x5d50cf){_0x5d50cf=_0x5d50cf||0xc8;return function(_0x315914){if(_0x315914){return _0x9bcc79[_0xeb78('0x1e')](_0x5d50cf)['json'](_0x315914);}};}function respondWithFilteredResult(_0x538485,_0x53be89){return function(_0x23a0d0){if(_0x23a0d0){var _0x50ebae=typeof _0x53be89[_0xeb78('0x20')]===_0xeb78('0x21')&&typeof _0x53be89['limit']===_0xeb78('0x21');var _0x53c811=_0x23a0d0[_0xeb78('0x22')];var _0x92e410=_0x50ebae?0x0:_0x53be89['offset'];var _0x45176e=_0x50ebae?_0x23a0d0[_0xeb78('0x22')]:_0x53be89[_0xeb78('0x20')]+_0x53be89['limit'];var _0x24d845;if(_0x45176e>=_0x53c811){_0x45176e=_0x53c811;_0x24d845=0xc8;}else{_0x24d845=0xce;}_0x538485[_0xeb78('0x1e')](_0x24d845);return _0x538485['set']('Content-Range',_0x92e410+'-'+_0x45176e+'/'+_0x53c811)[_0xeb78('0x23')](_0x23a0d0);}return null;};}function patchUpdates(_0x106c5d){return function(_0x42eacb){try{jsonpatch[_0xeb78('0x24')](_0x42eacb,_0x106c5d,!![]);}catch(_0x432b18){return BPromise[_0xeb78('0x25')](_0x432b18);}return _0x42eacb[_0xeb78('0x26')]();};}function saveUpdates(_0x3ea071,_0x18f08d){return function(_0x52b8c1){if(_0x52b8c1){return _0x52b8c1['update'](_0x3ea071)['then'](function(_0x5c9e0d){return _0x5c9e0d;});}return null;};}function removeEntity(_0x3c8e66,_0x5b15d8){return function(_0x2159c1){if(_0x2159c1){return _0x2159c1[_0xeb78('0x27')]()['then'](function(){var _0x777ca3=_0x2159c1['get']({'plain':!![]});var _0x9a00b=_0xeb78('0x28');return db[_0xeb78('0x29')][_0xeb78('0x27')]({'where':{'type':_0x9a00b,'resourceId':_0x777ca3['id']}})['then'](function(){return _0x2159c1;});})[_0xeb78('0x2a')](function(){_0x3c8e66['status'](0xcc)[_0xeb78('0x1f')]();});}};}function handleEntityNotFound(_0x23295a,_0x4493bb){return function(_0x5263fc){if(!_0x5263fc){_0x23295a[_0xeb78('0x1d')](0x194);}return _0x5263fc;};}function handleError(_0x1e7d56,_0x1c04dd){_0x1c04dd=_0x1c04dd||0x1f4;return function(_0x381b2f){logger[_0xeb78('0x2b')](_0x381b2f[_0xeb78('0x2c')]);if(_0x381b2f[_0xeb78('0x2d')]){delete _0x381b2f[_0xeb78('0x2d')];}_0x1e7d56[_0xeb78('0x1e')](_0x1c04dd)[_0xeb78('0x2e')](_0x381b2f);};}exports[_0xeb78('0x2f')]=function(_0x505468,_0x555d89){var _0x4d12a3={},_0xb3a935={},_0x4253ea={'count':0x0,'rows':[]};var _0x15327f=_['map'](db[_0xeb78('0x30')][_0xeb78('0x31')],function(_0x3de59f){return{'name':_0x3de59f[_0xeb78('0x32')],'type':_0x3de59f[_0xeb78('0x33')][_0xeb78('0x34')]};});_0xb3a935[_0xeb78('0x35')]=_[_0xeb78('0x36')](_0x15327f,_0xeb78('0x2d'));_0xb3a935['query']=_[_0xeb78('0x37')](_0x505468['query']);_0xb3a935[_0xeb78('0x38')]=_[_0xeb78('0x39')](_0xb3a935[_0xeb78('0x35')],_0xb3a935[_0xeb78('0x3a')]);_0x4d12a3[_0xeb78('0x3b')]=_[_0xeb78('0x39')](_0xb3a935['model'],qs['fields'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x3c')]));_0x4d12a3[_0xeb78('0x3b')]=_0x4d12a3[_0xeb78('0x3b')][_0xeb78('0x3d')]?_0x4d12a3['attributes']:_0xb3a935[_0xeb78('0x35')];if(!_0x505468[_0xeb78('0x3a')][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x4d12a3[_0xeb78('0x40')]=qs[_0xeb78('0x40')](_0x505468['query']['limit']);_0x4d12a3['offset']=qs['offset'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x20')]);}_0x4d12a3[_0xeb78('0x41')]=qs['sort'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x42')]);_0x4d12a3['where']=qs['filters'](_['pick'](_0x505468[_0xeb78('0x3a')],_0xb3a935[_0xeb78('0x38')]),_0x15327f);if(_0x505468[_0xeb78('0x3a')]['filter']){_0x4d12a3[_0xeb78('0x43')]=_[_0xeb78('0x44')](_0x4d12a3[_0xeb78('0x43')],{'$or':_['map'](_0x15327f,function(_0xf0f13c){if(_0xf0f13c[_0xeb78('0x33')]!==_0xeb78('0x45')){var _0x437590={};_0x437590[_0xf0f13c['name']]={'$like':'%'+_0x505468['query'][_0xeb78('0x46')]+'%'};return _0x437590;}})});}_0x4d12a3=_[_0xeb78('0x44')]({},_0x4d12a3,_0x505468[_0xeb78('0x47')]);var _0x183095={'where':_0x4d12a3[_0xeb78('0x43')]};return db[_0xeb78('0x30')][_0xeb78('0x22')](_0x183095)[_0xeb78('0x2a')](function(_0x47567d){_0x4253ea['count']=_0x47567d;if(_0x505468[_0xeb78('0x3a')][_0xeb78('0x48')]){_0x4d12a3[_0xeb78('0x49')]=[{'all':!![]}];}return db['ContactItemType'][_0xeb78('0x4a')](_0x4d12a3);})['then'](function(_0x21f81b){_0x4253ea[_0xeb78('0x4b')]=_0x21f81b;return _0x4253ea;})[_0xeb78('0x2a')](respondWithFilteredResult(_0x555d89,_0x4d12a3))['catch'](handleError(_0x555d89,null));};exports[_0xeb78('0x4c')]=function(_0x3ab487,_0x390051){var _0x2944d8={'raw':!![],'where':{'id':_0x3ab487['params']['id']}},_0x2dc9f7={};_0x2dc9f7[_0xeb78('0x35')]=_[_0xeb78('0x37')](db['ContactItemType'][_0xeb78('0x31')]);_0x2dc9f7[_0xeb78('0x3a')]=_[_0xeb78('0x37')](_0x3ab487['query']);_0x2dc9f7[_0xeb78('0x38')]=_[_0xeb78('0x39')](_0x2dc9f7[_0xeb78('0x35')],_0x2dc9f7[_0xeb78('0x3a')]);_0x2944d8[_0xeb78('0x3b')]=_[_0xeb78('0x39')](_0x2dc9f7['model'],qs['fields'](_0x3ab487[_0xeb78('0x3a')][_0xeb78('0x3c')]));_0x2944d8['attributes']=_0x2944d8[_0xeb78('0x3b')][_0xeb78('0x3d')]?_0x2944d8[_0xeb78('0x3b')]:_0x2dc9f7[_0xeb78('0x35')];if(_0x3ab487[_0xeb78('0x3a')][_0xeb78('0x48')]){_0x2944d8[_0xeb78('0x49')]=[{'all':!![]}];}_0x2944d8=_[_0xeb78('0x44')]({},_0x2944d8,_0x3ab487[_0xeb78('0x47')]);return db[_0xeb78('0x30')][_0xeb78('0x4d')](_0x2944d8)[_0xeb78('0x2a')](handleEntityNotFound(_0x390051,null))[_0xeb78('0x2a')](respondWithResult(_0x390051,null))[_0xeb78('0x4e')](handleError(_0x390051,null));};exports[_0xeb78('0x4f')]=function(_0x58e361,_0x2c4616){return db[_0xeb78('0x30')][_0xeb78('0x4f')](_0x58e361[_0xeb78('0x50')],{})['then'](function(_0x35cedb){var _0x135106=_0x58e361[_0xeb78('0x51')][_0xeb78('0x52')]({'plain':!![]});if(!_0x135106)throw new Error(_0xeb78('0x53'));if(_0x135106['role']==='user'){var _0x553f6d=_0x35cedb[_0xeb78('0x52')]({'plain':!![]});var _0x21ee21='ContactItemTypes';return db[_0xeb78('0x54')][_0xeb78('0x4d')]({'where':{'name':_0x21ee21,'userProfileId':_0x135106[_0xeb78('0x55')]},'raw':!![]})['then'](function(_0x4d6a21){if(_0x4d6a21&&_0x4d6a21[_0xeb78('0x56')]===0x0){return db[_0xeb78('0x29')][_0xeb78('0x4f')]({'name':_0x553f6d['name'],'resourceId':_0x553f6d['id'],'type':_0x4d6a21[_0xeb78('0x2d')],'sectionId':_0x4d6a21['id']},{})[_0xeb78('0x2a')](function(){return _0x35cedb;});}else{return _0x35cedb;}})[_0xeb78('0x4e')](function(_0x4a3c91){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a3c91);throw _0x4a3c91;});}return _0x35cedb;})[_0xeb78('0x2a')](respondWithResult(_0x2c4616,0xc9))[_0xeb78('0x4e')](handleError(_0x2c4616,null));};exports['update']=function(_0x2b42f6,_0x31eb10){if(_0x2b42f6[_0xeb78('0x50')]['id']){delete _0x2b42f6['body']['id'];}return db[_0xeb78('0x30')]['find']({'where':{'id':_0x2b42f6[_0xeb78('0x57')]['id']}})[_0xeb78('0x2a')](handleEntityNotFound(_0x31eb10,null))[_0xeb78('0x2a')](saveUpdates(_0x2b42f6['body'],null))['then'](respondWithResult(_0x31eb10,null))['catch'](handleError(_0x31eb10,null));};exports['destroy']=function(_0x3238e9,_0x51f51f){return db[_0xeb78('0x30')][_0xeb78('0x4d')]({'where':{'id':_0x3238e9[_0xeb78('0x57')]['id']}})[_0xeb78('0x2a')](handleEntityNotFound(_0x51f51f,null))[_0xeb78('0x2a')](db[_0xeb78('0x58')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3238e9['params']['id']}}))[_0xeb78('0x2a')](removeEntity(_0x51f51f,null))[_0xeb78('0x4e')](handleError(_0x51f51f,null));};
\ No newline at end of file
+var _0xcf2f=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','ContactItemTypes','UserProfileResource','destroy','end','sendStatus','stack','name','send','map','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','ContactItemType','includeAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x1a85b5,_0x2e86ce){var _0x182ebf=function(_0x240765){while(--_0x240765){_0x1a85b5['push'](_0x1a85b5['shift']());}};_0x182ebf(++_0x2e86ce);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x191885,_0x466446){_0x191885=_0x191885-0x0;var _0x27c790=_0xcf2f[_0x191885];return _0x27c790;};'use strict';var emlformat=require(_0xfcf2('0x0'));var rimraf=require(_0xfcf2('0x1'));var zipdir=require(_0xfcf2('0x2'));var jsonpatch=require(_0xfcf2('0x3'));var rp=require(_0xfcf2('0x4'));var moment=require('moment');var BPromise=require(_0xfcf2('0x5'));var Mustache=require(_0xfcf2('0x6'));var util=require(_0xfcf2('0x7'));var path=require(_0xfcf2('0x8'));var sox=require(_0xfcf2('0x9'));var csv=require(_0xfcf2('0xa'));var ejs=require(_0xfcf2('0xb'));var fs=require('fs');var fs_extra=require(_0xfcf2('0xc'));var _=require(_0xfcf2('0xd'));var squel=require(_0xfcf2('0xe'));var crypto=require(_0xfcf2('0xf'));var jsforce=require(_0xfcf2('0x10'));var deskjs=require(_0xfcf2('0x11'));var toCsv=require(_0xfcf2('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcf2('0x12'));var qs=require(_0xfcf2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcf2('0x14'));var logger=require(_0xfcf2('0x15'))(_0xfcf2('0x16'));var utils=require(_0xfcf2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfcf2('0x18'))['db'];function respondWithStatusCode(_0x1ba610,_0x175ac9){_0x175ac9=_0x175ac9||0xcc;return function(_0x1be8cc){if(_0x1be8cc){return _0x1ba610['sendStatus'](_0x175ac9);}return _0x1ba610[_0xfcf2('0x19')](_0x175ac9)['end']();};}function respondWithResult(_0x5b414a,_0x5dc04b){_0x5dc04b=_0x5dc04b||0xc8;return function(_0xc87ff4){if(_0xc87ff4){return _0x5b414a['status'](_0x5dc04b)[_0xfcf2('0x1a')](_0xc87ff4);}};}function respondWithFilteredResult(_0x1febf8,_0x245f9a){return function(_0x21f7d1){if(_0x21f7d1){var _0x315b2f=typeof _0x245f9a[_0xfcf2('0x1b')]===_0xfcf2('0x1c')&&typeof _0x245f9a['limit']===_0xfcf2('0x1c');var _0x213125=_0x21f7d1[_0xfcf2('0x1d')];var _0x581d78=_0x315b2f?0x0:_0x245f9a[_0xfcf2('0x1b')];var _0x1b3c89=_0x315b2f?_0x21f7d1[_0xfcf2('0x1d')]:_0x245f9a[_0xfcf2('0x1b')]+_0x245f9a[_0xfcf2('0x1e')];var _0x53c406;if(_0x1b3c89>=_0x213125){_0x1b3c89=_0x213125;_0x53c406=0xc8;}else{_0x53c406=0xce;}_0x1febf8[_0xfcf2('0x19')](_0x53c406);return _0x1febf8[_0xfcf2('0x1f')]('Content-Range',_0x581d78+'-'+_0x1b3c89+'/'+_0x213125)[_0xfcf2('0x1a')](_0x21f7d1);}return null;};}function patchUpdates(_0x23c079){return function(_0x206738){try{jsonpatch[_0xfcf2('0x20')](_0x206738,_0x23c079,!![]);}catch(_0x51e0b7){return BPromise[_0xfcf2('0x21')](_0x51e0b7);}return _0x206738[_0xfcf2('0x22')]();};}function saveUpdates(_0x422c5a,_0x1eeebd){return function(_0x5afab5){if(_0x5afab5){return _0x5afab5[_0xfcf2('0x23')](_0x422c5a)[_0xfcf2('0x24')](function(_0x232f6f){return _0x232f6f;});}return null;};}function removeEntity(_0x584e76,_0x26641a){return function(_0x151aa8){if(_0x151aa8){return _0x151aa8['destroy']()[_0xfcf2('0x24')](function(){var _0xbc8722=_0x151aa8['get']({'plain':!![]});var _0x1e6f14=_0xfcf2('0x25');return db[_0xfcf2('0x26')][_0xfcf2('0x27')]({'where':{'type':_0x1e6f14,'resourceId':_0xbc8722['id']}})['then'](function(){return _0x151aa8;});})[_0xfcf2('0x24')](function(){_0x584e76[_0xfcf2('0x19')](0xcc)[_0xfcf2('0x28')]();});}};}function handleEntityNotFound(_0x3779ee,_0x17c994){return function(_0x2b1d60){if(!_0x2b1d60){_0x3779ee[_0xfcf2('0x29')](0x194);}return _0x2b1d60;};}function handleError(_0x1c8f38,_0x23c09c){_0x23c09c=_0x23c09c||0x1f4;return function(_0x56f839){logger['error'](_0x56f839[_0xfcf2('0x2a')]);if(_0x56f839[_0xfcf2('0x2b')]){delete _0x56f839[_0xfcf2('0x2b')];}_0x1c8f38['status'](_0x23c09c)[_0xfcf2('0x2c')](_0x56f839);};}exports['index']=function(_0x3ce9f8,_0x26651e){var _0x40c1ae={},_0x1a4485={},_0x313884={'count':0x0,'rows':[]};var _0x3760ad=_[_0xfcf2('0x2d')](db['ContactItemType']['rawAttributes'],function(_0xfc3b86){return{'name':_0xfc3b86[_0xfcf2('0x2e')],'type':_0xfc3b86[_0xfcf2('0x2f')][_0xfcf2('0x30')]};});_0x1a4485['model']=_['map'](_0x3760ad,_0xfcf2('0x2b'));_0x1a4485['query']=_[_0xfcf2('0x31')](_0x3ce9f8[_0xfcf2('0x32')]);_0x1a4485['filters']=_[_0xfcf2('0x33')](_0x1a4485[_0xfcf2('0x34')],_0x1a4485[_0xfcf2('0x32')]);_0x40c1ae[_0xfcf2('0x35')]=_[_0xfcf2('0x33')](_0x1a4485[_0xfcf2('0x34')],qs[_0xfcf2('0x36')](_0x3ce9f8['query'][_0xfcf2('0x36')]));_0x40c1ae[_0xfcf2('0x35')]=_0x40c1ae['attributes'][_0xfcf2('0x37')]?_0x40c1ae[_0xfcf2('0x35')]:_0x1a4485['model'];if(!_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x38')]('nolimit')){_0x40c1ae[_0xfcf2('0x1e')]=qs[_0xfcf2('0x1e')](_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x1e')]);_0x40c1ae['offset']=qs[_0xfcf2('0x1b')](_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x1b')]);}_0x40c1ae[_0xfcf2('0x39')]=qs[_0xfcf2('0x3a')](_0x3ce9f8['query'][_0xfcf2('0x3a')]);_0x40c1ae[_0xfcf2('0x3b')]=qs[_0xfcf2('0x3c')](_[_0xfcf2('0x3d')](_0x3ce9f8[_0xfcf2('0x32')],_0x1a4485['filters']),_0x3760ad);if(_0x3ce9f8[_0xfcf2('0x32')]['filter']){_0x40c1ae[_0xfcf2('0x3b')]=_[_0xfcf2('0x3e')](_0x40c1ae[_0xfcf2('0x3b')],{'$or':_[_0xfcf2('0x2d')](_0x3760ad,function(_0x2fd2ef){if(_0x2fd2ef['type']!==_0xfcf2('0x3f')){var _0x341505={};_0x341505[_0x2fd2ef[_0xfcf2('0x2b')]]={'$like':'%'+_0x3ce9f8['query'][_0xfcf2('0x40')]+'%'};return _0x341505;}})});}_0x40c1ae=_[_0xfcf2('0x3e')]({},_0x40c1ae,_0x3ce9f8[_0xfcf2('0x41')]);var _0x320c19={'where':_0x40c1ae[_0xfcf2('0x3b')]};return db[_0xfcf2('0x42')]['count'](_0x320c19)['then'](function(_0x526c42){_0x313884[_0xfcf2('0x1d')]=_0x526c42;if(_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x43')]){_0x40c1ae['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x40c1ae);})[_0xfcf2('0x24')](function(_0xab0747){_0x313884[_0xfcf2('0x44')]=_0xab0747;return _0x313884;})[_0xfcf2('0x24')](respondWithFilteredResult(_0x26651e,_0x40c1ae))[_0xfcf2('0x45')](handleError(_0x26651e,null));};exports[_0xfcf2('0x46')]=function(_0x2c8ba2,_0x16cc21){var _0x2b790b={'raw':!![],'where':{'id':_0x2c8ba2[_0xfcf2('0x47')]['id']}},_0x467ecd={};_0x467ecd['model']=_['keys'](db[_0xfcf2('0x42')][_0xfcf2('0x48')]);_0x467ecd[_0xfcf2('0x32')]=_[_0xfcf2('0x31')](_0x2c8ba2[_0xfcf2('0x32')]);_0x467ecd[_0xfcf2('0x3c')]=_[_0xfcf2('0x33')](_0x467ecd[_0xfcf2('0x34')],_0x467ecd[_0xfcf2('0x32')]);_0x2b790b[_0xfcf2('0x35')]=_[_0xfcf2('0x33')](_0x467ecd[_0xfcf2('0x34')],qs[_0xfcf2('0x36')](_0x2c8ba2[_0xfcf2('0x32')][_0xfcf2('0x36')]));_0x2b790b[_0xfcf2('0x35')]=_0x2b790b[_0xfcf2('0x35')]['length']?_0x2b790b[_0xfcf2('0x35')]:_0x467ecd[_0xfcf2('0x34')];if(_0x2c8ba2['query'][_0xfcf2('0x43')]){_0x2b790b['include']=[{'all':!![]}];}_0x2b790b=_[_0xfcf2('0x3e')]({},_0x2b790b,_0x2c8ba2[_0xfcf2('0x41')]);return db[_0xfcf2('0x42')][_0xfcf2('0x49')](_0x2b790b)['then'](handleEntityNotFound(_0x16cc21,null))['then'](respondWithResult(_0x16cc21,null))['catch'](handleError(_0x16cc21,null));};exports[_0xfcf2('0x4a')]=function(_0x37d4bb,_0x20fcab){return db[_0xfcf2('0x42')]['create'](_0x37d4bb[_0xfcf2('0x4b')],{})[_0xfcf2('0x24')](function(_0x3b981c){var _0x548c6c=_0x37d4bb[_0xfcf2('0x4c')][_0xfcf2('0x4d')]({'plain':!![]});if(!_0x548c6c)throw new Error(_0xfcf2('0x4e'));if(_0x548c6c[_0xfcf2('0x4f')]===_0xfcf2('0x4c')){var _0x4af270=_0x3b981c[_0xfcf2('0x4d')]({'plain':!![]});var _0x1260a4=_0xfcf2('0x25');return db[_0xfcf2('0x50')][_0xfcf2('0x49')]({'where':{'name':_0x1260a4,'userProfileId':_0x548c6c[_0xfcf2('0x51')]},'raw':!![]})['then'](function(_0x5d162d){if(_0x5d162d&&_0x5d162d['autoAssociation']===0x0){return db[_0xfcf2('0x26')][_0xfcf2('0x4a')]({'name':_0x4af270['name'],'resourceId':_0x4af270['id'],'type':_0x5d162d['name'],'sectionId':_0x5d162d['id']},{})[_0xfcf2('0x24')](function(){return _0x3b981c;});}else{return _0x3b981c;}})[_0xfcf2('0x45')](function(_0x137a47){logger['error'](_0xfcf2('0x52'),_0x137a47);throw _0x137a47;});}return _0x3b981c;})[_0xfcf2('0x24')](respondWithResult(_0x20fcab,0xc9))['catch'](handleError(_0x20fcab,null));};exports['update']=function(_0xfc4b7b,_0x51f636){if(_0xfc4b7b[_0xfcf2('0x4b')]['id']){delete _0xfc4b7b[_0xfcf2('0x4b')]['id'];}return db['ContactItemType'][_0xfcf2('0x49')]({'where':{'id':_0xfc4b7b['params']['id']}})[_0xfcf2('0x24')](handleEntityNotFound(_0x51f636,null))['then'](saveUpdates(_0xfc4b7b[_0xfcf2('0x4b')],null))[_0xfcf2('0x24')](respondWithResult(_0x51f636,null))[_0xfcf2('0x45')](handleError(_0x51f636,null));};exports['destroy']=function(_0x235b06,_0x27bae5){return db[_0xfcf2('0x42')][_0xfcf2('0x49')]({'where':{'id':_0x235b06[_0xfcf2('0x47')]['id']}})[_0xfcf2('0x24')](handleEntityNotFound(_0x27bae5,null))[_0xfcf2('0x24')](db['CmContactHasItem'][_0xfcf2('0x23')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x235b06[_0xfcf2('0x47')]['id']}}))['then'](removeEntity(_0x27bae5,null))[_0xfcf2('0x45')](handleError(_0x27bae5,null));};
\ No newline at end of file