Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / api / contactItemType / contactItemType.controller.js
index 35a5caf..94cd805 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70b8=['limit','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','error','stack','name','send','render','merge','body','contact','message','agent','account','index','map','ContactItemType','rawAttributes','key','filters','intersection','model','query','attributes','fields','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','user','role','ContactItemTypes','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70b8,0xf4));var _0x870b=function(_0x699d31,_0x513869){_0x699d31=_0x699d31-0x0;var _0x3365eb=_0x70b8[_0x699d31];return _0x3365eb;};'use strict';var emlformat=require(_0x870b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x870b('0x1'));var jsonpatch=require(_0x870b('0x2'));var rp=require(_0x870b('0x3'));var moment=require(_0x870b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x870b('0x5'));var util=require(_0x870b('0x6'));var path=require(_0x870b('0x7'));var sox=require(_0x870b('0x8'));var csv=require('to-csv');var ejs=require(_0x870b('0x9'));var fs=require('fs');var fs_extra=require(_0x870b('0xa'));var _=require('lodash');var squel=require(_0x870b('0xb'));var crypto=require(_0x870b('0xc'));var jsforce=require(_0x870b('0xd'));var deskjs=require(_0x870b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x870b('0xf'));var Papa=require(_0x870b('0x10'));var Redis=require(_0x870b('0x11'));var authService=require(_0x870b('0x12'));var qs=require(_0x870b('0x13'));var as=require(_0x870b('0x14'));var hardwareService=require(_0x870b('0x15'));var logger=require(_0x870b('0x16'))(_0x870b('0x17'));var utils=require(_0x870b('0x18'));var config=require(_0x870b('0x19'));var licenseUtil=require(_0x870b('0x1a'));var db=require(_0x870b('0x1b'))['db'];function respondWithStatusCode(_0x173828,_0x2c0908){_0x2c0908=_0x2c0908||0xcc;return function(_0x4fb015){if(_0x4fb015){return _0x173828[_0x870b('0x1c')](_0x2c0908);}return _0x173828[_0x870b('0x1d')](_0x2c0908)[_0x870b('0x1e')]();};}function respondWithResult(_0x2ea5ad,_0x33e84b){_0x33e84b=_0x33e84b||0xc8;return function(_0x395aeb){if(_0x395aeb){return _0x2ea5ad[_0x870b('0x1d')](_0x33e84b)[_0x870b('0x1f')](_0x395aeb);}};}function respondWithFilteredResult(_0x5289ed,_0x2a1021){return function(_0x4df387){if(_0x4df387){var _0x14e820=typeof _0x2a1021[_0x870b('0x20')]===_0x870b('0x21')&&typeof _0x2a1021['limit']===_0x870b('0x21');var _0x30734b=_0x4df387[_0x870b('0x22')];var _0x1051fd=_0x14e820?0x0:_0x2a1021[_0x870b('0x20')];var _0x4a3c9f=_0x14e820?_0x4df387[_0x870b('0x22')]:_0x2a1021[_0x870b('0x20')]+_0x2a1021[_0x870b('0x23')];var _0x3a01d3;if(_0x4a3c9f>=_0x30734b){_0x4a3c9f=_0x30734b;_0x3a01d3=0xc8;}else{_0x3a01d3=0xce;}_0x5289ed[_0x870b('0x1d')](_0x3a01d3);return _0x5289ed[_0x870b('0x24')](_0x870b('0x25'),_0x1051fd+'-'+_0x4a3c9f+'/'+_0x30734b)[_0x870b('0x1f')](_0x4df387);}return null;};}function patchUpdates(_0x534641){return function(_0x5d449f){try{jsonpatch[_0x870b('0x26')](_0x5d449f,_0x534641,!![]);}catch(_0x4682e0){return BPromise['reject'](_0x4682e0);}return _0x5d449f[_0x870b('0x27')]();};}function saveUpdates(_0x21f4e5,_0x1a1c2b){return function(_0x3904d7){if(_0x3904d7){return _0x3904d7['update'](_0x21f4e5)[_0x870b('0x28')](function(_0x318435){return _0x318435;});}return null;};}function removeEntity(_0x479d86,_0x4a058a){return function(_0x55b567){if(_0x55b567){return _0x55b567[_0x870b('0x29')]()['then'](function(){var _0x3e9cd8=_0x55b567[_0x870b('0x2a')]({'plain':!![]});var _0x169d61='ContactItemTypes';return db[_0x870b('0x2b')]['destroy']({'where':{'type':_0x169d61,'resourceId':_0x3e9cd8['id']}})['then'](function(){return _0x55b567;});})['then'](function(){_0x479d86[_0x870b('0x1d')](0xcc)[_0x870b('0x1e')]();});}};}function handleEntityNotFound(_0x395e91,_0x1f071a){return function(_0x30f22b){if(!_0x30f22b){_0x395e91[_0x870b('0x1c')](0x194);}return _0x30f22b;};}function handleError(_0x3c9a48,_0x367002){_0x367002=_0x367002||0x1f4;return function(_0x58e04b){logger[_0x870b('0x2c')](_0x58e04b[_0x870b('0x2d')]);if(_0x58e04b[_0x870b('0x2e')]){delete _0x58e04b[_0x870b('0x2e')];}_0x3c9a48[_0x870b('0x1d')](_0x367002)[_0x870b('0x2f')](_0x58e04b);};}function getMustacheRender(_0x15c9a7,_0x16988f){return Mustache[_0x870b('0x30')](_0x15c9a7,_[_0x870b('0x31')](_0x16988f[_0x870b('0x32')],{'contact':_0x16988f[_0x870b('0x33')],'message':_0x16988f[_0x870b('0x34')],'agent':_0x16988f[_0x870b('0x35')],'interaction':_0x16988f['interaction'],'account':_0x16988f[_0x870b('0x36')]}))||'';}exports[_0x870b('0x37')]=function(_0x14126e,_0x5e08d8){var _0x2cf62e={},_0x1a4ada={},_0x46aa77={'count':0x0,'rows':[]};var _0x7a473c=_[_0x870b('0x38')](db[_0x870b('0x39')][_0x870b('0x3a')],function(_0x3096d8){return{'name':_0x3096d8['fieldName'],'type':_0x3096d8['type'][_0x870b('0x3b')]};});_0x1a4ada['model']=_[_0x870b('0x38')](_0x7a473c,_0x870b('0x2e'));_0x1a4ada['query']=_['keys'](_0x14126e['query']);_0x1a4ada[_0x870b('0x3c')]=_[_0x870b('0x3d')](_0x1a4ada[_0x870b('0x3e')],_0x1a4ada[_0x870b('0x3f')]);_0x2cf62e[_0x870b('0x40')]=_[_0x870b('0x3d')](_0x1a4ada[_0x870b('0x3e')],qs[_0x870b('0x41')](_0x14126e['query'][_0x870b('0x41')]));_0x2cf62e['attributes']=_0x2cf62e[_0x870b('0x40')]['length']?_0x2cf62e['attributes']:_0x1a4ada['model'];if(!_0x14126e[_0x870b('0x3f')]['hasOwnProperty'](_0x870b('0x42'))){_0x2cf62e[_0x870b('0x23')]=qs[_0x870b('0x23')](_0x14126e[_0x870b('0x3f')]['limit']);_0x2cf62e[_0x870b('0x20')]=qs['offset'](_0x14126e['query']['offset']);}_0x2cf62e[_0x870b('0x43')]=qs[_0x870b('0x44')](_0x14126e[_0x870b('0x3f')][_0x870b('0x44')]);_0x2cf62e[_0x870b('0x45')]=qs[_0x870b('0x3c')](_[_0x870b('0x46')](_0x14126e[_0x870b('0x3f')],_0x1a4ada[_0x870b('0x3c')]),_0x7a473c);if(_0x14126e['query']['filter']){_0x2cf62e[_0x870b('0x45')]=_[_0x870b('0x31')](_0x2cf62e[_0x870b('0x45')],{'$or':_[_0x870b('0x38')](_0x7a473c,function(_0x2e1b7c){if(_0x2e1b7c[_0x870b('0x47')]!==_0x870b('0x48')){var _0x1787d1={};_0x1787d1[_0x2e1b7c['name']]={'$like':'%'+_0x14126e[_0x870b('0x3f')][_0x870b('0x49')]+'%'};return _0x1787d1;}})});}_0x2cf62e=_[_0x870b('0x31')]({},_0x2cf62e,_0x14126e[_0x870b('0x4a')]);var _0x105665={'where':_0x2cf62e[_0x870b('0x45')]};return db['ContactItemType']['count'](_0x105665)[_0x870b('0x28')](function(_0x3e1c5e){_0x46aa77[_0x870b('0x22')]=_0x3e1c5e;if(_0x14126e['query'][_0x870b('0x4b')]){_0x2cf62e[_0x870b('0x4c')]=[{'all':!![]}];}return db[_0x870b('0x39')][_0x870b('0x4d')](_0x2cf62e);})[_0x870b('0x28')](function(_0x3f4e57){_0x46aa77[_0x870b('0x4e')]=_0x3f4e57;return _0x46aa77;})[_0x870b('0x28')](respondWithFilteredResult(_0x5e08d8,_0x2cf62e))['catch'](handleError(_0x5e08d8,null));};exports[_0x870b('0x4f')]=function(_0x5212fb,_0x31241f){var _0x268513={'raw':!![],'where':{'id':_0x5212fb[_0x870b('0x50')]['id']}},_0x9adbcb={};_0x9adbcb['model']=_['keys'](db[_0x870b('0x39')][_0x870b('0x3a')]);_0x9adbcb[_0x870b('0x3f')]=_[_0x870b('0x51')](_0x5212fb[_0x870b('0x3f')]);_0x9adbcb[_0x870b('0x3c')]=_['intersection'](_0x9adbcb[_0x870b('0x3e')],_0x9adbcb['query']);_0x268513['attributes']=_['intersection'](_0x9adbcb[_0x870b('0x3e')],qs[_0x870b('0x41')](_0x5212fb['query']['fields']));_0x268513[_0x870b('0x40')]=_0x268513[_0x870b('0x40')][_0x870b('0x52')]?_0x268513[_0x870b('0x40')]:_0x9adbcb[_0x870b('0x3e')];if(_0x5212fb['query'][_0x870b('0x4b')]){_0x268513['include']=[{'all':!![]}];}_0x268513=_[_0x870b('0x31')]({},_0x268513,_0x5212fb[_0x870b('0x4a')]);return db[_0x870b('0x39')][_0x870b('0x53')](_0x268513)['then'](handleEntityNotFound(_0x31241f,null))['then'](respondWithResult(_0x31241f,null))['catch'](handleError(_0x31241f,null));};exports[_0x870b('0x54')]=function(_0x5e44bf,_0xd318d1){return db[_0x870b('0x39')][_0x870b('0x54')](_0x5e44bf[_0x870b('0x32')],{})[_0x870b('0x28')](function(_0x114333){var _0x3afc42=_0x5e44bf[_0x870b('0x55')]['get']({'plain':!![]});if(!_0x3afc42)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3afc42[_0x870b('0x56')]===_0x870b('0x55')){var _0xbf7b76=_0x114333['get']({'plain':!![]});var _0x5aae11=_0x870b('0x57');return db[_0x870b('0x58')][_0x870b('0x53')]({'where':{'name':_0x5aae11,'userProfileId':_0x3afc42['userProfileId']},'raw':!![]})['then'](function(_0x1d1a9b){if(_0x1d1a9b&&_0x1d1a9b[_0x870b('0x59')]===0x0){return db['UserProfileResource'][_0x870b('0x54')]({'name':_0xbf7b76[_0x870b('0x2e')],'resourceId':_0xbf7b76['id'],'type':_0x1d1a9b[_0x870b('0x2e')],'sectionId':_0x1d1a9b['id']},{})[_0x870b('0x28')](function(){return _0x114333;});}else{return _0x114333;}})[_0x870b('0x5a')](function(_0x2e633e){logger[_0x870b('0x2c')](_0x870b('0x5b'),_0x2e633e);throw _0x2e633e;});}return _0x114333;})[_0x870b('0x28')](respondWithResult(_0xd318d1,0xc9))[_0x870b('0x5a')](handleError(_0xd318d1,null));};exports[_0x870b('0x5c')]=function(_0x5b696b,_0x2e3249){if(_0x5b696b['body']['id']){delete _0x5b696b[_0x870b('0x32')]['id'];}return db[_0x870b('0x39')][_0x870b('0x53')]({'where':{'id':_0x5b696b['params']['id']}})[_0x870b('0x28')](handleEntityNotFound(_0x2e3249,null))[_0x870b('0x28')](saveUpdates(_0x5b696b['body'],null))['then'](respondWithResult(_0x2e3249,null))[_0x870b('0x5a')](handleError(_0x2e3249,null));};exports[_0x870b('0x29')]=function(_0x56d416,_0x13aa8c){return db['ContactItemType']['find']({'where':{'id':_0x56d416[_0x870b('0x50')]['id']}})[_0x870b('0x28')](handleEntityNotFound(_0x13aa8c,null))[_0x870b('0x28')](removeEntity(_0x13aa8c,null))['catch'](handleError(_0x13aa8c,null));};
\ No newline at end of file
+var _0xf092=['apply','reject','save','then','destroy','get','stack','name','render','merge','contact','message','agent','interaction','account','index','map','rawAttributes','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','ContactItemType','include','findAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range'];(function(_0x32552e,_0x2035bd){var _0x2631d8=function(_0x3cef7e){while(--_0x3cef7e){_0x32552e['push'](_0x32552e['shift']());}};_0x2631d8(++_0x2035bd);}(_0xf092,0x18d));var _0x2f09=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0xf092[_0x1ca9e9];return _0x309f3c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2f09('0x0'));var jsonpatch=require(_0x2f09('0x1'));var rp=require(_0x2f09('0x2'));var moment=require(_0x2f09('0x3'));var BPromise=require(_0x2f09('0x4'));var Mustache=require(_0x2f09('0x5'));var util=require('util');var path=require(_0x2f09('0x6'));var sox=require(_0x2f09('0x7'));var csv=require(_0x2f09('0x8'));var ejs=require(_0x2f09('0x9'));var fs=require('fs');var fs_extra=require(_0x2f09('0xa'));var _=require('lodash');var squel=require(_0x2f09('0xb'));var crypto=require(_0x2f09('0xc'));var jsforce=require(_0x2f09('0xd'));var deskjs=require(_0x2f09('0xe'));var toCsv=require(_0x2f09('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2f09('0xf'));var qs=require(_0x2f09('0x10'));var as=require(_0x2f09('0x11'));var hardwareService=require(_0x2f09('0x12'));var logger=require(_0x2f09('0x13'))(_0x2f09('0x14'));var utils=require(_0x2f09('0x15'));var config=require(_0x2f09('0x16'));var licenseUtil=require(_0x2f09('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d6e79,_0x1ceeef){_0x1ceeef=_0x1ceeef||0xcc;return function(_0xd78f67){if(_0xd78f67){return _0x4d6e79[_0x2f09('0x18')](_0x1ceeef);}return _0x4d6e79['status'](_0x1ceeef)[_0x2f09('0x19')]();};}function respondWithResult(_0x510538,_0x3032b9){_0x3032b9=_0x3032b9||0xc8;return function(_0x2c9da3){if(_0x2c9da3){return _0x510538[_0x2f09('0x1a')](_0x3032b9)[_0x2f09('0x1b')](_0x2c9da3);}};}function respondWithFilteredResult(_0x4e69d5,_0x7a979c){return function(_0x489ff0){if(_0x489ff0){var _0x3450be=typeof _0x7a979c[_0x2f09('0x1c')]==='undefined'&&typeof _0x7a979c[_0x2f09('0x1d')]===_0x2f09('0x1e');var _0x2ab541=_0x489ff0[_0x2f09('0x1f')];var _0x1ea4a3=_0x3450be?0x0:_0x7a979c[_0x2f09('0x1c')];var _0x4a111b=_0x3450be?_0x489ff0[_0x2f09('0x1f')]:_0x7a979c[_0x2f09('0x1c')]+_0x7a979c[_0x2f09('0x1d')];var _0x745c2d;if(_0x4a111b>=_0x2ab541){_0x4a111b=_0x2ab541;_0x745c2d=0xc8;}else{_0x745c2d=0xce;}_0x4e69d5[_0x2f09('0x1a')](_0x745c2d);return _0x4e69d5['set'](_0x2f09('0x20'),_0x1ea4a3+'-'+_0x4a111b+'/'+_0x2ab541)[_0x2f09('0x1b')](_0x489ff0);}return null;};}function patchUpdates(_0x5a041d){return function(_0x2ab26e){try{jsonpatch[_0x2f09('0x21')](_0x2ab26e,_0x5a041d,!![]);}catch(_0x2f66b3){return BPromise[_0x2f09('0x22')](_0x2f66b3);}return _0x2ab26e[_0x2f09('0x23')]();};}function saveUpdates(_0x28bdbc,_0x256760){return function(_0x4b8837){if(_0x4b8837){return _0x4b8837['update'](_0x28bdbc)[_0x2f09('0x24')](function(_0x56ec22){return _0x56ec22;});}return null;};}function removeEntity(_0x1fb9a7,_0x81a4f4){return function(_0x2f64ac){if(_0x2f64ac){return _0x2f64ac[_0x2f09('0x25')]()['then'](function(){var _0x301139=_0x2f64ac[_0x2f09('0x26')]({'plain':!![]});var _0x1aa3ab='ContactItemTypes';return db['UserProfileResource'][_0x2f09('0x25')]({'where':{'type':_0x1aa3ab,'resourceId':_0x301139['id']}})[_0x2f09('0x24')](function(){return _0x2f64ac;});})[_0x2f09('0x24')](function(){_0x1fb9a7[_0x2f09('0x1a')](0xcc)[_0x2f09('0x19')]();});}};}function handleEntityNotFound(_0x462719,_0x8ef0fe){return function(_0x233f45){if(!_0x233f45){_0x462719[_0x2f09('0x18')](0x194);}return _0x233f45;};}function handleError(_0x2603c0,_0x3b8aa6){_0x3b8aa6=_0x3b8aa6||0x1f4;return function(_0x216774){logger['error'](_0x216774[_0x2f09('0x27')]);if(_0x216774['name']){delete _0x216774[_0x2f09('0x28')];}_0x2603c0[_0x2f09('0x1a')](_0x3b8aa6)['send'](_0x216774);};}function getMustacheRender(_0x17fde4,_0x211651){return Mustache[_0x2f09('0x29')](_0x17fde4,_[_0x2f09('0x2a')](_0x211651['body'],{'contact':_0x211651[_0x2f09('0x2b')],'message':_0x211651[_0x2f09('0x2c')],'agent':_0x211651[_0x2f09('0x2d')],'interaction':_0x211651[_0x2f09('0x2e')],'account':_0x211651[_0x2f09('0x2f')]}))||'';}exports[_0x2f09('0x30')]=function(_0xfce90f,_0x3b6023){var _0x8672b3={},_0x590f8d={},_0x43f452={'count':0x0,'rows':[]};var _0x57d73b=_[_0x2f09('0x31')](db['ContactItemType'][_0x2f09('0x32')],function(_0x2e2133){return{'name':_0x2e2133['fieldName'],'type':_0x2e2133[_0x2f09('0x33')]['key']};});_0x590f8d[_0x2f09('0x34')]=_[_0x2f09('0x31')](_0x57d73b,_0x2f09('0x28'));_0x590f8d['query']=_[_0x2f09('0x35')](_0xfce90f[_0x2f09('0x36')]);_0x590f8d[_0x2f09('0x37')]=_['intersection'](_0x590f8d['model'],_0x590f8d[_0x2f09('0x36')]);_0x8672b3[_0x2f09('0x38')]=_['intersection'](_0x590f8d[_0x2f09('0x34')],qs[_0x2f09('0x39')](_0xfce90f[_0x2f09('0x36')][_0x2f09('0x39')]));_0x8672b3[_0x2f09('0x38')]=_0x8672b3[_0x2f09('0x38')][_0x2f09('0x3a')]?_0x8672b3[_0x2f09('0x38')]:_0x590f8d['model'];if(!_0xfce90f[_0x2f09('0x36')][_0x2f09('0x3b')](_0x2f09('0x3c'))){_0x8672b3[_0x2f09('0x1d')]=qs[_0x2f09('0x1d')](_0xfce90f[_0x2f09('0x36')][_0x2f09('0x1d')]);_0x8672b3[_0x2f09('0x1c')]=qs[_0x2f09('0x1c')](_0xfce90f[_0x2f09('0x36')][_0x2f09('0x1c')]);}_0x8672b3[_0x2f09('0x3d')]=qs['sort'](_0xfce90f['query'][_0x2f09('0x3e')]);_0x8672b3[_0x2f09('0x3f')]=qs[_0x2f09('0x37')](_[_0x2f09('0x40')](_0xfce90f[_0x2f09('0x36')],_0x590f8d['filters']),_0x57d73b);if(_0xfce90f[_0x2f09('0x36')][_0x2f09('0x41')]){_0x8672b3[_0x2f09('0x3f')]=_[_0x2f09('0x2a')](_0x8672b3[_0x2f09('0x3f')],{'$or':_[_0x2f09('0x31')](_0x57d73b,function(_0x3dbb3c){if(_0x3dbb3c['type']!==_0x2f09('0x42')){var _0x59f322={};_0x59f322[_0x3dbb3c[_0x2f09('0x28')]]={'$like':'%'+_0xfce90f['query'][_0x2f09('0x41')]+'%'};return _0x59f322;}})});}_0x8672b3=_[_0x2f09('0x2a')]({},_0x8672b3,_0xfce90f[_0x2f09('0x43')]);var _0x2c6ed6={'where':_0x8672b3[_0x2f09('0x3f')]};return db[_0x2f09('0x44')][_0x2f09('0x1f')](_0x2c6ed6)[_0x2f09('0x24')](function(_0x2d6b4e){_0x43f452['count']=_0x2d6b4e;if(_0xfce90f['query']['includeAll']){_0x8672b3[_0x2f09('0x45')]=[{'all':!![]}];}return db[_0x2f09('0x44')][_0x2f09('0x46')](_0x8672b3);})[_0x2f09('0x24')](function(_0x4fdf0e){_0x43f452[_0x2f09('0x47')]=_0x4fdf0e;return _0x43f452;})['then'](respondWithFilteredResult(_0x3b6023,_0x8672b3))[_0x2f09('0x48')](handleError(_0x3b6023,null));};exports[_0x2f09('0x49')]=function(_0x196d0d,_0x1241b2){var _0x9cb32a={'raw':!![],'where':{'id':_0x196d0d['params']['id']}},_0x4f0584={};_0x4f0584[_0x2f09('0x34')]=_[_0x2f09('0x35')](db[_0x2f09('0x44')][_0x2f09('0x32')]);_0x4f0584['query']=_[_0x2f09('0x35')](_0x196d0d[_0x2f09('0x36')]);_0x4f0584['filters']=_['intersection'](_0x4f0584['model'],_0x4f0584[_0x2f09('0x36')]);_0x9cb32a[_0x2f09('0x38')]=_['intersection'](_0x4f0584[_0x2f09('0x34')],qs[_0x2f09('0x39')](_0x196d0d[_0x2f09('0x36')][_0x2f09('0x39')]));_0x9cb32a[_0x2f09('0x38')]=_0x9cb32a[_0x2f09('0x38')][_0x2f09('0x3a')]?_0x9cb32a[_0x2f09('0x38')]:_0x4f0584['model'];if(_0x196d0d[_0x2f09('0x36')]['includeAll']){_0x9cb32a[_0x2f09('0x45')]=[{'all':!![]}];}_0x9cb32a=_[_0x2f09('0x2a')]({},_0x9cb32a,_0x196d0d[_0x2f09('0x43')]);return db['ContactItemType'][_0x2f09('0x4a')](_0x9cb32a)[_0x2f09('0x24')](handleEntityNotFound(_0x1241b2,null))[_0x2f09('0x24')](respondWithResult(_0x1241b2,null))[_0x2f09('0x48')](handleError(_0x1241b2,null));};exports[_0x2f09('0x4b')]=function(_0x513bba,_0x2ee4c1){return db[_0x2f09('0x44')]['create'](_0x513bba['body'],{})[_0x2f09('0x24')](function(_0x5a1d2b){var _0x12ed1b=_0x513bba[_0x2f09('0x4c')][_0x2f09('0x26')]({'plain':!![]});if(!_0x12ed1b)throw new Error(_0x2f09('0x4d'));if(_0x12ed1b[_0x2f09('0x4e')]===_0x2f09('0x4c')){var _0x47407c=_0x5a1d2b[_0x2f09('0x26')]({'plain':!![]});var _0x402677='ContactItemTypes';return db['UserProfileSection'][_0x2f09('0x4a')]({'where':{'name':_0x402677,'userProfileId':_0x12ed1b[_0x2f09('0x4f')]},'raw':!![]})['then'](function(_0x342a08){if(_0x342a08&&_0x342a08[_0x2f09('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x47407c['name'],'resourceId':_0x47407c['id'],'type':_0x342a08[_0x2f09('0x28')],'sectionId':_0x342a08['id']},{})[_0x2f09('0x24')](function(){return _0x5a1d2b;});}else{return _0x5a1d2b;}})[_0x2f09('0x48')](function(_0x12c522){logger[_0x2f09('0x51')](_0x2f09('0x52'),_0x12c522);throw _0x12c522;});}return _0x5a1d2b;})[_0x2f09('0x24')](respondWithResult(_0x2ee4c1,0xc9))[_0x2f09('0x48')](handleError(_0x2ee4c1,null));};exports[_0x2f09('0x53')]=function(_0x32a544,_0xde3692){if(_0x32a544[_0x2f09('0x54')]['id']){delete _0x32a544[_0x2f09('0x54')]['id'];}return db[_0x2f09('0x44')][_0x2f09('0x4a')]({'where':{'id':_0x32a544[_0x2f09('0x55')]['id']}})[_0x2f09('0x24')](handleEntityNotFound(_0xde3692,null))[_0x2f09('0x24')](saveUpdates(_0x32a544['body'],null))[_0x2f09('0x24')](respondWithResult(_0xde3692,null))[_0x2f09('0x48')](handleError(_0xde3692,null));};exports[_0x2f09('0x25')]=function(_0x564f8f,_0x4a821a){return db[_0x2f09('0x44')][_0x2f09('0x4a')]({'where':{'id':_0x564f8f[_0x2f09('0x55')]['id']}})[_0x2f09('0x24')](handleEntityNotFound(_0x4a821a,null))['then'](removeEntity(_0x4a821a,null))[_0x2f09('0x48')](handleError(_0x4a821a,null));};
\ No newline at end of file