Built motion from commit 5ae821c.|0.0.127
[motion.git] / server / api / mail_message / mail_message.controller.js
index b76ddd9..00bd4fb 100644 (file)
@@ -1 +1 @@
-var _0x4761=["\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"];_0x4761[0];var _=require(_0x4761[1]);var async=require(_0x4761[2]);var htmlToText=require(_0x4761[3]);var formidable=require(_0x4761[4]);var path=require(_0x4761[5]);var config=require(_0x4761[6]);var sequelize=require(_0x4761[8])[_0x4761[7]];var MailMessage=require(_0x4761[8])[_0x4761[9]];var MailAttachment=require(_0x4761[8])[_0x4761[10]];var MailRoom=require(_0x4761[8])[_0x4761[11]];var MailAccount=require(_0x4761[8])[_0x4761[12]];var ContactEmail=require(_0x4761[8])[_0x4761[13]];var Contact=require(_0x4761[8])[_0x4761[14]];var User=require(_0x4761[8])[_0x4761[15]];exports[_0x4761[16]]= function(_0xc027xf,_0xc027x10,_0xc027x11){var _0xc027x12={order:_0x4761[17],include:[{all:true,include:[{all:true}]}]};switch(_0xc027xf[_0x4761[23]][_0x4761[22]]){case _0x4761[20]:_0xc027x12[_0x4761[18]]= _0xc027xf[_0x4761[19]];break;case _0x4761[21]:break;default:};return MailMessage[_0x4761[28]](_0xc027x12)[_0x4761[27]](function(_0xc027x14){return _0xc027x10[_0x4761[26]](200)[_0x4761[25]](_0xc027x14)})[_0x4761[24]](function(_0xc027x13){return handleError(_0xc027x10,_0xc027x13,_0xc027x11)})};exports[_0x4761[29]]= function(_0xc027xf,_0xc027x10,_0xc027x11){return MailMessage[_0x4761[36]](_0xc027xf[_0x4761[32]][_0x4761[31]],{include:[{model:MailAttachment},{model:User,attributes:[_0x4761[31],_0x4761[33],_0x4761[34],_0x4761[35]]}]})[_0x4761[27]](function(_0xc027x15){if(!_0xc027x15){return _0xc027x10[_0x4761[30]](404)};return _0xc027x10[_0x4761[25]](_0xc027x15)})[_0x4761[24]](function(_0xc027x13){return handleError(_0xc027x10,_0xc027x13,_0xc027x11)})};exports[_0x4761[37]]= function(_0xc027xf,_0xc027x10,_0xc027x11){_0xc027xf[_0x4761[39]][_0x4761[38]]= _0xc027xf[_0x4761[23]][_0x4761[31]];_0xc027xf[_0x4761[39]][_0x4761[40]]= _0xc027xf[_0x4761[39]][_0x4761[40]]|| htmlToText[_0x4761[42]](_0xc027xf[_0x4761[39]][_0x4761[41]],{wordwrap:false});console[_0x4761[44]](_0x4761[43],_0xc027xf[_0x4761[39]]);return MailMessage[_0x4761[37]](_0xc027xf[_0x4761[39]],{include:[{model:MailAttachment}]})[_0x4761[27]](function(_0xc027x15){return _0xc027x10[_0x4761[26]](201)[_0x4761[25]](_0xc027x15)})[_0x4761[24]](function(_0xc027x13){return handleError(_0xc027x10,_0xc027x13)})};exports[_0x4761[45]]= function(_0xc027xf,_0xc027x10,_0xc027x11){return MailMessage[_0x4761[36]](_0xc027xf[_0x4761[32]][_0x4761[31]],{include:[{all:true}]})[_0x4761[27]](function(_0xc027x15){if(!_0xc027x15){return _0xc027x10[_0x4761[30]](404)};var _0xc027x16=_[_0x4761[46]](_0xc027x15,_0xc027xf[_0x4761[39]]);return _0xc027x16[_0x4761[47]]()})[_0x4761[27]](function(_0xc027x16){return _0xc027x10[_0x4761[26]](200)[_0x4761[25]](_0xc027x16)})[_0x4761[24]](function(_0xc027x13){return handleError(_0xc027x10,_0xc027x13,_0xc027x11)})};exports[_0x4761[48]]= function(_0xc027xf,_0xc027x10,_0xc027x11){return MailMessage[_0x4761[36]](_0xc027xf[_0x4761[32]][_0x4761[31]])[_0x4761[27]](function(_0xc027x15){if(!_0xc027x15){return _0xc027x10[_0x4761[30]](404)};return _0xc027x15[_0x4761[48]]()})[_0x4761[27]](function(){return _0xc027x10[_0x4761[30]](204)})[_0x4761[24]](function(_0xc027x13){return handleError(_0xc027x10,_0xc027x13,_0xc027x11)})};exports[_0x4761[49]]= function(_0xc027xf,_0xc027x10,_0xc027x11){return MailMessage[_0x4761[51]]({where:{id:{$in:_0xc027xf[_0x4761[39]][_0x4761[31]]}},attributes:{directory:_0x4761[50]}})[_0x4761[27]](function(_0xc027x15){if(!_0xc027x15){return _0xc027x10[_0x4761[30]](404)};return _0xc027x15[_0x4761[48]]()})[_0x4761[27]](function(){return _0xc027x10[_0x4761[30]](204)})[_0x4761[24]](function(_0xc027x13){return handleError(_0xc027x10,_0xc027x13,_0xc027x11)})};function handleError(_0xc027x10,_0xc027x13,_0xc027x11){return _0xc027x10[_0x4761[26]](500)[_0x4761[25]](_0xc027x13)}
\ No newline at end of file
+var _0xe99d=["\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","\x6D\x6F\x6D\x65\x6E\x74","\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","\x64\x65\x73\x63\x72\x69\x62\x65","\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","\x75\x73\x65\x72\x4E\x61\x6D\x65","\x75\x73\x65\x72\x46\x75\x6C\x6C\x6E\x61\x6D\x65","\x74\x65\x78\x74","\x68\x74\x6D\x6C","\x66\x72\x6F\x6D\x53\x74\x72\x69\x6E\x67","\x65\x72\x72\x6F\x72","\x61\x63\x63\x6F\x75\x6E\x74\x49\x64","\x61\x63\x63\x6F\x75\x6E\x74\x4E\x61\x6D\x65","\x73\x75\x62\x6A\x65\x63\x74","\x4F\x50\x45\x4E","\x53\x45\x4E\x44\x49\x4E\x47","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x66\x72\x6F\x6D","\x66\x69\x6E\x64\x4F\x6E\x65","\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"];_0xe99d[0];var _=require(_0xe99d[1]);var async=require(_0xe99d[2]);var htmlToText=require(_0xe99d[3]);var formidable=require(_0xe99d[4]);var moment=require(_0xe99d[5]);var path=require(_0xe99d[6]);var config=require(_0xe99d[7]);var sequelize=require(_0xe99d[9])[_0xe99d[8]];var MailMessage=require(_0xe99d[9])[_0xe99d[10]];var MailAttachment=require(_0xe99d[9])[_0xe99d[11]];var MailRoom=require(_0xe99d[9])[_0xe99d[12]];var MailAccount=require(_0xe99d[9])[_0xe99d[13]];var ContactEmail=require(_0xe99d[9])[_0xe99d[14]];var Contact=require(_0xe99d[9])[_0xe99d[15]];var User=require(_0xe99d[9])[_0xe99d[16]];exports[_0xe99d[17]]= function(_0x9631x10,_0x9631x11,_0x9631x12){var _0x9631x13={order:_0xe99d[18],include:[{all:true,include:[{all:true}]}]};switch(_0x9631x10[_0xe99d[24]][_0xe99d[23]]){case _0xe99d[21]:_0x9631x13[_0xe99d[19]]= _0x9631x10[_0xe99d[20]];break;case _0xe99d[22]:break;default:};return MailMessage[_0xe99d[29]](_0x9631x13)[_0xe99d[28]](function(_0x9631x15){return _0x9631x11[_0xe99d[27]](200)[_0xe99d[26]](_0x9631x15)})[_0xe99d[25]](function(_0x9631x14){return handleError(_0x9631x11,_0x9631x14,_0x9631x12)})};exports[_0xe99d[30]]= function(_0x9631x10,_0x9631x11){return MailMessage[_0xe99d[30]]()[_0xe99d[28]](function(_0x9631x16){return _0x9631x11[_0xe99d[27]](200)[_0xe99d[26]](_0x9631x16)})[_0xe99d[25]](function(_0x9631x14){return handleError(_0x9631x11,_0x9631x14)})};exports[_0xe99d[31]]= function(_0x9631x10,_0x9631x11,_0x9631x12){return MailMessage[_0xe99d[38]](_0x9631x10[_0xe99d[34]][_0xe99d[33]],{include:[{model:MailAttachment},{model:User,attributes:[_0xe99d[33],_0xe99d[35],_0xe99d[36],_0xe99d[37]]}]})[_0xe99d[28]](function(_0x9631x17){if(!_0x9631x17){return _0x9631x11[_0xe99d[32]](404)};return _0x9631x11[_0xe99d[26]](_0x9631x17)})[_0xe99d[25]](function(_0x9631x14){return handleError(_0x9631x11,_0x9631x14,_0x9631x12)})};exports[_0xe99d[39]]= function(_0x9631x10,_0x9631x11,_0x9631x12){_0x9631x10[_0xe99d[41]][_0xe99d[40]]= _0x9631x10[_0xe99d[24]][_0xe99d[33]];_0x9631x10[_0xe99d[41]][_0xe99d[42]]= _0x9631x10[_0xe99d[24]][_0xe99d[35]];_0x9631x10[_0xe99d[41]][_0xe99d[43]]= _0x9631x10[_0xe99d[24]][_0xe99d[36]];_0x9631x10[_0xe99d[41]][_0xe99d[40]]= _0x9631x10[_0xe99d[24]][_0xe99d[33]];_0x9631x10[_0xe99d[41]][_0xe99d[44]]= _0x9631x10[_0xe99d[41]][_0xe99d[44]]|| htmlToText[_0xe99d[46]](_0x9631x10[_0xe99d[41]][_0xe99d[45]],{wordwrap:false});return MailAccount[_0xe99d[56]]({where:{address:_0x9631x10[_0xe99d[41]][_0xe99d[55]][0]}})[_0xe99d[28]](function(_0x9631x19){_0x9631x10[_0xe99d[41]][_0xe99d[48]]= _0x9631x19[_0xe99d[33]];_0x9631x10[_0xe99d[41]][_0xe99d[49]]= _0x9631x19[_0xe99d[35]];return MailRoom[_0xe99d[39]]({subject:_0x9631x10[_0xe99d[41]][_0xe99d[50]],account:_0x9631x19[_0xe99d[35]],mailIn:0,mailOut:1,status:_0xe99d[51],openReason:_0xe99d[22],lastEvent:_0xe99d[52],lastEventAt:moment()[_0xe99d[54]](_0xe99d[53]),MailAccountId:_0x9631x19[_0xe99d[33]],MailMessages:[_0x9631x10[_0xe99d[41]]]},{include:[{model:MailMessage,include:[{model:MailAttachment}]}]})})[_0xe99d[28]](function(_0x9631x18){return _0x9631x11[_0xe99d[27]](201)[_0xe99d[26]](_0x9631x18)})[_0xe99d[25]](function(_0x9631x14){console[_0xe99d[47]](_0x9631x14);return handleError(_0x9631x11,_0x9631x14)})};exports[_0xe99d[57]]= function(_0x9631x10,_0x9631x11,_0x9631x12){return MailMessage[_0xe99d[38]](_0x9631x10[_0xe99d[34]][_0xe99d[33]],{include:[{all:true}]})[_0xe99d[28]](function(_0x9631x17){if(!_0x9631x17){return _0x9631x11[_0xe99d[32]](404)};var _0x9631x1a=_[_0xe99d[58]](_0x9631x17,_0x9631x10[_0xe99d[41]]);return _0x9631x1a[_0xe99d[59]]()})[_0xe99d[28]](function(_0x9631x1a){return _0x9631x11[_0xe99d[27]](200)[_0xe99d[26]](_0x9631x1a)})[_0xe99d[25]](function(_0x9631x14){return handleError(_0x9631x11,_0x9631x14,_0x9631x12)})};exports[_0xe99d[60]]= function(_0x9631x10,_0x9631x11,_0x9631x12){return MailMessage[_0xe99d[38]](_0x9631x10[_0xe99d[34]][_0xe99d[33]])[_0xe99d[28]](function(_0x9631x17){if(!_0x9631x17){return _0x9631x11[_0xe99d[32]](404)};return _0x9631x17[_0xe99d[60]]()})[_0xe99d[28]](function(){return _0x9631x11[_0xe99d[32]](204)})[_0xe99d[25]](function(_0x9631x14){return handleError(_0x9631x11,_0x9631x14,_0x9631x12)})};exports[_0xe99d[61]]= function(_0x9631x10,_0x9631x11,_0x9631x12){return MailMessage[_0xe99d[63]]({where:{id:{$in:_0x9631x10[_0xe99d[41]][_0xe99d[33]]}},attributes:{directory:_0xe99d[62]}})[_0xe99d[28]](function(_0x9631x17){if(!_0x9631x17){return _0x9631x11[_0xe99d[32]](404)};return _0x9631x17[_0xe99d[60]]()})[_0xe99d[28]](function(){return _0x9631x11[_0xe99d[32]](204)})[_0xe99d[25]](function(_0x9631x14){return handleError(_0x9631x11,_0x9631x14,_0x9631x12)})};function handleError(_0x9631x11,_0x9631x14,_0x9631x12){return _0x9631x11[_0xe99d[27]](500)[_0xe99d[26]](_0x9631x14)}
\ No newline at end of file