Built motion from commit dec9cf4.|0.0.134
[motion.git] / server / api / mail_message / mail_message.controller.js
index f2bd8fb..f5760bb 100644 (file)
@@ -1 +1 @@
-var _0xcb5f=["\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","\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","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x65\x72\x72\x6F\x72","\x72\x6F\x6C\x6C\x62\x61\x63\x6B","\x63\x6F\x6D\x6D\x69\x74","\x62\x6F\x64\x79","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\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"];_0xcb5f[0];var _=require(_0xcb5f[1]);var async=require(_0xcb5f[2]);var htmlToText=require(_0xcb5f[3]);var formidable=require(_0xcb5f[4]);var path=require(_0xcb5f[5]);var config=require(_0xcb5f[6]);var sequelize=require(_0xcb5f[8])[_0xcb5f[7]];var MailMessage=require(_0xcb5f[8])[_0xcb5f[9]];var MailAttachment=require(_0xcb5f[8])[_0xcb5f[10]];var MailRoom=require(_0xcb5f[8])[_0xcb5f[11]];var MailAccount=require(_0xcb5f[8])[_0xcb5f[12]];var Contact=require(_0xcb5f[8])[_0xcb5f[13]];exports[_0xcb5f[14]]=function(_0xcacfxd,_0xcacfxe,_0xcacfxf){var _0xcacfx10={order:_0xcb5f[15],include:[{all:true,include:[{all:true}]}]};switch(_0xcacfxd[_0xcb5f[21]][_0xcb5f[20]]){case _0xcb5f[18]:_0xcacfx10[_0xcb5f[16]]=_0xcacfxd[_0xcb5f[17]];break ;;case _0xcb5f[19]:break ;;default:;};MailMessage[_0xcb5f[26]](_0xcacfx10)[_0xcb5f[25]](function(_0xcacfx12){return _0xcacfxe[_0xcb5f[24]](200)[_0xcb5f[23]](_0xcacfx12)})[_0xcb5f[22]](function(_0xcacfx11){return handleError(_0xcacfxe,_0xcacfx11,_0xcacfxf)});};exports[_0xcb5f[27]]=function(_0xcacfxd,_0xcacfxe,_0xcacfxf){MailMessage[_0xcb5f[31]](_0xcacfxd[_0xcb5f[30]][_0xcb5f[29]],{include:[{all:true,include:[{all:true}]}]})[_0xcb5f[25]](function(_0xcacfx13){if(!_0xcacfx13){return _0xcacfxe[_0xcb5f[28]](404)};return _0xcacfxe[_0xcb5f[23]](_0xcacfx13);})[_0xcb5f[22]](function(_0xcacfx11){return handleError(_0xcacfxe,_0xcacfx11,_0xcacfxf)})};exports[_0xcb5f[32]]=function(_0xcacfxd,_0xcacfxe,_0xcacfxf){return sequelize[_0xcb5f[37]]()[_0xcb5f[25]](function(_0xcacfx14){return MailMessage[_0xcb5f[32]](_0xcacfxd[_0xcb5f[36]],{include:[{model:MailAttachment}],transaction:_0xcacfx14})[_0xcb5f[25]](function(_0xcacfx13){_0xcacfx14[_0xcb5f[35]]();return _0xcacfxe[_0xcb5f[24]](201)[_0xcb5f[23]](_0xcacfx13);})[_0xcb5f[22]](function(_0xcacfx11){console[_0xcb5f[33]](_0xcacfx11);_0xcacfx14[_0xcb5f[34]]();return handleError(_0xcacfxe,_0xcacfx11);})})};exports[_0xcb5f[38]]=function(_0xcacfxd,_0xcacfxe,_0xcacfxf){MailMessage[_0xcb5f[31]](_0xcacfxd[_0xcb5f[30]][_0xcb5f[29]],{include:[{all:true}]})[_0xcb5f[25]](function(_0xcacfx13){if(!_0xcacfx13){return _0xcacfxe[_0xcb5f[28]](404)};var _0xcacfx15=_[_0xcb5f[39]](_0xcacfx13,_0xcacfxd[_0xcb5f[36]]);_0xcacfx15[_0xcb5f[40]]()[_0xcb5f[25]](function(){return _0xcacfxe[_0xcb5f[24]](200)[_0xcb5f[23]](_0xcacfx15)})[_0xcb5f[22]](function(_0xcacfx11){return handleError(_0xcacfxe,_0xcacfx11,_0xcacfxf)});})[_0xcb5f[22]](function(_0xcacfx11){return handleError(_0xcacfxe,_0xcacfx11,_0xcacfxf)})};exports[_0xcb5f[41]]=function(_0xcacfxd,_0xcacfxe,_0xcacfxf){MailMessage[_0xcb5f[31]](_0xcacfxd[_0xcb5f[30]][_0xcb5f[29]])[_0xcb5f[25]](function(_0xcacfx13){if(!_0xcacfx13){return _0xcacfxe[_0xcb5f[28]](404)};_0xcacfx13[_0xcb5f[41]]()[_0xcb5f[25]](function(){return _0xcacfxe[_0xcb5f[28]](204)})[_0xcb5f[22]](function(_0xcacfx11){return handleError(_0xcacfxe,_0xcacfx11,_0xcacfxf)});})[_0xcb5f[22]](function(_0xcacfx11){return handleError(_0xcacfxe,_0xcacfx11,_0xcacfxf)})};exports[_0xcb5f[42]]=function(_0xcacfxd,_0xcacfxe,_0xcacfxf){MailMessage[_0xcb5f[44]]({where:{id:{$in:_0xcacfxd[_0xcb5f[36]][_0xcb5f[29]]}},attributes:{directory:_0xcb5f[43]}})[_0xcb5f[25]](function(_0xcacfx13){if(!_0xcacfx13){return _0xcacfxe[_0xcb5f[28]](404)};_0xcacfx13[_0xcb5f[41]]()[_0xcb5f[25]](function(){return _0xcacfxe[_0xcb5f[28]](204)})[_0xcb5f[22]](function(_0xcacfx11){return handleError(_0xcacfxe,_0xcacfx11,_0xcacfxf)});})[_0xcb5f[22]](function(_0xcacfx11){return handleError(_0xcacfxe,_0xcacfx11,_0xcacfxf)})};function handleError(_0xcacfxe,_0xcacfx11,_0xcacfxf){return _0xcacfxe[_0xcb5f[24]](500)[_0xcb5f[23]](_0xcacfx11)}
\ No newline at end of file
+var _0x58ba=["\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"];_0x58ba[0];var _=require(_0x58ba[1]);var async=require(_0x58ba[2]);var htmlToText=require(_0x58ba[3]);var formidable=require(_0x58ba[4]);var moment=require(_0x58ba[5]);var path=require(_0x58ba[6]);var config=require(_0x58ba[7]);var sequelize=require(_0x58ba[9])[_0x58ba[8]];var MailMessage=require(_0x58ba[9])[_0x58ba[10]];var MailAttachment=require(_0x58ba[9])[_0x58ba[11]];var MailRoom=require(_0x58ba[9])[_0x58ba[12]];var MailAccount=require(_0x58ba[9])[_0x58ba[13]];var ContactEmail=require(_0x58ba[9])[_0x58ba[14]];var Contact=require(_0x58ba[9])[_0x58ba[15]];var User=require(_0x58ba[9])[_0x58ba[16]];exports[_0x58ba[17]]= function(_0x5c52x10,_0x5c52x11,_0x5c52x12){var _0x5c52x13={order:_0x58ba[18],include:[{all:true,include:[{all:true}]}]};switch(_0x5c52x10[_0x58ba[24]][_0x58ba[23]]){case _0x58ba[21]:_0x5c52x13[_0x58ba[19]]= _0x5c52x10[_0x58ba[20]];break;case _0x58ba[22]:break;default:};return MailMessage[_0x58ba[29]](_0x5c52x13)[_0x58ba[28]](function(_0x5c52x15){return _0x5c52x11[_0x58ba[27]](200)[_0x58ba[26]](_0x5c52x15)})[_0x58ba[25]](function(_0x5c52x14){return handleError(_0x5c52x11,_0x5c52x14,_0x5c52x12)})};exports[_0x58ba[30]]= function(_0x5c52x10,_0x5c52x11){return MailMessage[_0x58ba[30]]()[_0x58ba[28]](function(_0x5c52x16){return _0x5c52x11[_0x58ba[27]](200)[_0x58ba[26]](_0x5c52x16)})[_0x58ba[25]](function(_0x5c52x14){return handleError(_0x5c52x11,_0x5c52x14)})};exports[_0x58ba[31]]= function(_0x5c52x10,_0x5c52x11,_0x5c52x12){return MailMessage[_0x58ba[38]](_0x5c52x10[_0x58ba[34]][_0x58ba[33]],{include:[{model:MailAttachment},{model:User,attributes:[_0x58ba[33],_0x58ba[35],_0x58ba[36],_0x58ba[37]]}]})[_0x58ba[28]](function(_0x5c52x17){if(!_0x5c52x17){return _0x5c52x11[_0x58ba[32]](404)};return _0x5c52x11[_0x58ba[26]](_0x5c52x17)})[_0x58ba[25]](function(_0x5c52x14){return handleError(_0x5c52x11,_0x5c52x14,_0x5c52x12)})};exports[_0x58ba[39]]= function(_0x5c52x10,_0x5c52x11,_0x5c52x12){_0x5c52x10[_0x58ba[41]][_0x58ba[40]]= _0x5c52x10[_0x58ba[24]][_0x58ba[33]];_0x5c52x10[_0x58ba[41]][_0x58ba[42]]= _0x5c52x10[_0x58ba[24]][_0x58ba[35]];_0x5c52x10[_0x58ba[41]][_0x58ba[43]]= _0x5c52x10[_0x58ba[24]][_0x58ba[36]];_0x5c52x10[_0x58ba[41]][_0x58ba[40]]= _0x5c52x10[_0x58ba[24]][_0x58ba[33]];_0x5c52x10[_0x58ba[41]][_0x58ba[44]]= _0x5c52x10[_0x58ba[41]][_0x58ba[44]]|| htmlToText[_0x58ba[46]](_0x5c52x10[_0x58ba[41]][_0x58ba[45]],{wordwrap:false});return MailAccount[_0x58ba[56]]({where:{address:_0x5c52x10[_0x58ba[41]][_0x58ba[55]][0]}})[_0x58ba[28]](function(_0x5c52x19){_0x5c52x10[_0x58ba[41]][_0x58ba[48]]= _0x5c52x19[_0x58ba[33]];_0x5c52x10[_0x58ba[41]][_0x58ba[49]]= _0x5c52x19[_0x58ba[35]];return MailRoom[_0x58ba[39]]({subject:_0x5c52x10[_0x58ba[41]][_0x58ba[50]],account:_0x5c52x19[_0x58ba[35]],mailIn:0,mailOut:1,status:_0x58ba[51],openReason:_0x58ba[22],lastEvent:_0x58ba[52],lastEventAt:moment()[_0x58ba[54]](_0x58ba[53]),MailAccountId:_0x5c52x19[_0x58ba[33]],MailMessages:[_0x5c52x10[_0x58ba[41]]]},{include:[{model:MailMessage,include:[{model:MailAttachment}]}]})})[_0x58ba[28]](function(_0x5c52x18){return _0x5c52x11[_0x58ba[27]](201)[_0x58ba[26]](_0x5c52x18)})[_0x58ba[25]](function(_0x5c52x14){console[_0x58ba[47]](_0x5c52x14);return handleError(_0x5c52x11,_0x5c52x14)})};exports[_0x58ba[57]]= function(_0x5c52x10,_0x5c52x11,_0x5c52x12){return MailMessage[_0x58ba[38]](_0x5c52x10[_0x58ba[34]][_0x58ba[33]],{include:[{all:true}]})[_0x58ba[28]](function(_0x5c52x17){if(!_0x5c52x17){return _0x5c52x11[_0x58ba[32]](404)};var _0x5c52x1a=_[_0x58ba[58]](_0x5c52x17,_0x5c52x10[_0x58ba[41]]);return _0x5c52x1a[_0x58ba[59]]()})[_0x58ba[28]](function(_0x5c52x1a){return _0x5c52x11[_0x58ba[27]](200)[_0x58ba[26]](_0x5c52x1a)})[_0x58ba[25]](function(_0x5c52x14){return handleError(_0x5c52x11,_0x5c52x14,_0x5c52x12)})};exports[_0x58ba[60]]= function(_0x5c52x10,_0x5c52x11,_0x5c52x12){return MailMessage[_0x58ba[38]](_0x5c52x10[_0x58ba[34]][_0x58ba[33]])[_0x58ba[28]](function(_0x5c52x17){if(!_0x5c52x17){return _0x5c52x11[_0x58ba[32]](404)};return _0x5c52x17[_0x58ba[60]]()})[_0x58ba[28]](function(){return _0x5c52x11[_0x58ba[32]](204)})[_0x58ba[25]](function(_0x5c52x14){return handleError(_0x5c52x11,_0x5c52x14,_0x5c52x12)})};exports[_0x58ba[61]]= function(_0x5c52x10,_0x5c52x11,_0x5c52x12){return MailMessage[_0x58ba[63]]({where:{id:{$in:_0x5c52x10[_0x58ba[41]][_0x58ba[33]]}},attributes:{directory:_0x58ba[62]}})[_0x58ba[28]](function(_0x5c52x17){if(!_0x5c52x17){return _0x5c52x11[_0x58ba[32]](404)};return _0x5c52x17[_0x58ba[60]]()})[_0x58ba[28]](function(){return _0x5c52x11[_0x58ba[32]](204)})[_0x58ba[25]](function(_0x5c52x14){return handleError(_0x5c52x11,_0x5c52x14,_0x5c52x12)})};function handleError(_0x5c52x11,_0x5c52x14,_0x5c52x12){return _0x5c52x11[_0x58ba[27]](500)[_0x58ba[26]](_0x5c52x14)}
\ No newline at end of file