Built motion from commit 2239aeb.|0.0.113
[motion.git] / server / api / mail_message / mail_message.controller.js
1 var _0x7357=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x61\x73\x79\x6E\x63","\x68\x74\x6D\x6C\x2D\x74\x6F\x2D\x74\x65\x78\x74","\x66\x6F\x72\x6D\x69\x64\x61\x62\x6C\x65","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x43\x6F\x6E\x74\x61\x63\x74\x45\x6D\x61\x69\x6C","\x43\x6F\x6E\x74\x61\x63\x74","\x55\x73\x65\x72","\x69\x6E\x64\x65\x78","\x63\x72\x65\x61\x74\x65\x64\x41\x74\x20\x44\x45\x53\x43","\x77\x68\x65\x72\x65","\x71\x75\x65\x72\x79","\x61\x64\x6D\x69\x6E","\x61\x67\x65\x6E\x74","\x72\x6F\x6C\x65","\x75\x73\x65\x72","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x6E\x61\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x55\x73\x65\x72\x49\x64","\x62\x6F\x64\x79","\x74\x65\x78\x74","\x68\x74\x6D\x6C","\x66\x72\x6F\x6D\x53\x74\x72\x69\x6E\x67","\x72\x65\x71\x2E\x62\x6F\x64\x79","\x6C\x6F\x67","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x6C\x65\x74\x65","\x54\x52\x41\x53\x48","\x62\x75\x6C\x6B\x55\x70\x64\x61\x74\x65"];_0x7357[0];var _=require(_0x7357[1]);var async=require(_0x7357[2]);var htmlToText=require(_0x7357[3]);var formidable=require(_0x7357[4]);var path=require(_0x7357[5]);var config=require(_0x7357[6]);var sequelize=require(_0x7357[8])[_0x7357[7]];var MailMessage=require(_0x7357[8])[_0x7357[9]];var MailAttachment=require(_0x7357[8])[_0x7357[10]];var MailRoom=require(_0x7357[8])[_0x7357[11]];var MailAccount=require(_0x7357[8])[_0x7357[12]];var ContactEmail=require(_0x7357[8])[_0x7357[13]];var Contact=require(_0x7357[8])[_0x7357[14]];var User=require(_0x7357[8])[_0x7357[15]];exports[_0x7357[16]]= function(_0x24f0xf,_0x24f0x10,_0x24f0x11){var _0x24f0x12={order:_0x7357[17],include:[{all:true,include:[{all:true}]}]};switch(_0x24f0xf[_0x7357[23]][_0x7357[22]]){case _0x7357[20]:_0x24f0x12[_0x7357[18]]= _0x24f0xf[_0x7357[19]];break;case _0x7357[21]:break;default:};return MailMessage[_0x7357[28]](_0x24f0x12)[_0x7357[27]](function(_0x24f0x14){return _0x24f0x10[_0x7357[26]](200)[_0x7357[25]](_0x24f0x14)})[_0x7357[24]](function(_0x24f0x13){return handleError(_0x24f0x10,_0x24f0x13,_0x24f0x11)})};exports[_0x7357[29]]= function(_0x24f0xf,_0x24f0x10,_0x24f0x11){return MailMessage[_0x7357[36]](_0x24f0xf[_0x7357[32]][_0x7357[31]],{include:[{model:MailAttachment},{model:User,attributes:[_0x7357[31],_0x7357[33],_0x7357[34],_0x7357[35]]}]})[_0x7357[27]](function(_0x24f0x15){if(!_0x24f0x15){return _0x24f0x10[_0x7357[30]](404)};return _0x24f0x10[_0x7357[25]](_0x24f0x15)})[_0x7357[24]](function(_0x24f0x13){return handleError(_0x24f0x10,_0x24f0x13,_0x24f0x11)})};exports[_0x7357[37]]= function(_0x24f0xf,_0x24f0x10,_0x24f0x11){_0x24f0xf[_0x7357[39]][_0x7357[38]]= _0x24f0xf[_0x7357[23]][_0x7357[31]];_0x24f0xf[_0x7357[39]][_0x7357[40]]= _0x24f0xf[_0x7357[39]][_0x7357[40]]|| htmlToText[_0x7357[42]](_0x24f0xf[_0x7357[39]][_0x7357[41]],{wordwrap:false});console[_0x7357[44]](_0x7357[43],_0x24f0xf[_0x7357[39]]);return MailMessage[_0x7357[37]](_0x24f0xf[_0x7357[39]],{include:[{model:MailAttachment}]})[_0x7357[27]](function(_0x24f0x15){return _0x24f0x10[_0x7357[26]](201)[_0x7357[25]](_0x24f0x15)})[_0x7357[24]](function(_0x24f0x13){return handleError(_0x24f0x10,_0x24f0x13)})};exports[_0x7357[45]]= function(_0x24f0xf,_0x24f0x10,_0x24f0x11){return MailMessage[_0x7357[36]](_0x24f0xf[_0x7357[32]][_0x7357[31]],{include:[{all:true}]})[_0x7357[27]](function(_0x24f0x15){if(!_0x24f0x15){return _0x24f0x10[_0x7357[30]](404)};var _0x24f0x16=_[_0x7357[46]](_0x24f0x15,_0x24f0xf[_0x7357[39]]);return _0x24f0x16[_0x7357[47]]()})[_0x7357[27]](function(_0x24f0x16){return _0x24f0x10[_0x7357[26]](200)[_0x7357[25]](_0x24f0x16)})[_0x7357[24]](function(_0x24f0x13){return handleError(_0x24f0x10,_0x24f0x13,_0x24f0x11)})};exports[_0x7357[48]]= function(_0x24f0xf,_0x24f0x10,_0x24f0x11){return MailMessage[_0x7357[36]](_0x24f0xf[_0x7357[32]][_0x7357[31]])[_0x7357[27]](function(_0x24f0x15){if(!_0x24f0x15){return _0x24f0x10[_0x7357[30]](404)};return _0x24f0x15[_0x7357[48]]()})[_0x7357[27]](function(){return _0x24f0x10[_0x7357[30]](204)})[_0x7357[24]](function(_0x24f0x13){return handleError(_0x24f0x10,_0x24f0x13,_0x24f0x11)})};exports[_0x7357[49]]= function(_0x24f0xf,_0x24f0x10,_0x24f0x11){return MailMessage[_0x7357[51]]({where:{id:{$in:_0x24f0xf[_0x7357[39]][_0x7357[31]]}},attributes:{directory:_0x7357[50]}})[_0x7357[27]](function(_0x24f0x15){if(!_0x24f0x15){return _0x24f0x10[_0x7357[30]](404)};return _0x24f0x15[_0x7357[48]]()})[_0x7357[27]](function(){return _0x24f0x10[_0x7357[30]](204)})[_0x7357[24]](function(_0x24f0x13){return handleError(_0x24f0x10,_0x24f0x13,_0x24f0x11)})};function handleError(_0x24f0x10,_0x24f0x13,_0x24f0x11){return _0x24f0x10[_0x7357[26]](500)[_0x7357[25]](_0x24f0x13)}