Built motion from commit ae98c6c.|0.0.149
[motion.git] / server / api / mail_message / mail_message.controller.js
index 2c9f9b2..24e5231 100644 (file)
@@ -1 +1 @@
-var _0x2486=["\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","\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"];_0x2486[0];var _=require(_0x2486[1]);var async=require(_0x2486[2]);var htmlToText=require(_0x2486[3]);var formidable=require(_0x2486[4]);var path=require(_0x2486[5]);var config=require(_0x2486[6]);var sequelize=require(_0x2486[8])[_0x2486[7]];var MailMessage=require(_0x2486[8])[_0x2486[9]];var MailAttachment=require(_0x2486[8])[_0x2486[10]];var MailRoom=require(_0x2486[8])[_0x2486[11]];var MailAccount=require(_0x2486[8])[_0x2486[12]];var ContactEmail=require(_0x2486[8])[_0x2486[13]];var Contact=require(_0x2486[8])[_0x2486[14]];var User=require(_0x2486[8])[_0x2486[15]];exports[_0x2486[16]]=function(_0x183axf,_0x183ax10,_0x183ax11){var _0x183ax12={order:_0x2486[17],include:[{all:true,include:[{all:true}]}]};switch(_0x183axf[_0x2486[23]][_0x2486[22]]){case _0x2486[20]:_0x183ax12[_0x2486[18]]=_0x183axf[_0x2486[19]];break;case _0x2486[21]:break;default:};return MailMessage[_0x2486[28]](_0x183ax12)[_0x2486[27]](function(_0x183ax14){return _0x183ax10[_0x2486[26]](200)[_0x2486[25]](_0x183ax14)})[_0x2486[24]](function(_0x183ax13){return handleError(_0x183ax10,_0x183ax13,_0x183ax11)})};exports[_0x2486[29]]=function(_0x183axf,_0x183ax10,_0x183ax11){return MailMessage[_0x2486[36]](_0x183axf[_0x2486[32]][_0x2486[31]],{include:[{model:MailAttachment},{model:User,attributes:[_0x2486[31],_0x2486[33],_0x2486[34],_0x2486[35]]}]})[_0x2486[27]](function(_0x183ax15){if(!_0x183ax15){return _0x183ax10[_0x2486[30]](404)};return _0x183ax10[_0x2486[25]](_0x183ax15)})[_0x2486[24]](function(_0x183ax13){return handleError(_0x183ax10,_0x183ax13,_0x183ax11)})};exports[_0x2486[37]]=function(_0x183axf,_0x183ax10,_0x183ax11){_0x183axf[_0x2486[39]][_0x2486[38]]=_0x183axf[_0x2486[23]][_0x2486[31]];_0x183axf[_0x2486[39]][_0x2486[40]]=_0x183axf[_0x2486[39]][_0x2486[40]]||htmlToText[_0x2486[42]](_0x183axf[_0x2486[39]][_0x2486[41]],{wordwrap:false});return MailMessage[_0x2486[37]](_0x183axf[_0x2486[39]],{include:[{model:MailAttachment}]})[_0x2486[27]](function(_0x183ax15){return _0x183ax10[_0x2486[26]](201)[_0x2486[25]](_0x183ax15)})[_0x2486[24]](function(_0x183ax13){return handleError(_0x183ax10,_0x183ax13)})};exports[_0x2486[43]]=function(_0x183axf,_0x183ax10,_0x183ax11){return MailMessage[_0x2486[36]](_0x183axf[_0x2486[32]][_0x2486[31]],{include:[{all:true}]})[_0x2486[27]](function(_0x183ax15){if(!_0x183ax15){return _0x183ax10[_0x2486[30]](404)};var _0x183ax16=_[_0x2486[44]](_0x183ax15,_0x183axf[_0x2486[39]]);return _0x183ax16[_0x2486[45]]()})[_0x2486[27]](function(_0x183ax16){return _0x183ax10[_0x2486[26]](200)[_0x2486[25]](_0x183ax16)})[_0x2486[24]](function(_0x183ax13){return handleError(_0x183ax10,_0x183ax13,_0x183ax11)})};exports[_0x2486[46]]=function(_0x183axf,_0x183ax10,_0x183ax11){return MailMessage[_0x2486[36]](_0x183axf[_0x2486[32]][_0x2486[31]])[_0x2486[27]](function(_0x183ax15){if(!_0x183ax15){return _0x183ax10[_0x2486[30]](404)};return _0x183ax15[_0x2486[46]]()})[_0x2486[27]](function(){return _0x183ax10[_0x2486[30]](204)})[_0x2486[24]](function(_0x183ax13){return handleError(_0x183ax10,_0x183ax13,_0x183ax11)})};exports[_0x2486[47]]=function(_0x183axf,_0x183ax10,_0x183ax11){return MailMessage[_0x2486[49]]({where:{id:{$in:_0x183axf[_0x2486[39]][_0x2486[31]]}},attributes:{directory:_0x2486[48]}})[_0x2486[27]](function(_0x183ax15){if(!_0x183ax15){return _0x183ax10[_0x2486[30]](404)};return _0x183ax15[_0x2486[46]]()})[_0x2486[27]](function(){return _0x183ax10[_0x2486[30]](204)})[_0x2486[24]](function(_0x183ax13){return handleError(_0x183ax10,_0x183ax13,_0x183ax11)})};function handleError(_0x183ax10,_0x183ax13,_0x183ax11){return _0x183ax10[_0x2486[26]](500)[_0x2486[25]](_0x183ax13)}
\ No newline at end of file
+var _0x9b9a=["\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","\x66\x72\x6F\x6D","\x73\x75\x62\x6A\x65\x63\x74","\x50\x45\x4E\x44\x49\x4E\x47","\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\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"];_0x9b9a[0];var _=require(_0x9b9a[1]);var async=require(_0x9b9a[2]);var htmlToText=require(_0x9b9a[3]);var formidable=require(_0x9b9a[4]);var moment=require(_0x9b9a[5]);var path=require(_0x9b9a[6]);var config=require(_0x9b9a[7]);var sequelize=require(_0x9b9a[9])[_0x9b9a[8]];var MailMessage=require(_0x9b9a[9])[_0x9b9a[10]];var MailAttachment=require(_0x9b9a[9])[_0x9b9a[11]];var MailRoom=require(_0x9b9a[9])[_0x9b9a[12]];var MailAccount=require(_0x9b9a[9])[_0x9b9a[13]];var ContactEmail=require(_0x9b9a[9])[_0x9b9a[14]];var Contact=require(_0x9b9a[9])[_0x9b9a[15]];var User=require(_0x9b9a[9])[_0x9b9a[16]];exports[_0x9b9a[17]]= function(_0xf518x10,_0xf518x11,_0xf518x12){var _0xf518x13={order:_0x9b9a[18],include:[{all:true,include:[{all:true}]}]};switch(_0xf518x10[_0x9b9a[24]][_0x9b9a[23]]){case _0x9b9a[21]:_0xf518x13[_0x9b9a[19]]= _0xf518x10[_0x9b9a[20]];break;case _0x9b9a[22]:break;default:};return MailMessage[_0x9b9a[29]](_0xf518x13)[_0x9b9a[28]](function(_0xf518x15){return _0xf518x11[_0x9b9a[27]](200)[_0x9b9a[26]](_0xf518x15)})[_0x9b9a[25]](function(_0xf518x14){return handleError(_0xf518x11,_0xf518x14,_0xf518x12)})};exports[_0x9b9a[30]]= function(_0xf518x10,_0xf518x11){return MailMessage[_0x9b9a[30]]()[_0x9b9a[28]](function(_0xf518x16){return _0xf518x11[_0x9b9a[27]](200)[_0x9b9a[26]](_0xf518x16)})[_0x9b9a[25]](function(_0xf518x14){return handleError(_0xf518x11,_0xf518x14)})};exports[_0x9b9a[31]]= function(_0xf518x10,_0xf518x11,_0xf518x12){return MailMessage[_0x9b9a[38]](_0xf518x10[_0x9b9a[34]][_0x9b9a[33]],{include:[{model:MailAttachment},{model:User,attributes:[_0x9b9a[33],_0x9b9a[35],_0x9b9a[36],_0x9b9a[37]]}]})[_0x9b9a[28]](function(_0xf518x17){if(!_0xf518x17){return _0xf518x11[_0x9b9a[32]](404)};return _0xf518x11[_0x9b9a[26]](_0xf518x17)})[_0x9b9a[25]](function(_0xf518x14){return handleError(_0xf518x11,_0xf518x14,_0xf518x12)})};exports[_0x9b9a[39]]= function(_0xf518x10,_0xf518x11,_0xf518x12){_0xf518x10[_0x9b9a[41]][_0x9b9a[40]]= _0xf518x10[_0x9b9a[24]][_0x9b9a[33]];_0xf518x10[_0x9b9a[41]][_0x9b9a[42]]= _0xf518x10[_0x9b9a[24]][_0x9b9a[35]];_0xf518x10[_0x9b9a[41]][_0x9b9a[43]]= _0xf518x10[_0x9b9a[24]][_0x9b9a[36]];_0xf518x10[_0x9b9a[41]][_0x9b9a[44]]= _0xf518x10[_0x9b9a[41]][_0x9b9a[44]]|| htmlToText[_0x9b9a[46]](_0xf518x10[_0x9b9a[41]][_0x9b9a[45]],{wordwrap:false});return MailAccount[_0x9b9a[56]]({where:{address:_0xf518x10[_0x9b9a[41]][_0x9b9a[50]][0]}})[_0x9b9a[28]](function(_0xf518x19){_0xf518x10[_0x9b9a[41]][_0x9b9a[48]]= _0xf518x19[_0x9b9a[33]];_0xf518x10[_0x9b9a[41]][_0x9b9a[49]]= _0xf518x19[_0x9b9a[35]];return MailRoom[_0x9b9a[39]]({from:_0xf518x10[_0x9b9a[41]][_0x9b9a[50]][0],subject:_0xf518x10[_0x9b9a[41]][_0x9b9a[51]],account:_0xf518x19[_0x9b9a[35]],mailIn:0,mailOut:1,status:_0x9b9a[52],openReason:_0x9b9a[22],lastEvent:_0x9b9a[53],lastEventAt:moment()[_0x9b9a[55]](_0x9b9a[54]),MailAccountId:_0xf518x19[_0x9b9a[33]],MailMessages:[_0xf518x10[_0x9b9a[41]]]},{include:[{model:MailMessage,include:[{model:MailAttachment}]}]})})[_0x9b9a[28]](function(_0xf518x18){return _0xf518x11[_0x9b9a[27]](201)[_0x9b9a[26]](_0xf518x18)})[_0x9b9a[25]](function(_0xf518x14){console[_0x9b9a[47]](_0xf518x14);return handleError(_0xf518x11,_0xf518x14)})};exports[_0x9b9a[57]]= function(_0xf518x10,_0xf518x11,_0xf518x12){return MailMessage[_0x9b9a[38]](_0xf518x10[_0x9b9a[34]][_0x9b9a[33]],{include:[{all:true}]})[_0x9b9a[28]](function(_0xf518x17){if(!_0xf518x17){return _0xf518x11[_0x9b9a[32]](404)};var _0xf518x1a=_[_0x9b9a[58]](_0xf518x17,_0xf518x10[_0x9b9a[41]]);return _0xf518x1a[_0x9b9a[59]]()})[_0x9b9a[28]](function(_0xf518x1a){return _0xf518x11[_0x9b9a[27]](200)[_0x9b9a[26]](_0xf518x1a)})[_0x9b9a[25]](function(_0xf518x14){return handleError(_0xf518x11,_0xf518x14,_0xf518x12)})};exports[_0x9b9a[60]]= function(_0xf518x10,_0xf518x11,_0xf518x12){return MailMessage[_0x9b9a[38]](_0xf518x10[_0x9b9a[34]][_0x9b9a[33]])[_0x9b9a[28]](function(_0xf518x17){if(!_0xf518x17){return _0xf518x11[_0x9b9a[32]](404)};return _0xf518x17[_0x9b9a[60]]()})[_0x9b9a[28]](function(){return _0xf518x11[_0x9b9a[32]](204)})[_0x9b9a[25]](function(_0xf518x14){return handleError(_0xf518x11,_0xf518x14,_0xf518x12)})};exports[_0x9b9a[61]]= function(_0xf518x10,_0xf518x11,_0xf518x12){return MailMessage[_0x9b9a[63]]({where:{id:{$in:_0xf518x10[_0x9b9a[41]][_0x9b9a[33]]}},attributes:{directory:_0x9b9a[62]}})[_0x9b9a[28]](function(_0xf518x17){if(!_0xf518x17){return _0xf518x11[_0x9b9a[32]](404)};return _0xf518x17[_0x9b9a[60]]()})[_0x9b9a[28]](function(){return _0xf518x11[_0x9b9a[32]](204)})[_0x9b9a[25]](function(_0xf518x14){return handleError(_0xf518x11,_0xf518x14,_0xf518x12)})};function handleError(_0xf518x11,_0xf518x14,_0xf518x12){return _0xf518x11[_0x9b9a[27]](500)[_0x9b9a[26]](_0xf518x14)}
\ No newline at end of file