Built motion from commit a81f050.|0.0.71
[motion.git] / server / api / contact_manager / contact_manager.controller.js
1 var _0x9948=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x43\x6F\x6E\x74\x61\x63\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x6F\x6E\x74\x61\x63\x74\x50\x68\x6F\x6E\x65","\x43\x6F\x6E\x74\x61\x63\x74\x45\x6D\x61\x69\x6C","\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65\x48\x69\x73\x74\x6F\x72\x79","\x68\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x53\x65\x72\x76\x69\x63\x65","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C\x48\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x54\x61\x67","\x73\x74\x72\x65\x61\x6D","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x65\x72\x76\x69\x63\x65","\x73\x63\x6F\x70\x65","\x67\x65\x74\x4C\x6F\x67","\x64\x65\x74\x61\x69\x6C","\x67\x65\x6E\x65\x72\x61\x6C","\x73\x68\x6F\x77","\x70\x68\x6F\x6E\x65","\x6C\x6F\x67\x54\x79\x70\x65","\x6A\x6F\x75\x72\x6E\x61\x6C","\x74\x79\x70\x65","\x69\x6E\x62\x6F\x75\x6E\x64","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x64\x65\x73\x74\x69\x6E\x61\x74\x69\x6F\x6E","\x6D\x6F\x62\x69\x6C\x65","\x73\x6F\x75\x72\x63\x65","\x65\x6D\x61\x69\x6C","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x71\x75\x65\x75\x65","\x6D\x65\x72\x67\x65","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x75\x73\x65\x72","\x67\x65\x74\x45\x76\x65\x6E\x74\x43\x6F\x6E\x74\x61\x63\x74\x73","\x76\x6F\x69\x63\x65","\x66\x72\x6F\x6D","\x6D\x61\x69\x6C","\x65\x76\x65\x6E\x74\x43\x68\x61\x6E\x6E\x65\x6C","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x6D\x61\x70","\x66\x69\x6E\x64\x41\x6C\x6C","\x63\x72\x65\x61\x74\x65","\x55\x73\x65\x72\x49\x64","\x62\x6F\x64\x79","\x61\x6C\x6C","\x6E\x61\x6D\x65","\x74\x61\x67\x73","\x2C","\x73\x70\x6C\x69\x74","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x75\x70\x64\x61\x74\x65","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79"];_0x9948[0];var _=require(_0x9948[1]);var Contact=require(_0x9948[3])[_0x9948[2]];var ContactPhone=require(_0x9948[3])[_0x9948[4]];var ContactEmail=require(_0x9948[3])[_0x9948[5]];var CustomField=require(_0x9948[3])[_0x9948[6]];var ReportCall=require(_0x9948[3])[_0x9948[7]];var ReportQueue=require(_0x9948[3])[_0x9948[8]];var ReportQueueHistory=require(_0x9948[3])[_0x9948[10]][_0x9948[9]];var ReportIntegration=require(_0x9948[3])[_0x9948[11]];var Service=require(_0x9948[3])[_0x9948[12]];var ReportCallHistory=require(_0x9948[3])[_0x9948[10]][_0x9948[13]];var ReportMailSession=require(_0x9948[3])[_0x9948[14]];var ReportMailSessionHistory=require(_0x9948[3])[_0x9948[10]][_0x9948[15]];var Tag=require(_0x9948[3])[_0x9948[16]];var stream=require(_0x9948[17]);var sequelize=require(_0x9948[3])[_0x9948[18]];var util=require(_0x9948[19]);var Util=require(_0x9948[20]);exports[_0x9948[21]]=function(_0xbc6cx13,_0xbc6cx14,_0xbc6cx15){return Contact[_0x9948[31]](_0x9948[30])[_0x9948[29]](Util[_0x9948[28]](_0xbc6cx13[_0x9948[27]]))[_0x9948[26]](function(_0xbc6cx17){_0xbc6cx14[_0x9948[25]](200)[_0x9948[24]](_0xbc6cx17)})[_0x9948[23]](function(_0xbc6cx16){console[_0x9948[22]](_0xbc6cx16);return handleError(_0xbc6cx14,_0xbc6cx16)})};exports[_0x9948[32]]=function(_0xbc6cx13,_0xbc6cx14,_0xbc6cx15){_0xbc6cx13[_0x9948[27]][_0x9948[33]]=_0xbc6cx13[_0x9948[27]][_0x9948[33]]||_0x9948[34];_0xbc6cx13[_0x9948[27]][_0x9948[35]]=_0xbc6cx13[_0x9948[27]][_0x9948[35]]||_0x9948[36];_0xbc6cx13[_0x9948[27]][_0x9948[37]]=_0xbc6cx13[_0x9948[27]][_0x9948[37]]||_0x9948[38];_0xbc6cx13[_0x9948[27]][_0x9948[39]]=_0xbc6cx13[_0x9948[27]][_0x9948[39]]||_0x9948[40];var _0xbc6cx18,_0xbc6cx19={};return Contact[_0x9948[52]](_0xbc6cx13[_0x9948[51]][_0x9948[50]])[_0x9948[26]](function(_0xbc6cx1a){if(!_0xbc6cx1a){return _0xbc6cx14[_0x9948[41]](404)};switch(_0xbc6cx13[_0x9948[27]][_0x9948[33]]){case _0x9948[34]:switch(_0xbc6cx13[_0x9948[27]][_0x9948[35]]){case _0x9948[36]:_0xbc6cx18=(_0xbc6cx13[_0x9948[27]][_0x9948[37]]===_0x9948[10])?ReportCallHistory:ReportCall;if(_0xbc6cx13[_0x9948[27]][_0x9948[39]]===_0x9948[42]){_0xbc6cx19[_0x9948[43]]=[_0xbc6cx1a[_0x9948[36]],_0xbc6cx1a[_0x9948[44]]]}else {_0xbc6cx19[_0x9948[45]]=[_0xbc6cx1a[_0x9948[36]],_0xbc6cx1a[_0x9948[44]]]};break;case _0x9948[46]:return _0xbc6cx14[_0x9948[41]](404);default:_0xbc6cx18=(_0xbc6cx13[_0x9948[27]][_0x9948[37]]===_0x9948[10])?ReportCallHistory:ReportCall};break;case _0x9948[48]:switch(_0xbc6cx13[_0x9948[27]][_0x9948[35]]){case _0x9948[36]:_0xbc6cx18=(_0xbc6cx13[_0x9948[27]][_0x9948[37]]===_0x9948[10])?ReportQueueHistory:ReportQueue;_0xbc6cx19[_0x9948[47]]=[_0xbc6cx1a[_0x9948[36]],_0xbc6cx1a[_0x9948[44]]];break;case _0x9948[46]:return _0xbc6cx14[_0x9948[41]](404);default:_0xbc6cx18=(_0xbc6cx13[_0x9948[27]][_0x9948[37]]===_0x9948[10])?ReportQueueHistory:ReportQueue};break;default:_0xbc6cx18=ReportCall;_0xbc6cx13[_0x9948[27]][_0x9948[35]]=_0x9948[36]};delete _0xbc6cx13[_0x9948[27]][_0x9948[33]];delete _0xbc6cx13[_0x9948[27]][_0x9948[35]];delete _0xbc6cx13[_0x9948[27]][_0x9948[37]];delete _0xbc6cx13[_0x9948[27]][_0x9948[39]];return _0xbc6cx18[_0x9948[29]](_[_0x9948[49]](Util[_0x9948[28]](_0xbc6cx13[_0x9948[27]]),{where:_0xbc6cx19}))})[_0x9948[26]](function(_0xbc6cx17){_0xbc6cx14[_0x9948[25]](200)[_0x9948[24]](_0xbc6cx17)})[_0x9948[23]](function(_0xbc6cx16){console[_0x9948[22]](_0xbc6cx16);return handleError(_0xbc6cx14,_0xbc6cx16)})};exports[_0x9948[35]]=function(_0xbc6cx13,_0xbc6cx14){return Contact[_0x9948[31]](_0x9948[30],_0x9948[53])[_0x9948[52]](_0xbc6cx13[_0x9948[51]][_0x9948[50]])[_0x9948[26]](function(_0xbc6cx1b){if(!_0xbc6cx1b){return _0xbc6cx14[_0x9948[41]](404)};return _0xbc6cx14[_0x9948[25]](200)[_0x9948[24]](_0xbc6cx1b)})[_0x9948[23]](function(_0xbc6cx16){console[_0x9948[22]](_0xbc6cx16);return handleError(_0xbc6cx14,_0xbc6cx16)})};exports[_0x9948[54]]=function(_0xbc6cx13,_0xbc6cx14){return ReportIntegration[_0x9948[52]](_0xbc6cx13[_0x9948[51]][_0x9948[50]])[_0x9948[26]](function(_0xbc6cx1d){var _0xbc6cx19={};switch(_0xbc6cx1d[_0x9948[58]]){case _0x9948[55]:_0xbc6cx19={$or:{phone:_0xbc6cx1d[_0x9948[47]],mobile:_0xbc6cx1d[_0x9948[47]]}};break;case _0x9948[57]:_0xbc6cx19={email:_0xbc6cx1d[_0x9948[56]]};break;default:_0xbc6cx19={}};return Contact[_0x9948[61]]({where:_0xbc6cx19,include:[{model:Service,where:{id:_[_0x9948[60]](_[_0x9948[60]](_0xbc6cx13[_0x9948[53]].Services,_0x9948[59]),_0x9948[50])}}]})})[_0x9948[26]](function(_0xbc6cx1c){return _0xbc6cx14[_0x9948[25]](200)[_0x9948[24]](_0xbc6cx1c)})[_0x9948[23]](function(_0xbc6cx16){console[_0x9948[22]](_0xbc6cx16);return handleError(_0xbc6cx14,_0xbc6cx16)})};exports[_0x9948[62]]=function(_0xbc6cx13,_0xbc6cx14,_0xbc6cx15){return Tag[_0x9948[61]]()[_0x9948[26]](function(_0xbc6cx1e){var _0xbc6cx1f=[];var _0xbc6cx20=_[_0x9948[60]](_[_0x9948[60]](_0xbc6cx1e,_0x9948[59]),_0x9948[66]);if(_0xbc6cx13[_0x9948[64]][_0x9948[67]]){var _0xbc6cx21=_0xbc6cx13[_0x9948[64]][_0x9948[67]][_0x9948[69]](_0x9948[68]);_0xbc6cx21[_0x9948[72]](function(_0xbc6cx22){if(!_[_0x9948[70]](_0xbc6cx1e,_0xbc6cx22)){_0xbc6cx1f[_0x9948[71]](Tag[_0x9948[62]]({name:_0xbc6cx22}))}})};return _0xbc6cx1f})[_0x9948[65]]()[_0x9948[26]](function(){_0xbc6cx13[_0x9948[64]][_0x9948[63]]=_0xbc6cx13[_0x9948[53]][_0x9948[50]];return Contact[_0x9948[62]](_0xbc6cx13[_0x9948[64]])})[_0x9948[26]](function(_0xbc6cx1a){return _0xbc6cx14[_0x9948[25]](201)[_0x9948[24]](_0xbc6cx1a)})[_0x9948[23]](function(_0xbc6cx16){console[_0x9948[22]](_0xbc6cx16);return _0xbc6cx15(_0xbc6cx16)})};exports[_0x9948[73]]=function(_0xbc6cx13,_0xbc6cx14,_0xbc6cx15){return Tag[_0x9948[61]]()[_0x9948[26]](function(_0xbc6cx1e){var _0xbc6cx1f=[];var _0xbc6cx20=_[_0x9948[60]](_[_0x9948[60]](_0xbc6cx1e,_0x9948[59]),_0x9948[66]);console[_0x9948[22]](_0xbc6cx13[_0x9948[64]][_0x9948[67]]);if(_0xbc6cx13[_0x9948[64]][_0x9948[67]]){var _0xbc6cx21=_0xbc6cx13[_0x9948[64]][_0x9948[67]][_0x9948[69]](_0x9948[68]);_0xbc6cx21[_0x9948[72]](function(_0xbc6cx22){if(!_[_0x9948[70]](_0xbc6cx1e,_0xbc6cx22)){_0xbc6cx1f[_0x9948[71]](Tag[_0x9948[62]]({name:_0xbc6cx22}))}})};return _0xbc6cx1f})[_0x9948[26]](function(){return Contact[_0x9948[52]](_0xbc6cx13[_0x9948[64]][_0x9948[50]])})[_0x9948[26]](function(_0xbc6cx1a){delete _0xbc6cx13[_0x9948[64]][_0x9948[50]];return _0xbc6cx1a[_0x9948[74]](_0xbc6cx13[_0x9948[64]])})[_0x9948[26]](function(_0xbc6cx1a){return _0xbc6cx14[_0x9948[25]](200)[_0x9948[24]](_0xbc6cx1a)})[_0x9948[23]](function(_0xbc6cx16){console[_0x9948[22]](_0xbc6cx16);return handleError(_0xbc6cx14,_0xbc6cx16)})};exports[_0x9948[75]]=function(_0xbc6cx13,_0xbc6cx14){return Contact[_0x9948[52]](_0xbc6cx13[_0x9948[51]][_0x9948[50]])[_0x9948[26]](function(_0xbc6cx1b){if(!_0xbc6cx1b){return _0xbc6cx14[_0x9948[41]](404)};return _0xbc6cx1b[_0x9948[75]]()})[_0x9948[26]](function(){return _0xbc6cx14[_0x9948[41]](204)})[_0x9948[23]](function(_0xbc6cx16){return handleError(_0xbc6cx14,_0xbc6cx16)})};exports[_0x9948[76]]=function(_0xbc6cx13,_0xbc6cx14){return Contact[_0x9948[75]]({where:{id:_0xbc6cx13[_0x9948[27]][_0x9948[50]]},individualHooks:true})[_0x9948[26]](function(){return _0xbc6cx14[_0x9948[41]](204)})[_0x9948[23]](function(_0xbc6cx16){return handleError(_0xbc6cx14,_0xbc6cx16)})};function handleError(_0xbc6cx14,_0xbc6cx16){return _0xbc6cx14[_0x9948[25]](500)[_0x9948[24]](_0xbc6cx16)}