Built motion from commit e2826ce0c.|1.0.24
[motion.git] / server / api / mail_message / mail_message.controller.js
index f3fd992..ff5016e 100644 (file)
@@ -1 +1 @@
-var _0xfa71=["\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","\x61\x70\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\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","\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","\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","\x73\x74\x61\x63\x6B","\x65\x72\x72\x6F\x72"];_0xfa71[0];var _=require(_0xfa71[1]);var async=require(_0xfa71[2]);var htmlToText=require(_0xfa71[3]);var formidable=require(_0xfa71[4]);var moment=require(_0xfa71[5]);var path=require(_0xfa71[6]);var logger=require(_0xfa71[8])(_0xfa71[7]);var config=require(_0xfa71[9]);var sequelize=require(_0xfa71[11])[_0xfa71[10]];var MailMessage=require(_0xfa71[11])[_0xfa71[12]];var MailAttachment=require(_0xfa71[11])[_0xfa71[13]];var MailRoom=require(_0xfa71[11])[_0xfa71[14]];var MailAccount=require(_0xfa71[11])[_0xfa71[15]];var ContactEmail=require(_0xfa71[11])[_0xfa71[16]];var Contact=require(_0xfa71[11])[_0xfa71[17]];var User=require(_0xfa71[11])[_0xfa71[18]];exports[_0xfa71[19]]= function(_0xf624x11,_0xf624x12,_0xf624x13){var _0xf624x14={order:_0xfa71[20],include:[{all:true,include:[{all:true}]}]};switch(_0xf624x11[_0xfa71[26]][_0xfa71[25]]){case _0xfa71[23]:_0xf624x14[_0xfa71[21]]= _0xf624x11[_0xfa71[22]];break;case _0xfa71[24]:break;default:};return MailMessage[_0xfa71[31]](_0xf624x14)[_0xfa71[30]](function(_0xf624x16){return _0xf624x12[_0xfa71[29]](200)[_0xfa71[28]](_0xf624x16)})[_0xfa71[27]](function(_0xf624x15){return handleError(_0xf624x12,_0xf624x15,_0xf624x13)})};exports[_0xfa71[32]]= function(_0xf624x11,_0xf624x12){return MailMessage[_0xfa71[32]]()[_0xfa71[30]](function(_0xf624x17){return _0xf624x12[_0xfa71[29]](200)[_0xfa71[28]](_0xf624x17)})[_0xfa71[27]](function(_0xf624x15){return handleError(_0xf624x12,_0xf624x15)})};exports[_0xfa71[33]]= function(_0xf624x11,_0xf624x12,_0xf624x13){return MailMessage[_0xfa71[40]](_0xf624x11[_0xfa71[36]][_0xfa71[35]],{include:[{model:MailAttachment},{model:User,attributes:[_0xfa71[35],_0xfa71[37],_0xfa71[38],_0xfa71[39]]}]})[_0xfa71[30]](function(_0xf624x18){if(!_0xf624x18){return _0xf624x12[_0xfa71[34]](404)};return _0xf624x12[_0xfa71[28]](_0xf624x18)})[_0xfa71[27]](function(_0xf624x15){return handleError(_0xf624x12,_0xf624x15,_0xf624x13)})};exports[_0xfa71[41]]= function(_0xf624x11,_0xf624x12,_0xf624x13){_0xf624x11[_0xfa71[43]][_0xfa71[42]]= _0xf624x11[_0xfa71[26]][_0xfa71[35]];_0xf624x11[_0xfa71[43]][_0xfa71[44]]= _0xf624x11[_0xfa71[26]][_0xfa71[37]];_0xf624x11[_0xfa71[43]][_0xfa71[45]]= _0xf624x11[_0xfa71[26]][_0xfa71[38]];_0xf624x11[_0xfa71[43]][_0xfa71[46]]= _0xf624x11[_0xfa71[43]][_0xfa71[46]]|| htmlToText[_0xfa71[48]](_0xf624x11[_0xfa71[43]][_0xfa71[47]],{wordwrap:false});return MailAccount[_0xfa71[57]]({where:{address:_0xf624x11[_0xfa71[43]][_0xfa71[51]][0]}})[_0xfa71[30]](function(_0xf624x1a){_0xf624x11[_0xfa71[43]][_0xfa71[49]]= _0xf624x1a[_0xfa71[35]];_0xf624x11[_0xfa71[43]][_0xfa71[50]]= _0xf624x1a[_0xfa71[37]];return MailRoom[_0xfa71[41]]({from:_0xf624x11[_0xfa71[43]][_0xfa71[51]][0],subject:_0xf624x11[_0xfa71[43]][_0xfa71[52]],account:_0xf624x1a[_0xfa71[37]],mailIn:0,mailOut:1,status:_0xfa71[53],openReason:_0xfa71[24],lastEvent:_0xfa71[54],lastEventAt:moment()[_0xfa71[56]](_0xfa71[55]),MailAccountId:_0xf624x1a[_0xfa71[35]],MailMessages:[_0xf624x11[_0xfa71[43]]]},{include:[{model:MailMessage,include:[{model:MailAttachment}]}]})})[_0xfa71[30]](function(_0xf624x19){return _0xf624x12[_0xfa71[29]](201)[_0xfa71[28]](_0xf624x19)})[_0xfa71[27]](function(_0xf624x15){return handleError(_0xf624x12,_0xf624x15)})};exports[_0xfa71[58]]= function(_0xf624x11,_0xf624x12,_0xf624x13){return MailMessage[_0xfa71[40]](_0xf624x11[_0xfa71[36]][_0xfa71[35]],{include:[{all:true}]})[_0xfa71[30]](function(_0xf624x18){if(!_0xf624x18){return _0xf624x12[_0xfa71[34]](404)};return _0xf624x18[_0xfa71[58]](_0xf624x11[_0xfa71[43]])})[_0xfa71[30]](function(_0xf624x18){return _0xf624x12[_0xfa71[29]](200)[_0xfa71[28]](_0xf624x18)})[_0xfa71[27]](function(_0xf624x15){return handleError(_0xf624x12,_0xf624x15,_0xf624x13)})};exports[_0xfa71[59]]= function(_0xf624x11,_0xf624x12,_0xf624x13){return MailMessage[_0xfa71[40]](_0xf624x11[_0xfa71[36]][_0xfa71[35]])[_0xfa71[30]](function(_0xf624x18){if(!_0xf624x18){return _0xf624x12[_0xfa71[34]](404)};return _0xf624x18[_0xfa71[59]]()})[_0xfa71[30]](function(){return _0xf624x12[_0xfa71[34]](204)})[_0xfa71[27]](function(_0xf624x15){return handleError(_0xf624x12,_0xf624x15,_0xf624x13)})};exports[_0xfa71[60]]= function(_0xf624x11,_0xf624x12,_0xf624x13){return MailMessage[_0xfa71[62]]({where:{id:{$in:_0xf624x11[_0xfa71[43]][_0xfa71[35]]}},attributes:{directory:_0xfa71[61]}})[_0xfa71[30]](function(_0xf624x18){if(!_0xf624x18){return _0xf624x12[_0xfa71[34]](404)};return _0xf624x18[_0xfa71[59]]()})[_0xfa71[30]](function(){return _0xf624x12[_0xfa71[34]](204)})[_0xfa71[27]](function(_0xf624x15){return handleError(_0xf624x12,_0xf624x15,_0xf624x13)})};function handleError(_0xf624x12,_0xf624x15,_0xf624x13){logger[_0xfa71[64]](_0xf624x15[_0xfa71[63]]);return _0xf624x12[_0xfa71[29]](500)[_0xfa71[28]](_0xf624x15)}
\ No newline at end of file
+var _0xf935=["\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","\x61\x70\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\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","\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","\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","\x73\x74\x61\x63\x6B","\x65\x72\x72\x6F\x72"];_0xf935[0];var _=require(_0xf935[1]);var async=require(_0xf935[2]);var htmlToText=require(_0xf935[3]);var formidable=require(_0xf935[4]);var moment=require(_0xf935[5]);var path=require(_0xf935[6]);var logger=require(_0xf935[8])(_0xf935[7]);var config=require(_0xf935[9]);var sequelize=require(_0xf935[11])[_0xf935[10]];var MailMessage=require(_0xf935[11])[_0xf935[12]];var MailAttachment=require(_0xf935[11])[_0xf935[13]];var MailRoom=require(_0xf935[11])[_0xf935[14]];var MailAccount=require(_0xf935[11])[_0xf935[15]];var ContactEmail=require(_0xf935[11])[_0xf935[16]];var Contact=require(_0xf935[11])[_0xf935[17]];var User=require(_0xf935[11])[_0xf935[18]];exports[_0xf935[19]]= function(_0xb970x11,_0xb970x12,_0xb970x13){var _0xb970x14={order:_0xf935[20],include:[{all:true,include:[{all:true}]}]};switch(_0xb970x11[_0xf935[26]][_0xf935[25]]){case _0xf935[23]:_0xb970x14[_0xf935[21]]= _0xb970x11[_0xf935[22]];break;case _0xf935[24]:break;default:};return MailMessage[_0xf935[31]](_0xb970x14)[_0xf935[30]](function(_0xb970x16){return _0xb970x12[_0xf935[29]](200)[_0xf935[28]](_0xb970x16)})[_0xf935[27]](function(_0xb970x15){return handleError(_0xb970x12,_0xb970x15,_0xb970x13)})};exports[_0xf935[32]]= function(_0xb970x11,_0xb970x12){return MailMessage[_0xf935[32]]()[_0xf935[30]](function(_0xb970x17){return _0xb970x12[_0xf935[29]](200)[_0xf935[28]](_0xb970x17)})[_0xf935[27]](function(_0xb970x15){return handleError(_0xb970x12,_0xb970x15)})};exports[_0xf935[33]]= function(_0xb970x11,_0xb970x12,_0xb970x13){return MailMessage[_0xf935[40]](_0xb970x11[_0xf935[36]][_0xf935[35]],{include:[{model:MailAttachment},{model:User,attributes:[_0xf935[35],_0xf935[37],_0xf935[38],_0xf935[39]]}]})[_0xf935[30]](function(_0xb970x18){if(!_0xb970x18){return _0xb970x12[_0xf935[34]](404)};return _0xb970x12[_0xf935[28]](_0xb970x18)})[_0xf935[27]](function(_0xb970x15){return handleError(_0xb970x12,_0xb970x15,_0xb970x13)})};exports[_0xf935[41]]= function(_0xb970x11,_0xb970x12,_0xb970x13){_0xb970x11[_0xf935[43]][_0xf935[42]]= _0xb970x11[_0xf935[26]][_0xf935[35]];_0xb970x11[_0xf935[43]][_0xf935[44]]= _0xb970x11[_0xf935[26]][_0xf935[37]];_0xb970x11[_0xf935[43]][_0xf935[45]]= _0xb970x11[_0xf935[26]][_0xf935[38]];_0xb970x11[_0xf935[43]][_0xf935[46]]= _0xb970x11[_0xf935[43]][_0xf935[46]]|| htmlToText[_0xf935[48]](_0xb970x11[_0xf935[43]][_0xf935[47]],{wordwrap:false});return MailAccount[_0xf935[57]]({where:{address:_0xb970x11[_0xf935[43]][_0xf935[51]][0]}})[_0xf935[30]](function(_0xb970x1a){_0xb970x11[_0xf935[43]][_0xf935[49]]= _0xb970x1a[_0xf935[35]];_0xb970x11[_0xf935[43]][_0xf935[50]]= _0xb970x1a[_0xf935[37]];return MailRoom[_0xf935[41]]({from:_0xb970x11[_0xf935[43]][_0xf935[51]][0],subject:_0xb970x11[_0xf935[43]][_0xf935[52]],account:_0xb970x1a[_0xf935[37]],mailIn:0,mailOut:1,status:_0xf935[53],openReason:_0xf935[24],lastEvent:_0xf935[54],lastEventAt:moment()[_0xf935[56]](_0xf935[55]),MailAccountId:_0xb970x1a[_0xf935[35]],MailMessages:[_0xb970x11[_0xf935[43]]]},{include:[{model:MailMessage,include:[{model:MailAttachment}]}]})})[_0xf935[30]](function(_0xb970x19){return _0xb970x12[_0xf935[29]](201)[_0xf935[28]](_0xb970x19)})[_0xf935[27]](function(_0xb970x15){return handleError(_0xb970x12,_0xb970x15)})};exports[_0xf935[58]]= function(_0xb970x11,_0xb970x12,_0xb970x13){return MailMessage[_0xf935[40]](_0xb970x11[_0xf935[36]][_0xf935[35]],{include:[{all:true}]})[_0xf935[30]](function(_0xb970x18){if(!_0xb970x18){return _0xb970x12[_0xf935[34]](404)};return _0xb970x18[_0xf935[58]](_0xb970x11[_0xf935[43]])})[_0xf935[30]](function(_0xb970x18){return _0xb970x12[_0xf935[29]](200)[_0xf935[28]](_0xb970x18)})[_0xf935[27]](function(_0xb970x15){return handleError(_0xb970x12,_0xb970x15,_0xb970x13)})};exports[_0xf935[59]]= function(_0xb970x11,_0xb970x12,_0xb970x13){return MailMessage[_0xf935[40]](_0xb970x11[_0xf935[36]][_0xf935[35]])[_0xf935[30]](function(_0xb970x18){if(!_0xb970x18){return _0xb970x12[_0xf935[34]](404)};return _0xb970x18[_0xf935[59]]()})[_0xf935[30]](function(){return _0xb970x12[_0xf935[34]](204)})[_0xf935[27]](function(_0xb970x15){return handleError(_0xb970x12,_0xb970x15,_0xb970x13)})};exports[_0xf935[60]]= function(_0xb970x11,_0xb970x12,_0xb970x13){return MailMessage[_0xf935[62]]({where:{id:{$in:_0xb970x11[_0xf935[43]][_0xf935[35]]}},attributes:{directory:_0xf935[61]}})[_0xf935[30]](function(_0xb970x18){if(!_0xb970x18){return _0xb970x12[_0xf935[34]](404)};return _0xb970x18[_0xf935[59]]()})[_0xf935[30]](function(){return _0xb970x12[_0xf935[34]](204)})[_0xf935[27]](function(_0xb970x15){return handleError(_0xb970x12,_0xb970x15,_0xb970x13)})};function handleError(_0xb970x12,_0xb970x15,_0xb970x13){logger[_0xf935[64]](_0xb970x15[_0xf935[63]]);return _0xb970x12[_0xf935[29]](500)[_0xf935[28]](_0xb970x15)}
\ No newline at end of file