Built motion from commit 42469bf.|0.0.59
[motion.git] / server / api / mail_room / mail_room.controller.js
1 var _0x3883=["\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","\x69\x64\x73"];_0x3883[0];var _=require(_0x3883[1]);var util=require(_0x3883[2]);var Util=require(_0x3883[3]);var sequelize=require(_0x3883[5])[_0x3883[4]];var User=require(_0x3883[5])[_0x3883[6]];var Agent=require(_0x3883[5])[_0x3883[6]];var Contact=require(_0x3883[5])[_0x3883[7]];var MailRoom=require(_0x3883[5])[_0x3883[8]];var MailMessage=require(_0x3883[5])[_0x3883[9]];var MailAccount=require(_0x3883[5])[_0x3883[10]];var MailAttachment=require(_0x3883[5])[_0x3883[11]];exports[_0x3883[12]]=function(_0x3f0bxc,_0x3f0bxd,_0x3f0bxe){switch(_0x3f0bxc[_0x3883[23]][_0x3883[25]]){case _0x3883[21]:return MailRoom[_0x3883[24]](_0x3883[20],{method:[_0x3883[21],_0x3f0bxc[_0x3883[23]][_0x3883[22]]]})[_0x3883[19]](Util[_0x3883[18]](_0x3f0bxc[_0x3883[17]]))[_0x3883[16]](function(_0x3f0bx10){return _0x3f0bxd[_0x3883[15]](200)[_0x3883[14]](_0x3f0bx10)})[_0x3883[13]](function(_0x3f0bxf){return handleError(_0x3f0bxd,_0x3f0bxf)});default:return MailRoom[_0x3883[24]](_0x3883[20])[_0x3883[19]](Util[_0x3883[18]](_0x3f0bxc[_0x3883[17]]))[_0x3883[16]](function(_0x3f0bx10){return _0x3f0bxd[_0x3883[15]](200)[_0x3883[14]](_0x3f0bx10)})[_0x3883[13]](function(_0x3f0bxf){return handleError(_0x3f0bxd,_0x3f0bxf)})}};exports[_0x3883[26]]=function(_0x3f0bxc,_0x3f0bxd,_0x3f0bxe){return MailRoom[_0x3883[28]]({where:{UserId:_0x3f0bxc[_0x3883[27]][_0x3883[22]]},include:[{all:true}]})[_0x3883[16]](function(_0x3f0bx11){return _0x3f0bxd[_0x3883[15]](200)[_0x3883[14]](_0x3f0bx11)})[_0x3883[13]](function(_0x3f0bxf){return handleError(_0x3f0bxd,_0x3f0bxf)})};exports[_0x3883[29]]=function(_0x3f0bxc,_0x3f0bxd,_0x3f0bxe){return MailRoom[_0x3883[24]](_0x3883[20])[_0x3883[32]](_0x3f0bxc[_0x3883[27]][_0x3883[22]])[_0x3883[16]](function(_0x3f0bx12){if(!_0x3f0bx12){return _0x3f0bxd[_0x3883[31]](404)};return _0x3f0bxd[_0x3883[14]](_0x3f0bx12)})[_0x3883[13]](function(_0x3f0bxf){console[_0x3883[30]](_0x3f0bxf);return handleError(_0x3f0bxd,_0x3f0bxf)})};exports[_0x3883[33]]=function(_0x3f0bxc,_0x3f0bxd,_0x3f0bxe){return MailRoom[_0x3883[32]](_0x3f0bxc[_0x3883[27]][_0x3883[22]])[_0x3883[16]](function(_0x3f0bx12){if(!_0x3f0bx12){return _0x3f0bxd[_0x3883[31]](404)};return _0x3f0bx12[_0x3883[38]]({attributes:[_0x3883[22],_0x3883[34],_0x3883[35],_0x3883[36],_0x3883[25],_0x3883[37]]})})[_0x3883[16]](function(_0x3f0bx13){return _0x3f0bxd[_0x3883[14]](_0x3f0bx13)})[_0x3883[13]](function(_0x3f0bxf){return handleError(_0x3f0bxd,_0x3f0bxf)})};exports[_0x3883[39]]=function(_0x3f0bxc,_0x3f0bxd,_0x3f0bxe){return MailRoom[_0x3883[39]](_0x3f0bxc[_0x3883[40]])[_0x3883[16]](function(_0x3f0bx12){return _0x3f0bxd[_0x3883[15]](201)[_0x3883[14]](_0x3f0bx12)})[_0x3883[13]](function(_0x3f0bxf){return handleError(_0x3f0bxd,_0x3f0bxf)})};exports[_0x3883[41]]=function(_0x3f0bxc,_0x3f0bxd,_0x3f0bxe){_0x3f0bxc[_0x3883[40]][_0x3883[42]]=_0x3f0bxc[_0x3883[27]][_0x3883[22]];_0x3f0bxc[_0x3883[40]][_0x3883[43]]=(_0x3f0bxc[_0x3883[40]][_0x3883[44]]&&_0x3f0bxc[_0x3883[40]][_0x3883[44]][_0x3883[45]])?true:false;return sequelize[_0x3883[48]]()[_0x3883[16]](function(_0x3f0bx14){return MailMessage[_0x3883[39]](_0x3f0bxc[_0x3883[40]],{include:[{model:MailAttachment}],transaction:_0x3f0bx14,user:_0x3f0bxc[_0x3883[23]]})[_0x3883[16]](function(_0x3f0bx15){_0x3f0bx14[_0x3883[47]]();return _0x3f0bxd[_0x3883[15]](201)[_0x3883[14]](_0x3f0bx15)})[_0x3883[13]](function(_0x3f0bxf){console[_0x3883[30]](_0x3f0bxf);_0x3f0bx14[_0x3883[46]]();return handleError(_0x3f0bxd,_0x3f0bxf)})})};exports[_0x3883[49]]=function(_0x3f0bxc,_0x3f0bxd,_0x3f0bxe){return MailRoom[_0x3883[32]](_0x3f0bxc[_0x3883[27]][_0x3883[22]])[_0x3883[16]](function(_0x3f0bx12){if(!_0x3f0bx12){return _0x3f0bxd[_0x3883[31]](404)};if(_0x3f0bx12[_0x3883[50]]){throw  new Error(_0x3883[51])};var _0x3f0bx16=_[_0x3883[52]](_0x3f0bx12,_0x3f0bxc[_0x3883[40]]);return _0x3f0bx16[_0x3883[53]]()})[_0x3883[16]](function(_0x3f0bx12){return _0x3f0bxd[_0x3883[15]](200)[_0x3883[14]](_0x3f0bx12)})[_0x3883[13]](function(_0x3f0bxf){return handleError(_0x3f0bxd,_0x3f0bxf)})};exports[_0x3883[54]]=function(_0x3f0bxc,_0x3f0bxd,_0x3f0bxe){return MailRoom[_0x3883[32]](_0x3f0bxc[_0x3883[27]][_0x3883[22]])[_0x3883[16]](function(_0x3f0bx12){if(!_0x3f0bx12){return _0x3f0bxd[_0x3883[31]](404)};return _0x3f0bx12[_0x3883[56]](_0x3f0bxc[_0x3883[40]][_0x3883[55]],{individualHooks:true})})[_0x3883[16]](function(){return _0x3f0bxd[_0x3883[31]](200)})[_0x3883[13]](function(_0x3f0bxf){return handleError(_0x3f0bxd,_0x3f0bxf)})};exports[_0x3883[57]]=function(_0x3f0bxc,_0x3f0bxd,_0x3f0bxe){return MailRoom[_0x3883[32]](_0x3f0bxc[_0x3883[27]][_0x3883[22]])[_0x3883[16]](function(_0x3f0bx12){if(!_0x3f0bx12){return _0x3f0bxd[_0x3883[31]](404)};return _0x3f0bx12[_0x3883[57]]()})[_0x3883[16]](function(){return _0x3f0bxd[_0x3883[31]](204)})[_0x3883[13]](function(_0x3f0bxf){return handleError(_0x3f0bxd,_0x3f0bxf)})};exports[_0x3883[58]]=function(_0x3f0bxc,_0x3f0bxd){return MailRoom[_0x3883[57]]({where:{id:_0x3f0bxc[_0x3883[17]][_0x3883[59]]},individualHooks:true})[_0x3883[16]](function(){return _0x3f0bxd[_0x3883[31]](200)})[_0x3883[13]](function(_0x3f0bxf){return handleError(_0x3f0bxd,_0x3f0bxf)})};function handleError(_0x3f0bxd,_0x3f0bxf){return _0x3f0bxd[_0x3883[15]](500)[_0x3883[14]](_0x3f0bxf)}