993f3a8b7fb2aaaf77b971e5d09fe4d9ff4d2e46
[motion.git] / server / api / sms_queue / sms_queue.controller.js
1 var _0x447e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x53\x6D\x73\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x55\x73\x65\x72\x48\x61\x73\x53\x6D\x73\x51\x75\x65\x75\x65","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x53\x6D\x73\x51\x75\x65\x75\x65\x73\x49\x64\x42\x79\x55\x73\x65\x72","\x69\x64","\x75\x73\x65\x72","\x66\x69\x6E\x64\x42\x79\x49\x64","\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","\x72\x6F\x6C\x65","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x70\x61\x72\x61\x6D\x73","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x6C\x65\x6E\x67\x74\x68","\x61\x67\x65\x6E\x74","\x6E\x61\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x67\x65\x74\x55\x73\x65\x72\x73","\x63\x72\x65\x61\x74\x65","\x68\x61\x6E\x64\x6C\x65\x55\x6E\x69\x71\x75\x65\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x45\x72\x72\x6F\x72","\x65\x72\x72\x6F\x72\x4D\x61\x6E\x61\x67\x65\x72","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x61\x67\x65\x6E\x74\x73","\x70\x65\x6E\x61\x6C\x74\x79","\x6D\x61\x70","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x72\x65\x6D\x6F\x76\x65\x41\x67\x65\x6E\x74\x73","\x72\x65\x6D\x6F\x76\x65\x55\x73\x65\x72\x73","\x53\x6D\x73\x51\x75\x65\x75\x65\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x64\x65\x73\x74\x72\x6F\x79","\x65\x72\x72","\x65\x72\x72\x6F\x72","\x71\x75\x65\x75\x65","\x68\x61\x6E\x64\x6C\x65\x46\x6F\x72\x65\x69\x67\x6E\x4B\x65\x79\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x45\x72\x72\x6F\x72","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0x447e[0];var _=require(_0x447e[1]);var Util=require(_0x447e[2]);var SmsQueue=require(_0x447e[4])[_0x447e[3]];var User=require(_0x447e[4])[_0x447e[5]];var sequelize=require(_0x447e[4])[_0x447e[6]];var UserHasSmsQueue=require(_0x447e[4])[_0x447e[7]];function handleError(_0xdd7dx8,_0xdd7dx9){return _0xdd7dx8[_0x447e[9]](500)[_0x447e[8]](_0xdd7dx9)}exports[_0x447e[10]]=function(_0xdd7dxa,_0xdd7dx8){switch(_0xdd7dxa[_0x447e[16]][_0x447e[22]]){case _0x447e[16]:return User[_0x447e[17]](_0xdd7dxa[_0x447e[16]][_0x447e[15]],{attributes:[_0x447e[15]]})[_0x447e[12]](Util[_0x447e[14]](_0xdd7dxa[_0x447e[13]]))[_0x447e[12]](function(_0xdd7dxb){_0xdd7dx8[_0x447e[9]](200)[_0x447e[8]](_0xdd7dxb)})[_0x447e[11]](function(_0xdd7dx9){return handleError(_0xdd7dx8,_0xdd7dx9)});default:return SmsQueue[_0x447e[21]](_0x447e[20])[_0x447e[19]](Util[_0x447e[18]](_0xdd7dxa[_0x447e[13]]))[_0x447e[12]](function(_0xdd7dxb){_0xdd7dx8[_0x447e[9]](200)[_0x447e[8]](_0xdd7dxb)})[_0x447e[11]](function(_0xdd7dx9){return handleError(_0xdd7dx8,_0xdd7dx9)})}};exports[_0x447e[23]]=function(_0xdd7dxa,_0xdd7dx8){return SmsQueue[_0x447e[21]](_0x447e[20])[_0x447e[17]](_0xdd7dxa[_0x447e[25]][_0x447e[15]])[_0x447e[12]](function(_0xdd7dxc){if(!_0xdd7dxc){return _0xdd7dx8[_0x447e[24]](404)};return _0xdd7dx8[_0x447e[8]](_0xdd7dxc)})[_0x447e[11]](function(_0xdd7dx9){return handleError(_0xdd7dx8,_0xdd7dx9)})};exports[_0x447e[26]]=function(_0xdd7dxa,_0xdd7dx8){return SmsQueue[_0x447e[17]](_0xdd7dxa[_0x447e[25]][_0x447e[15]])[_0x447e[12]](function(_0xdd7dxe){if(!_0xdd7dxe){return _0xdd7dx8[_0x447e[24]](404)};return _0xdd7dxe[_0x447e[32]]({where:{role:_0x447e[28]},attributes:[_0x447e[15],_0x447e[29],_0x447e[30],_0x447e[31]]})})[_0x447e[12]](function(_0xdd7dxd){return _0xdd7dx8[_0x447e[9]](200)[_0x447e[8]]({rows:_0xdd7dxd,count:_0xdd7dxd[_0x447e[27]]})})[_0x447e[11]](function(_0xdd7dx9){return handleError(_0xdd7dx8,_0xdd7dx9)})};exports[_0x447e[33]]=function(_0xdd7dxa,_0xdd7dx8){return SmsQueue[_0x447e[33]](_0xdd7dxa[_0x447e[36]])[_0x447e[12]](function(_0xdd7dxc){return _0xdd7dx8[_0x447e[9]](201)[_0x447e[8]](_0xdd7dxc)})[_0x447e[11]](sequelize.UniqueConstraintError,function(_0xdd7dx9){return Util[_0x447e[35]][_0x447e[34]](_0xdd7dx8,_0xdd7dx9)})[_0x447e[11]](function(_0xdd7dx9){return handleError(_0xdd7dx8,_0xdd7dx9)})};exports[_0x447e[37]]=function(_0xdd7dxa,_0xdd7dx8){if(_0xdd7dxa[_0x447e[36]][_0x447e[15]]){delete _0xdd7dxa[_0x447e[36]][_0x447e[15]]};return SmsQueue[_0x447e[17]](_0xdd7dxa[_0x447e[25]][_0x447e[15]])[_0x447e[12]](function(_0xdd7dxc){if(!_0xdd7dxc){return _0xdd7dx8[_0x447e[24]](404)};var _0xdd7dxf=_[_0x447e[38]](_0xdd7dxc,_0xdd7dxa[_0x447e[36]]);return _0xdd7dxf[_0x447e[39]]()})[_0x447e[12]](function(_0xdd7dxc){return _0xdd7dx8[_0x447e[9]](200)[_0x447e[8]](_0xdd7dxc)})[_0x447e[11]](sequelize.UniqueConstraintError,function(_0xdd7dx9){return Util[_0x447e[35]][_0x447e[34]](_0xdd7dx8,_0xdd7dx9)})[_0x447e[11]](function(_0xdd7dx9){return handleError(_0xdd7dx8,_0xdd7dx9)})};exports[_0x447e[40]]=function(_0xdd7dxa,_0xdd7dx8,_0xdd7dx10){return SmsQueue[_0x447e[17]](_0xdd7dxa[_0x447e[25]][_0x447e[15]])[_0x447e[12]](function(_0xdd7dxc){if(!_0xdd7dxc){return _0xdd7dx8[_0x447e[24]](404)};var _0xdd7dx11=_[_0x447e[43]](_0xdd7dxa[_0x447e[36]][_0x447e[41]],function(_0xdd7dx12){return {UserId:_0xdd7dx12,penalty:_0xdd7dxa[_0x447e[36]][_0x447e[42]],SmsQueueId:_0xdd7dxc[_0x447e[15]],queue:_0xdd7dxc[_0x447e[29]]}});return UserHasSmsQueue[_0x447e[44]](_0xdd7dx11,{individualHooks:true})})[_0x447e[12]](function(){return _0xdd7dx8[_0x447e[24]](200)})[_0x447e[11]](function(_0xdd7dx9){return handleError(_0xdd7dx8,_0xdd7dx9)})};exports[_0x447e[45]]=function(_0xdd7dxa,_0xdd7dx8){return SmsQueue[_0x447e[17]](_0xdd7dxa[_0x447e[25]][_0x447e[15]])[_0x447e[12]](function(_0xdd7dxc){if(_0xdd7dxc){return _0xdd7dxc[_0x447e[46]](_0xdd7dxa[_0x447e[13]][_0x447e[41]],{individualHooks:true})}else {throw  new Error(_0x447e[47])}})[_0x447e[12]](function(){return _0xdd7dx8[_0x447e[24]](202)})[_0x447e[11]](function(_0xdd7dx9){return handleError(_0xdd7dx8,_0xdd7dx9)})};exports[_0x447e[48]]=function(_0xdd7dxa,_0xdd7dx8){var _0xdd7dx13;return SmsQueue[_0x447e[17]](_0xdd7dxa[_0x447e[25]][_0x447e[15]])[_0x447e[12]](function(_0xdd7dxc){_0xdd7dx13=_0xdd7dxc;if(!_0xdd7dxc){return _0xdd7dx8[_0x447e[24]](404)};return _0xdd7dxc[_0x447e[48]]()})[_0x447e[12]](function(){return _0xdd7dx8[_0x447e[24]](204)})[_0x447e[11]](sequelize.ForeignKeyConstraintError,function(_0xdd7dx9){return Util[_0x447e[35]][_0x447e[52]](_0xdd7dx8,_0x447e[51],_0xdd7dx13[_0x447e[29]],_0xdd7dx9)})[_0x447e[11]](function(_0xdd7dx9){console[_0x447e[50]](_0x447e[49],_0xdd7dx9);return handleError(_0xdd7dx8,_0xdd7dx9)})};exports[_0x447e[53]]=function(_0xdd7dxa,_0xdd7dx8){return SmsQueue[_0x447e[48]]({where:{id:_0xdd7dxa[_0x447e[13]][_0x447e[54]]},individualHooks:true})[_0x447e[12]](function(){return _0xdd7dx8[_0x447e[24]](204)})[_0x447e[11]](function(_0xdd7dx9){return handleError(_0xdd7dx8,_0xdd7dx9)})}