Built motion from commit eae4cb9.|0.0.78
[motion.git] / server / api / mail_room / mail_room.controller.js
1 var _0x6f42=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x68\x74\x6D\x6C\x2D\x74\x6F\x2D\x74\x65\x78\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x43\x6F\x6E\x74\x61\x63\x74","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x69\x6E\x64\x65\x78","\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","\x64\x65\x66\x61\x75\x6C\x74","\x61\x67\x65\x6E\x74","\x69\x64","\x75\x73\x65\x72","\x73\x63\x6F\x70\x65","\x72\x6F\x6C\x65","\x61\x67\x65\x6E\x74\x49\x6E\x64\x65\x78","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x65\x72\x72\x6F\x72","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x6E\x61\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x67\x65\x74\x55\x73\x65\x72\x73","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x63\x72\x65\x61\x74\x65\x4D\x65\x73\x73\x61\x67\x65","\x55\x73\x65\x72\x49\x64","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D\x49\x64","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x6C\x65\x6E\x67\x74\x68","\x74\x65\x78\x74","\x68\x74\x6D\x6C","\x66\x72\x6F\x6D\x53\x74\x72\x69\x6E\x67","\x72\x6F\x6C\x6C\x62\x61\x63\x6B","\x63\x6F\x6D\x6D\x69\x74","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x6A\x6F\x62\x49\x64","\x4D\x61\x69\x6C\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x61\x73\x73\x69\x67\x6E\x65\x64","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x75\x70\x64\x61\x74\x65\x41\x67\x65\x6E\x74\x73","\x61\x67\x65\x6E\x74\x73","\x73\x65\x74\x55\x73\x65\x72\x73","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0x6f42[0];var _=require(_0x6f42[1]);var util=require(_0x6f42[2]);var htmlToText=require(_0x6f42[3]);var Util=require(_0x6f42[4]);var sequelize=require(_0x6f42[6])[_0x6f42[5]];var User=require(_0x6f42[6])[_0x6f42[7]];var Agent=require(_0x6f42[6])[_0x6f42[7]];var Contact=require(_0x6f42[6])[_0x6f42[8]];var MailRoom=require(_0x6f42[6])[_0x6f42[9]];var MailMessage=require(_0x6f42[6])[_0x6f42[10]];var MailAccount=require(_0x6f42[6])[_0x6f42[11]];var MailAttachment=require(_0x6f42[6])[_0x6f42[12]];exports[_0x6f42[13]]=function(_0x3c6dxd,_0x3c6dxe,_0x3c6dxf){switch(_0x3c6dxd[_0x6f42[24]][_0x6f42[26]]){case _0x6f42[22]:return MailRoom[_0x6f42[25]](_0x6f42[21],{method:[_0x6f42[22],_0x3c6dxd[_0x6f42[24]][_0x6f42[23]]]})[_0x6f42[20]](Util[_0x6f42[19]](_0x3c6dxd[_0x6f42[18]]))[_0x6f42[17]](function(_0x3c6dx11){return _0x3c6dxe[_0x6f42[16]](200)[_0x6f42[15]](_0x3c6dx11)})[_0x6f42[14]](function(_0x3c6dx10){return handleError(_0x3c6dxe,_0x3c6dx10)});default:return MailRoom[_0x6f42[25]](_0x6f42[21])[_0x6f42[20]](Util[_0x6f42[19]](_0x3c6dxd[_0x6f42[18]]))[_0x6f42[17]](function(_0x3c6dx11){return _0x3c6dxe[_0x6f42[16]](200)[_0x6f42[15]](_0x3c6dx11)})[_0x6f42[14]](function(_0x3c6dx10){return handleError(_0x3c6dxe,_0x3c6dx10)})}};exports[_0x6f42[27]]=function(_0x3c6dxd,_0x3c6dxe,_0x3c6dxf){return MailRoom[_0x6f42[29]]({where:{UserId:_0x3c6dxd[_0x6f42[28]][_0x6f42[23]]},include:[{all:true}]})[_0x6f42[17]](function(_0x3c6dx12){return _0x3c6dxe[_0x6f42[16]](200)[_0x6f42[15]](_0x3c6dx12)})[_0x6f42[14]](function(_0x3c6dx10){return handleError(_0x3c6dxe,_0x3c6dx10)})};exports[_0x6f42[30]]=function(_0x3c6dxd,_0x3c6dxe,_0x3c6dxf){return MailRoom[_0x6f42[25]](_0x6f42[21])[_0x6f42[33]](_0x3c6dxd[_0x6f42[28]][_0x6f42[23]])[_0x6f42[17]](function(_0x3c6dx13){if(!_0x3c6dx13){return _0x3c6dxe[_0x6f42[32]](404)};return _0x3c6dxe[_0x6f42[15]](_0x3c6dx13)})[_0x6f42[14]](function(_0x3c6dx10){console[_0x6f42[31]](_0x3c6dx10);return handleError(_0x3c6dxe,_0x3c6dx10)})};exports[_0x6f42[34]]=function(_0x3c6dxd,_0x3c6dxe,_0x3c6dxf){return MailRoom[_0x6f42[33]](_0x3c6dxd[_0x6f42[28]][_0x6f42[23]])[_0x6f42[17]](function(_0x3c6dx13){if(!_0x3c6dx13){return _0x3c6dxe[_0x6f42[32]](404)};return _0x3c6dx13[_0x6f42[39]]({attributes:[_0x6f42[23],_0x6f42[35],_0x6f42[36],_0x6f42[37],_0x6f42[26],_0x6f42[38]]})})[_0x6f42[17]](function(_0x3c6dx14){return _0x3c6dxe[_0x6f42[15]](_0x3c6dx14)})[_0x6f42[14]](function(_0x3c6dx10){return handleError(_0x3c6dxe,_0x3c6dx10)})};exports[_0x6f42[40]]=function(_0x3c6dxd,_0x3c6dxe,_0x3c6dxf){return MailRoom[_0x6f42[40]](_0x3c6dxd[_0x6f42[41]])[_0x6f42[17]](function(_0x3c6dx13){return _0x3c6dxe[_0x6f42[16]](201)[_0x6f42[15]](_0x3c6dx13)})[_0x6f42[14]](function(_0x3c6dx10){return handleError(_0x3c6dxe,_0x3c6dx10)})};exports[_0x6f42[42]]=function(_0x3c6dxd,_0x3c6dxe,_0x3c6dxf){_0x3c6dxd[_0x6f42[41]][_0x6f42[43]]=_0x3c6dxd[_0x6f42[24]][_0x6f42[23]];_0x3c6dxd[_0x6f42[41]][_0x6f42[44]]=_0x3c6dxd[_0x6f42[28]][_0x6f42[23]];_0x3c6dxd[_0x6f42[41]][_0x6f42[45]]=(_0x3c6dxd[_0x6f42[41]][_0x6f42[46]]&&_0x3c6dxd[_0x6f42[41]][_0x6f42[46]][_0x6f42[47]])?true:false;_0x3c6dxd[_0x6f42[41]][_0x6f42[48]]=_0x3c6dxd[_0x6f42[41]][_0x6f42[48]]||htmlToText[_0x6f42[50]](_0x3c6dxd[_0x6f42[41]][_0x6f42[49]],{wordwrap:false});return sequelize[_0x6f42[53]]()[_0x6f42[17]](function(_0x3c6dx15){return MailMessage[_0x6f42[40]](_0x3c6dxd[_0x6f42[41]],{include:[{model:MailAttachment}],transaction:_0x3c6dx15,user:_0x3c6dxd[_0x6f42[24]]})[_0x6f42[17]](function(_0x3c6dx16){_0x3c6dx15[_0x6f42[52]]();return _0x3c6dxe[_0x6f42[16]](201)[_0x6f42[15]](_0x3c6dx16)})[_0x6f42[14]](function(_0x3c6dx10){console[_0x6f42[31]](_0x3c6dx10);_0x3c6dx15[_0x6f42[51]]();return handleError(_0x3c6dxe,_0x3c6dx10)})})};exports[_0x6f42[54]]=function(_0x3c6dxd,_0x3c6dxe,_0x3c6dxf){return MailRoom[_0x6f42[33]](_0x3c6dxd[_0x6f42[28]][_0x6f42[23]])[_0x6f42[17]](function(_0x3c6dx13){if(!_0x3c6dx13){return _0x3c6dxe[_0x6f42[32]](404)};if(_0x3c6dx13[_0x6f42[55]]){throw  new Error(_0x6f42[56])};var _0x3c6dx17=_[_0x6f42[57]](_0x3c6dx13,_0x3c6dxd[_0x6f42[41]]);return _0x3c6dx17[_0x6f42[58]]()})[_0x6f42[17]](function(_0x3c6dx13){return _0x3c6dxe[_0x6f42[16]](200)[_0x6f42[15]](_0x3c6dx13)})[_0x6f42[14]](function(_0x3c6dx10){return handleError(_0x3c6dxe,_0x3c6dx10)})};exports[_0x6f42[59]]=function(_0x3c6dxd,_0x3c6dxe,_0x3c6dxf){return MailRoom[_0x6f42[33]](_0x3c6dxd[_0x6f42[28]][_0x6f42[23]])[_0x6f42[17]](function(_0x3c6dx13){if(!_0x3c6dx13){return _0x3c6dxe[_0x6f42[32]](404)};return _0x3c6dx13[_0x6f42[61]](_0x3c6dxd[_0x6f42[41]][_0x6f42[60]],{individualHooks:true})})[_0x6f42[17]](function(){return _0x3c6dxe[_0x6f42[32]](200)})[_0x6f42[14]](function(_0x3c6dx10){return handleError(_0x3c6dxe,_0x3c6dx10)})};exports[_0x6f42[62]]=function(_0x3c6dxd,_0x3c6dxe,_0x3c6dxf){return MailRoom[_0x6f42[33]](_0x3c6dxd[_0x6f42[28]][_0x6f42[23]])[_0x6f42[17]](function(_0x3c6dx13){if(!_0x3c6dx13){return _0x3c6dxe[_0x6f42[32]](404)};return _0x3c6dx13[_0x6f42[62]]()})[_0x6f42[17]](function(){return _0x3c6dxe[_0x6f42[32]](204)})[_0x6f42[14]](function(_0x3c6dx10){return handleError(_0x3c6dxe,_0x3c6dx10)})};exports[_0x6f42[63]]=function(_0x3c6dxd,_0x3c6dxe){return MailRoom[_0x6f42[62]]({where:{id:_0x3c6dxd[_0x6f42[18]][_0x6f42[64]]},individualHooks:true})[_0x6f42[17]](function(){return _0x3c6dxe[_0x6f42[32]](200)})[_0x6f42[14]](function(_0x3c6dx10){return handleError(_0x3c6dxe,_0x3c6dx10)})};function handleError(_0x3c6dxe,_0x3c6dx10){return _0x3c6dxe[_0x6f42[16]](500)[_0x6f42[15]](_0x3c6dx10)}