5d348219983c8f719f7469ba0f3bc7540b2469f9
[motion.git] / server / api / fax_room / fax_room.controller.js
1 var _0x97e7=["\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","\x46\x61\x78\x52\x6F\x6F\x6D","\x46\x61\x78\x4D\x65\x73\x73\x61\x67\x65","\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74","\x46\x61\x78\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","\x73\x63\x6F\x70\x65","\x69\x6E\x62\x6F\x78","\x65\x72\x72\x6F\x72","\x53\x45\x4C\x45\x43\x54\x20\x60\x46\x61\x78\x52\x6F\x6F\x6D\x60\x2E\x60\x69\x64\x60\x2C\x20\x60\x46\x61\x78\x52\x6F\x6F\x6D\x60\x2E\x60\x66\x72\x6F\x6D\x60\x2C\x20\x60\x46\x61\x78\x52\x6F\x6F\x6D\x60\x2E\x60\x61\x63\x63\x6F\x75\x6E\x74\x60\x2C\x20\x60\x46\x61\x78\x52\x6F\x6F\x6D\x60\x2E\x60\x73\x74\x61\x74\x75\x73\x60\x2C\x20\x60\x46\x61\x78\x52\x6F\x6F\x6D\x60\x2E\x60\x6C\x61\x73\x74\x45\x76\x65\x6E\x74\x60\x2C\x20\x60\x46\x61\x78\x52\x6F\x6F\x6D\x60\x2E\x60\x75\x70\x64\x61\x74\x65\x64\x41\x74\x60\x20\x46\x52\x4F\x4D\x20\x60\x66\x61\x78\x5F\x72\x6F\x6F\x6D\x73\x60\x20\x41\x53\x20\x60\x46\x61\x78\x52\x6F\x6F\x6D\x60\x20\x4C\x45\x46\x54\x20\x4F\x55\x54\x45\x52\x20\x4A\x4F\x49\x4E\x20\x28\x60\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x66\x61\x78\x5F\x72\x6F\x6F\x6D\x73\x60\x20\x41\x53\x20\x60\x55\x73\x65\x72\x73\x2E\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x66\x61\x78\x5F\x72\x6F\x6F\x6D\x73\x60\x20\x49\x4E\x4E\x45\x52\x20\x4A\x4F\x49\x4E\x20\x60\x75\x73\x65\x72\x73\x60\x20\x41\x53\x20\x60\x55\x73\x65\x72\x73\x60\x20\x4F\x4E\x20\x60\x55\x73\x65\x72\x73\x60\x2E\x60\x69\x64\x60\x20\x3D\x20\x60\x55\x73\x65\x72\x73\x2E\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x66\x61\x78\x5F\x72\x6F\x6F\x6D\x73\x60\x2E\x60\x55\x73\x65\x72\x49\x64\x60\x29\x20\x4F\x4E\x20\x60\x46\x61\x78\x52\x6F\x6F\x6D\x60\x2E\x60\x69\x64\x60\x20\x3D\x20\x60\x55\x73\x65\x72\x73\x2E\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x66\x61\x78\x5F\x72\x6F\x6F\x6D\x73\x60\x2E\x60\x46\x61\x78\x52\x6F\x6F\x6D\x49\x64\x60\x20\x57\x48\x45\x52\x45\x20\x28\x60\x46\x61\x78\x52\x6F\x6F\x6D\x60\x2E\x60\x64\x65\x6C\x65\x74\x65\x64\x41\x74\x60\x20\x49\x53\x20\x4E\x55\x4C\x4C\x20\x41\x4E\x44\x20\x28\x60\x46\x61\x78\x52\x6F\x6F\x6D\x60\x2E\x60\x73\x74\x61\x74\x75\x73\x60\x20\x3D\x20\x3A\x73\x74\x61\x74\x75\x73\x20\x4F\x52\x20\x60\x55\x73\x65\x72\x73\x60\x2E\x60\x69\x64\x60\x20\x3D\x20\x3A\x69\x64\x29\x29","\x55\x4E\x4D\x41\x4E\x41\x47\x45\x44","\x69\x64","\x75\x73\x65\x72","\x53\x45\x4C\x45\x43\x54","\x51\x75\x65\x72\x79\x54\x79\x70\x65\x73","\x61\x67\x65\x6E\x74","\x53\x45\x4C\x45\x43\x54\x20\x60\x69\x64\x60\x2C\x20\x60\x66\x72\x6F\x6D\x60\x2C\x20\x60\x61\x63\x63\x6F\x75\x6E\x74\x60\x2C\x20\x60\x73\x74\x61\x74\x75\x73\x60\x2C\x20\x60\x6C\x61\x73\x74\x45\x76\x65\x6E\x74\x60\x20\x2C\x60\x75\x70\x64\x61\x74\x65\x64\x41\x74\x60\x20\x46\x52\x4F\x4D\x20\x60\x66\x61\x78\x5F\x72\x6F\x6F\x6D\x73\x60\x20\x57\x48\x45\x52\x45\x20\x60\x66\x61\x78\x5F\x72\x6F\x6F\x6D\x73\x60\x2E\x60\x64\x65\x6C\x65\x74\x65\x64\x41\x74\x60\x20\x49\x53\x20\x4E\x55\x4C\x4C","\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","\x6F\x70\x65\x6E","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x61\x64\x64\x55\x73\x65\x72","\x4F\x50\x45\x4E","\x75\x70\x64\x61\x74\x65","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x68\x6F\x77","\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","\x55\x73\x65\x72\x49\x64","\x46\x61\x78\x52\x6F\x6F\x6D\x49\x64","\x74\x65\x78\x74","\x6A\x6F\x62\x49\x64","\x46\x61\x78\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","\x75\x70\x64\x61\x74\x65\x50\x61\x74\x63\x68","\x74\x61\x67\x73","\x2C","\x73\x70\x6C\x69\x74"];_0x97e7[0];var _=require(_0x97e7[1]);var util=require(_0x97e7[2]);var Util=require(_0x97e7[3]);var sequelize=require(_0x97e7[5])[_0x97e7[4]];var User=require(_0x97e7[5])[_0x97e7[6]];var Agent=require(_0x97e7[5])[_0x97e7[6]];var Contact=require(_0x97e7[5])[_0x97e7[7]];var FaxRoom=require(_0x97e7[5])[_0x97e7[8]];var FaxMessage=require(_0x97e7[5])[_0x97e7[9]];var FaxAccount=require(_0x97e7[5])[_0x97e7[10]];var FaxAttachment=require(_0x97e7[5])[_0x97e7[11]];exports[_0x97e7[12]]=function(_0x60d8xc,_0x60d8xd,_0x60d8xe){return FaxRoom[_0x97e7[21]](_0x97e7[20])[_0x97e7[19]](Util[_0x97e7[18]](_0x60d8xc[_0x97e7[17]]))[_0x97e7[16]](function(_0x60d8x10){return _0x60d8xd[_0x97e7[15]](200)[_0x97e7[14]](_0x60d8x10)})[_0x97e7[13]](function(_0x60d8xf){return handleError(_0x60d8xd,_0x60d8xf)})};exports[_0x97e7[22]]=function(_0x60d8xc,_0x60d8xd,_0x60d8xe){switch(_0x60d8xc[_0x97e7[27]][_0x97e7[32]]){case _0x97e7[30]:return sequelize[_0x97e7[17]](_0x97e7[24],{replacements:{status:_0x97e7[25],id:_0x60d8xc[_0x97e7[27]][_0x97e7[26]]},type:sequelize[_0x97e7[29]][_0x97e7[28]]})[_0x97e7[16]](function(_0x60d8x10){return _0x60d8xd[_0x97e7[15]](200)[_0x97e7[14]](_0x60d8x10)})[_0x97e7[13]](function(_0x60d8xf){console[_0x97e7[23]](_0x60d8xf);return handleError(_0x60d8xd,_0x60d8xf)});default:return sequelize[_0x97e7[17]](_0x97e7[31],{replacements:{status:_0x97e7[25],id:_0x60d8xc[_0x97e7[27]][_0x97e7[26]]},type:sequelize[_0x97e7[29]][_0x97e7[28]]})[_0x97e7[16]](function(_0x60d8x10){return _0x60d8xd[_0x97e7[15]](200)[_0x97e7[14]](_0x60d8x10)})[_0x97e7[13]](function(_0x60d8xf){return handleError(_0x60d8xd,_0x60d8xf)})}};exports[_0x97e7[33]]=function(_0x60d8xc,_0x60d8xd,_0x60d8xe){return FaxRoom[_0x97e7[35]]({where:{UserId:_0x60d8xc[_0x97e7[34]][_0x97e7[26]]},include:[{all:true}]})[_0x97e7[16]](function(_0x60d8x11){return _0x60d8xd[_0x97e7[15]](200)[_0x97e7[14]](_0x60d8x11)})[_0x97e7[13]](function(_0x60d8xf){return handleError(_0x60d8xd,_0x60d8xf)})};exports[_0x97e7[36]]=function(_0x60d8xc,_0x60d8xd,_0x60d8xe){var _0x60d8x12;if(_0x60d8xc[_0x97e7[27]][_0x97e7[32]]===_0x97e7[30]){return FaxRoom[_0x97e7[41]](_0x60d8xc[_0x97e7[34]][_0x97e7[26]])[_0x97e7[16]](function(_0x60d8x13){_0x60d8x12=_0x60d8x13;if(!_0x60d8x12){return _0x60d8xd[_0x97e7[37]](404)};return _0x60d8x12[_0x97e7[40]]({status:_0x97e7[39]},{userId:_0x60d8xc[_0x97e7[27]][_0x97e7[26]]})})[_0x97e7[16]](function(){return _0x60d8x12[_0x97e7[38]](_0x60d8xc[_0x97e7[27]][_0x97e7[26]])})[_0x97e7[16]](function(){return _0x60d8xd[_0x97e7[37]](200)})[_0x97e7[13]](function(_0x60d8xf){return handleError(_0x60d8xd,_0x60d8xf)})}};exports[_0x97e7[42]]=function(_0x60d8xc,_0x60d8xd,_0x60d8xe){return FaxRoom[_0x97e7[21]](_0x97e7[20])[_0x97e7[41]](_0x60d8xc[_0x97e7[34]][_0x97e7[26]])[_0x97e7[16]](function(_0x60d8x13){if(!_0x60d8x13){return _0x60d8xd[_0x97e7[37]](404)};return _0x60d8xd[_0x97e7[14]](_0x60d8x13)})[_0x97e7[13]](function(_0x60d8xf){console[_0x97e7[23]](_0x60d8xf);return handleError(_0x60d8xd,_0x60d8xf)})};exports[_0x97e7[43]]=function(_0x60d8xc,_0x60d8xd,_0x60d8xe){return FaxRoom[_0x97e7[41]](_0x60d8xc[_0x97e7[34]][_0x97e7[26]])[_0x97e7[16]](function(_0x60d8x13){if(!_0x60d8x13){return _0x60d8xd[_0x97e7[37]](404)};return _0x60d8x13[_0x97e7[48]]({attributes:[_0x97e7[26],_0x97e7[44],_0x97e7[45],_0x97e7[46],_0x97e7[32],_0x97e7[47]]})})[_0x97e7[16]](function(_0x60d8x14){return _0x60d8xd[_0x97e7[14]](_0x60d8x14)})[_0x97e7[13]](function(_0x60d8xf){return handleError(_0x60d8xd,_0x60d8xf)})};exports[_0x97e7[49]]=function(_0x60d8xc,_0x60d8xd,_0x60d8xe){return FaxRoom[_0x97e7[49]](_0x60d8xc[_0x97e7[50]])[_0x97e7[16]](function(_0x60d8x13){return _0x60d8xd[_0x97e7[15]](201)[_0x97e7[14]](_0x60d8x13)})[_0x97e7[13]](function(_0x60d8xf){return handleError(_0x60d8xd,_0x60d8xf)})};exports[_0x97e7[51]]=function(_0x60d8xc,_0x60d8xd,_0x60d8xe){_0x60d8xc[_0x97e7[50]][_0x97e7[52]]=_0x60d8xc[_0x97e7[27]][_0x97e7[26]];_0x60d8xc[_0x97e7[50]][_0x97e7[53]]=_0x60d8xc[_0x97e7[34]][_0x97e7[26]];_0x60d8xc[_0x97e7[50]][_0x97e7[54]]=_0x60d8xc[_0x97e7[50]][_0x97e7[54]];return FaxMessage[_0x97e7[49]](_0x60d8xc[_0x97e7[50]],{include:[{model:FaxAttachment}],user:_0x60d8xc[_0x97e7[27]]})[_0x97e7[16]](function(_0x60d8x15){return _0x60d8xd[_0x97e7[15]](201)[_0x97e7[14]](_0x60d8x15)})[_0x97e7[13]](function(_0x60d8xf){return handleError(_0x60d8xd,_0x60d8xf)})};exports[_0x97e7[40]]=function(_0x60d8xc,_0x60d8xd,_0x60d8xe){return FaxRoom[_0x97e7[41]](_0x60d8xc[_0x97e7[34]][_0x97e7[26]])[_0x97e7[16]](function(_0x60d8x13){if(!_0x60d8x13){return _0x60d8xd[_0x97e7[37]](404)};if(_0x60d8x13[_0x97e7[55]]){throw  new Error(_0x97e7[56])};var _0x60d8x16=_[_0x97e7[57]](_0x60d8x13,_0x60d8xc[_0x97e7[50]]);return _0x60d8x16[_0x97e7[58]]()})[_0x97e7[16]](function(_0x60d8x13){return _0x60d8xd[_0x97e7[15]](200)[_0x97e7[14]](_0x60d8x13)})[_0x97e7[13]](function(_0x60d8xf){return handleError(_0x60d8xd,_0x60d8xf)})};exports[_0x97e7[59]]=function(_0x60d8xc,_0x60d8xd,_0x60d8xe){return FaxRoom[_0x97e7[41]](_0x60d8xc[_0x97e7[34]][_0x97e7[26]])[_0x97e7[16]](function(_0x60d8x13){if(!_0x60d8x13){return _0x60d8xd[_0x97e7[37]](404)};return _0x60d8x13[_0x97e7[61]](_0x60d8xc[_0x97e7[50]][_0x97e7[60]],{individualHooks:true})})[_0x97e7[16]](function(){return _0x60d8xd[_0x97e7[37]](200)})[_0x97e7[13]](function(_0x60d8xf){return handleError(_0x60d8xd,_0x60d8xf)})};exports[_0x97e7[62]]=function(_0x60d8xc,_0x60d8xd,_0x60d8xe){return FaxRoom[_0x97e7[41]](_0x60d8xc[_0x97e7[34]][_0x97e7[26]])[_0x97e7[16]](function(_0x60d8x13){if(!_0x60d8x13){return _0x60d8xd[_0x97e7[37]](404)};return _0x60d8x13[_0x97e7[62]]()})[_0x97e7[16]](function(){return _0x60d8xd[_0x97e7[37]](204)})[_0x97e7[13]](function(_0x60d8xf){return handleError(_0x60d8xd,_0x60d8xf)})};exports[_0x97e7[63]]=function(_0x60d8xc,_0x60d8xd){return FaxRoom[_0x97e7[62]]({where:{id:_0x60d8xc[_0x97e7[17]][_0x97e7[64]]},individualHooks:true})[_0x97e7[16]](function(){return _0x60d8xd[_0x97e7[37]](200)})[_0x97e7[13]](function(_0x60d8xf){return handleError(_0x60d8xd,_0x60d8xf)})};function handleError(_0x60d8xd,_0x60d8xf){return _0x60d8xd[_0x97e7[15]](500)[_0x97e7[14]](_0x60d8xf)}exports[_0x97e7[65]]=function(_0x60d8xc,_0x60d8xd,_0x60d8xe){var _0x60d8x18={tags:_0x60d8xc[_0x97e7[50]][_0x97e7[66]]};var _0x60d8x19={where:{id:_0x60d8xc[_0x97e7[34]][_0x97e7[26]][_0x97e7[68]](_0x97e7[67])}};return FaxRoom[_0x97e7[40]](_0x60d8x18,_0x60d8x19)[_0x97e7[16]](function(_0x60d8x11){if(!_0x60d8x11){return _0x60d8xd[_0x97e7[37]](404)};return _0x60d8x11})[_0x97e7[16]](function(_0x60d8x11){return _0x60d8xd[_0x97e7[37]](200)})[_0x97e7[13]](function(_0x60d8xf){return handleError(_0x60d8xd,_0x60d8xf)})}