Built motion from commit 6f2e1b5.|0.0.58
[motion.git] / server / api / mail_room / mail_room.controller.js
1 var _0x165f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x43\x6F\x6E\x74\x61\x63\x74","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x64\x65\x66\x61\x75\x6C\x74","\x61\x67\x65\x6E\x74","\x69\x64","\x75\x73\x65\x72","\x73\x63\x6F\x70\x65","\x72\x6F\x6C\x65","\x61\x67\x65\x6E\x74\x49\x6E\x64\x65\x78","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x65\x72\x72\x6F\x72","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x6E\x61\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x67\x65\x74\x55\x73\x65\x72\x73","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x63\x72\x65\x61\x74\x65\x4D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D\x49\x64","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x6C\x65\x6E\x67\x74\x68","\x72\x6F\x6C\x6C\x62\x61\x63\x6B","\x63\x6F\x6D\x6D\x69\x74","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x6A\x6F\x62\x49\x64","\x4D\x61\x69\x6C\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x61\x73\x73\x69\x67\x6E\x65\x64","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x75\x70\x64\x61\x74\x65\x41\x67\x65\x6E\x74\x73","\x61\x67\x65\x6E\x74\x73","\x73\x65\x74\x55\x73\x65\x72\x73","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79"];_0x165f[0];var _=require(_0x165f[1]);var util=require(_0x165f[2]);var Util=require(_0x165f[3]);var sequelize=require(_0x165f[5])[_0x165f[4]];var User=require(_0x165f[5])[_0x165f[6]];var Agent=require(_0x165f[5])[_0x165f[6]];var Contact=require(_0x165f[5])[_0x165f[7]];var MailRoom=require(_0x165f[5])[_0x165f[8]];var MailMessage=require(_0x165f[5])[_0x165f[9]];var MailAccount=require(_0x165f[5])[_0x165f[10]];var MailAttachment=require(_0x165f[5])[_0x165f[11]];exports[_0x165f[12]]=function(_0xf8b2xc,_0xf8b2xd,_0xf8b2xe){switch(_0xf8b2xc[_0x165f[23]][_0x165f[25]]){case _0x165f[21]:return MailRoom[_0x165f[24]](_0x165f[20],{method:[_0x165f[21],_0xf8b2xc[_0x165f[23]][_0x165f[22]]]})[_0x165f[19]](Util[_0x165f[18]](_0xf8b2xc[_0x165f[17]]))[_0x165f[16]](function(_0xf8b2x10){return _0xf8b2xd[_0x165f[15]](200)[_0x165f[14]](_0xf8b2x10)})[_0x165f[13]](function(_0xf8b2xf){return handleError(_0xf8b2xd,_0xf8b2xf)});default:return MailRoom[_0x165f[24]](_0x165f[20])[_0x165f[19]](Util[_0x165f[18]](_0xf8b2xc[_0x165f[17]]))[_0x165f[16]](function(_0xf8b2x10){return _0xf8b2xd[_0x165f[15]](200)[_0x165f[14]](_0xf8b2x10)})[_0x165f[13]](function(_0xf8b2xf){return handleError(_0xf8b2xd,_0xf8b2xf)})}};exports[_0x165f[26]]=function(_0xf8b2xc,_0xf8b2xd,_0xf8b2xe){return MailRoom[_0x165f[28]]({where:{UserId:_0xf8b2xc[_0x165f[27]][_0x165f[22]]},include:[{all:true}]})[_0x165f[16]](function(_0xf8b2x11){return _0xf8b2xd[_0x165f[15]](200)[_0x165f[14]](_0xf8b2x11)})[_0x165f[13]](function(_0xf8b2xf){return handleError(_0xf8b2xd,_0xf8b2xf)})};exports[_0x165f[29]]=function(_0xf8b2xc,_0xf8b2xd,_0xf8b2xe){return MailRoom[_0x165f[24]](_0x165f[20])[_0x165f[32]](_0xf8b2xc[_0x165f[27]][_0x165f[22]])[_0x165f[16]](function(_0xf8b2x12){if(!_0xf8b2x12){return _0xf8b2xd[_0x165f[31]](404)};return _0xf8b2xd[_0x165f[14]](_0xf8b2x12)})[_0x165f[13]](function(_0xf8b2xf){console[_0x165f[30]](_0xf8b2xf);return handleError(_0xf8b2xd,_0xf8b2xf)})};exports[_0x165f[33]]=function(_0xf8b2xc,_0xf8b2xd,_0xf8b2xe){return MailRoom[_0x165f[32]](_0xf8b2xc[_0x165f[27]][_0x165f[22]])[_0x165f[16]](function(_0xf8b2x12){if(!_0xf8b2x12){return _0xf8b2xd[_0x165f[31]](404)};return _0xf8b2x12[_0x165f[38]]({attributes:[_0x165f[22],_0x165f[34],_0x165f[35],_0x165f[36],_0x165f[25],_0x165f[37]]})})[_0x165f[16]](function(_0xf8b2x13){return _0xf8b2xd[_0x165f[14]](_0xf8b2x13)})[_0x165f[13]](function(_0xf8b2xf){return handleError(_0xf8b2xd,_0xf8b2xf)})};exports[_0x165f[39]]=function(_0xf8b2xc,_0xf8b2xd,_0xf8b2xe){return MailRoom[_0x165f[39]](_0xf8b2xc[_0x165f[40]])[_0x165f[16]](function(_0xf8b2x12){return _0xf8b2xd[_0x165f[15]](201)[_0x165f[14]](_0xf8b2x12)})[_0x165f[13]](function(_0xf8b2xf){return handleError(_0xf8b2xd,_0xf8b2xf)})};exports[_0x165f[41]]=function(_0xf8b2xc,_0xf8b2xd,_0xf8b2xe){_0xf8b2xc[_0x165f[40]][_0x165f[42]]=_0xf8b2xc[_0x165f[27]][_0x165f[22]];_0xf8b2xc[_0x165f[40]][_0x165f[43]]=(_0xf8b2xc[_0x165f[40]][_0x165f[44]]&&_0xf8b2xc[_0x165f[40]][_0x165f[44]][_0x165f[45]])?true:false;return sequelize[_0x165f[48]]()[_0x165f[16]](function(_0xf8b2x14){return MailMessage[_0x165f[39]](_0xf8b2xc[_0x165f[40]],{include:[{model:MailAttachment}],transaction:_0xf8b2x14,user:_0xf8b2xc[_0x165f[23]]})[_0x165f[16]](function(_0xf8b2x15){_0xf8b2x14[_0x165f[47]]();return _0xf8b2xd[_0x165f[15]](201)[_0x165f[14]](_0xf8b2x15)})[_0x165f[13]](function(_0xf8b2xf){console[_0x165f[30]](_0xf8b2xf);_0xf8b2x14[_0x165f[46]]();return handleError(_0xf8b2xd,_0xf8b2xf)})})};exports[_0x165f[49]]=function(_0xf8b2xc,_0xf8b2xd,_0xf8b2xe){return MailRoom[_0x165f[32]](_0xf8b2xc[_0x165f[27]][_0x165f[22]])[_0x165f[16]](function(_0xf8b2x12){if(!_0xf8b2x12){return _0xf8b2xd[_0x165f[31]](404)};if(_0xf8b2x12[_0x165f[50]]){throw  new Error(_0x165f[51])};var _0xf8b2x16=_[_0x165f[52]](_0xf8b2x12,_0xf8b2xc[_0x165f[40]]);return _0xf8b2x16[_0x165f[53]]()})[_0x165f[16]](function(_0xf8b2x12){return _0xf8b2xd[_0x165f[15]](200)[_0x165f[14]](_0xf8b2x12)})[_0x165f[13]](function(_0xf8b2xf){return handleError(_0xf8b2xd,_0xf8b2xf)})};exports[_0x165f[54]]=function(_0xf8b2xc,_0xf8b2xd,_0xf8b2xe){return MailRoom[_0x165f[32]](_0xf8b2xc[_0x165f[27]][_0x165f[22]])[_0x165f[16]](function(_0xf8b2x12){if(!_0xf8b2x12){return _0xf8b2xd[_0x165f[31]](404)};return _0xf8b2x12[_0x165f[56]](_0xf8b2xc[_0x165f[40]][_0x165f[55]],{individualHooks:true})})[_0x165f[16]](function(){return _0xf8b2xd[_0x165f[31]](200)})[_0x165f[13]](function(_0xf8b2xf){return handleError(_0xf8b2xd,_0xf8b2xf)})};exports[_0x165f[57]]=function(_0xf8b2xc,_0xf8b2xd,_0xf8b2xe){return MailRoom[_0x165f[32]](_0xf8b2xc[_0x165f[27]][_0x165f[22]])[_0x165f[16]](function(_0xf8b2x12){if(!_0xf8b2x12){return _0xf8b2xd[_0x165f[31]](404)};return _0xf8b2x12[_0x165f[57]]()})[_0x165f[16]](function(){return _0xf8b2xd[_0x165f[31]](204)})[_0x165f[13]](function(_0xf8b2xf){return handleError(_0xf8b2xd,_0xf8b2xf)})};exports[_0x165f[58]]=function(_0xf8b2xc,_0xf8b2xd){return MailRoom[_0x165f[57]]({where:{id:_0xf8b2xc[_0x165f[17]][_0x165f[22]]},individualHooks:true})[_0x165f[16]](function(){return _0xf8b2xd[_0x165f[31]](200)})[_0x165f[13]](function(_0xf8b2xf){return handleError(_0xf8b2xd,_0xf8b2xf)})};function handleError(_0xf8b2xd,_0xf8b2xf){return _0xf8b2xd[_0x165f[15]](500)[_0x165f[14]](_0xf8b2xf)}