Built motion from commit 1d6aa77.|0.0.94
[motion.git] / server / api / sms_queue / sms_queue.controller.js
1 var _0x2bab=["\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","\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","\x61\x64\x64\x55\x73\x65\x72\x73","\x73\x6D\x73\x51\x75\x65\x75\x65\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\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"];_0x2bab[0];var _=require(_0x2bab[1]);var Util=require(_0x2bab[2]);var SmsQueue=require(_0x2bab[4])[_0x2bab[3]];var User=require(_0x2bab[4])[_0x2bab[5]];var sequelize=require(_0x2bab[4])[_0x2bab[6]];function handleError(_0xb245x7,_0xb245x8){return _0xb245x7[_0x2bab[8]](500)[_0x2bab[7]](_0xb245x8)}exports[_0x2bab[9]]=function(_0xb245x9,_0xb245x7){switch(_0xb245x9[_0x2bab[15]][_0x2bab[21]]){case _0x2bab[15]:return User[_0x2bab[16]](_0xb245x9[_0x2bab[15]][_0x2bab[14]],{attributes:[_0x2bab[14]]})[_0x2bab[11]](Util[_0x2bab[13]](_0xb245x9[_0x2bab[12]]))[_0x2bab[11]](function(_0xb245xa){_0xb245x7[_0x2bab[8]](200)[_0x2bab[7]](_0xb245xa)})[_0x2bab[10]](function(_0xb245x8){return handleError(_0xb245x7,_0xb245x8)});default:return SmsQueue[_0x2bab[20]](_0x2bab[19])[_0x2bab[18]](Util[_0x2bab[17]](_0xb245x9[_0x2bab[12]]))[_0x2bab[11]](function(_0xb245xa){_0xb245x7[_0x2bab[8]](200)[_0x2bab[7]](_0xb245xa)})[_0x2bab[10]](function(_0xb245x8){return handleError(_0xb245x7,_0xb245x8)})}};exports[_0x2bab[22]]=function(_0xb245x9,_0xb245x7){return SmsQueue[_0x2bab[20]](_0x2bab[19])[_0x2bab[16]](_0xb245x9[_0x2bab[24]][_0x2bab[14]])[_0x2bab[11]](function(_0xb245xb){if(!_0xb245xb){return _0xb245x7[_0x2bab[23]](404)};return _0xb245x7[_0x2bab[7]](_0xb245xb)})[_0x2bab[10]](function(_0xb245x8){return handleError(_0xb245x7,_0xb245x8)})};exports[_0x2bab[25]]=function(_0xb245x9,_0xb245x7){return SmsQueue[_0x2bab[16]](_0xb245x9[_0x2bab[24]][_0x2bab[14]])[_0x2bab[11]](function(_0xb245xd){if(!_0xb245xd){return _0xb245x7[_0x2bab[23]](404)};return _0xb245xd[_0x2bab[31]]({where:{role:_0x2bab[27]},attributes:[_0x2bab[14],_0x2bab[28],_0x2bab[29],_0x2bab[30]]})})[_0x2bab[11]](function(_0xb245xc){return _0xb245x7[_0x2bab[8]](200)[_0x2bab[7]]({rows:_0xb245xc,count:_0xb245xc[_0x2bab[26]]})})[_0x2bab[10]](function(_0xb245x8){return handleError(_0xb245x7,_0xb245x8)})};exports[_0x2bab[32]]=function(_0xb245x9,_0xb245x7){return SmsQueue[_0x2bab[32]](_0xb245x9[_0x2bab[35]])[_0x2bab[11]](function(_0xb245xb){return _0xb245x7[_0x2bab[8]](201)[_0x2bab[7]](_0xb245xb)})[_0x2bab[10]](sequelize.UniqueConstraintError,function(_0xb245x8){return Util[_0x2bab[34]][_0x2bab[33]](_0xb245x7,_0xb245x8)})[_0x2bab[10]](function(_0xb245x8){return handleError(_0xb245x7,_0xb245x8)})};exports[_0x2bab[36]]=function(_0xb245x9,_0xb245x7){if(_0xb245x9[_0x2bab[35]][_0x2bab[14]]){delete _0xb245x9[_0x2bab[35]][_0x2bab[14]]};return SmsQueue[_0x2bab[16]](_0xb245x9[_0x2bab[24]][_0x2bab[14]])[_0x2bab[11]](function(_0xb245xb){if(!_0xb245xb){return _0xb245x7[_0x2bab[23]](404)};var _0xb245xe=_[_0x2bab[37]](_0xb245xb,_0xb245x9[_0x2bab[35]]);return _0xb245xe[_0x2bab[38]]()})[_0x2bab[11]](function(_0xb245xb){return _0xb245x7[_0x2bab[8]](200)[_0x2bab[7]](_0xb245xb)})[_0x2bab[10]](sequelize.UniqueConstraintError,function(_0xb245x8){return Util[_0x2bab[34]][_0x2bab[33]](_0xb245x7,_0xb245x8)})[_0x2bab[10]](function(_0xb245x8){return handleError(_0xb245x7,_0xb245x8)})};exports[_0x2bab[39]]=function(_0xb245x9,_0xb245x7,_0xb245xf){return SmsQueue[_0x2bab[16]](_0xb245x9[_0x2bab[24]][_0x2bab[14]])[_0x2bab[11]](function(_0xb245xb){if(_0xb245xb){return _0xb245xb[_0x2bab[42]](_0xb245x9[_0x2bab[35]][_0x2bab[40]],{penalty:_0xb245x9[_0x2bab[35]][_0x2bab[41]],queue:_0xb245xb[_0x2bab[28]]},{individualHooks:true})}else {throw  new Error(_0x2bab[43])}})[_0x2bab[11]](function(){return _0xb245x7[_0x2bab[23]](200)})[_0x2bab[10]](function(_0xb245x8){return handleError(_0xb245x7,_0xb245x8)})};exports[_0x2bab[44]]=function(_0xb245x9,_0xb245x7){return SmsQueue[_0x2bab[16]](_0xb245x9[_0x2bab[24]][_0x2bab[14]])[_0x2bab[11]](function(_0xb245xb){if(_0xb245xb){return _0xb245xb[_0x2bab[45]](_0xb245x9[_0x2bab[12]][_0x2bab[40]],{individualHooks:true})}else {throw  new Error(_0x2bab[46])}})[_0x2bab[11]](function(){return _0xb245x7[_0x2bab[23]](202)})[_0x2bab[10]](function(_0xb245x8){return handleError(_0xb245x7,_0xb245x8)})};exports[_0x2bab[47]]=function(_0xb245x9,_0xb245x7){var _0xb245x10;return SmsQueue[_0x2bab[16]](_0xb245x9[_0x2bab[24]][_0x2bab[14]])[_0x2bab[11]](function(_0xb245xb){_0xb245x10=_0xb245xb;if(!_0xb245xb){return _0xb245x7[_0x2bab[23]](404)};return _0xb245xb[_0x2bab[47]]()})[_0x2bab[11]](function(){return _0xb245x7[_0x2bab[23]](204)})[_0x2bab[10]](sequelize.ForeignKeyConstraintError,function(_0xb245x8){return Util[_0x2bab[34]][_0x2bab[51]](_0xb245x7,_0x2bab[50],_0xb245x10[_0x2bab[28]],_0xb245x8)})[_0x2bab[10]](function(_0xb245x8){console[_0x2bab[49]](_0x2bab[48],_0xb245x8);return handleError(_0xb245x7,_0xb245x8)})};exports[_0x2bab[52]]=function(_0xb245x9,_0xb245x7){return SmsQueue[_0x2bab[47]]({where:{id:_0xb245x9[_0x2bab[12]][_0x2bab[53]]},individualHooks:true})[_0x2bab[11]](function(){return _0xb245x7[_0x2bab[23]](204)})[_0x2bab[10]](function(_0xb245x8){return handleError(_0xb245x7,_0xb245x8)})}