Built motion from commit ff2bf01.|0.0.89
[motion.git] / server / api / agent / agent.controller.js
1 var _0x7536=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x55\x73\x65\x72","\x54\x65\x61\x6D","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x69\x6E\x64\x65\x78","\x6C\x6F\x67","\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","\x61\x67\x65\x6E\x74","\x73\x63\x6F\x70\x65","\x72\x65\x61\x6C\x74\x69\x6D\x65\x49\x6E\x64\x65\x78","\x63\x68\x65\x63\x6B\x50\x61\x75\x73\x65\x53\x74\x61\x74\x75\x73","\x63\x68\x65\x63\x6B\x51\x75\x65\x75\x65\x53\x74\x61\x74\x75\x73","\x63\x68\x65\x63\x6B\x4F\x6E\x6C\x69\x6E\x65\x53\x74\x61\x74\x75\x73","\x63\x68\x65\x63\x6B\x53\x69\x70\x53\x74\x61\x74\x75\x73","\x71\x75\x65\x75\x65\x73","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x68\x6F\x77\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65\x73","\x6C\x65\x6E\x67\x74\x68","\x6E\x61\x6D\x65","\x67\x65\x74\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65\x73","\x63\x72\x65\x61\x74\x65","\x72\x6F\x6C\x65","\x62\x6F\x64\x79","\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","\x61\x64\x64\x55\x73\x65\x72","\x66\x69\x6E\x64\x4F\x6E\x65","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x66\x6F\x72\x45\x61\x63\x68","\x6D\x61\x70","\x61\x64\x64\x55\x73\x65\x72\x73","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\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","\x63\x68\x61\x6E\x67\x65\x50\x61\x73\x73\x77\x6F\x72\x64","\x75\x73\x65\x72","\x6F\x6C\x64\x50\x61\x73\x73\x77\x6F\x72\x64","\x6E\x65\x77\x50\x61\x73\x73\x77\x6F\x72\x64","\x61\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x72\x65\x73\x65\x74\x50\x61\x73\x73\x77\x6F\x72\x64"];_0x7536[0];var _=require(_0x7536[1]);var sequelize=require(_0x7536[3])[_0x7536[2]];var Util=require(_0x7536[4]);var Agent=require(_0x7536[3])[_0x7536[5]];var Team=require(_0x7536[3])[_0x7536[6]];var MailRoom=require(_0x7536[3])[_0x7536[7]];exports[_0x7536[8]]=function(_0x1942x7,_0x1942x8,_0x1942x9){return Agent[_0x7536[18]](_0x7536[17])[_0x7536[16]](Util[_0x7536[15]](_0x1942x7[_0x7536[14]]))[_0x7536[13]](function(_0x1942xb){return _0x1942x8[_0x7536[12]](200)[_0x7536[11]](_0x1942xb)})[_0x7536[10]](function(_0x1942xa){console[_0x7536[9]](_0x1942xa);return handleError(_0x1942x8,_0x1942xa)})};exports[_0x7536[19]]=function(_0x1942x7,_0x1942x8,_0x1942x9){return Agent[_0x7536[18]](_0x7536[17],{method:[_0x7536[20],_0x1942x7[_0x7536[14]]]},{method:[_0x7536[21],_0x1942x7[_0x7536[14]]]},{method:[_0x7536[22],_0x1942x7[_0x7536[14]]]},{method:[_0x7536[23],_0x1942x7[_0x7536[14]]]},_0x7536[24])[_0x7536[16]](Util[_0x7536[15]](_0x1942x7[_0x7536[14]]))[_0x7536[13]](function(_0x1942xb){return _0x1942x8[_0x7536[12]](200)[_0x7536[11]](_0x1942xb)})[_0x7536[10]](function(_0x1942xa){console[_0x7536[9]](_0x1942xa);return handleError(_0x1942x8,_0x1942xa)})};exports[_0x7536[25]]=function(_0x1942x7,_0x1942x8){return Agent[_0x7536[18]](_0x7536[17])[_0x7536[29]](_0x1942x7[_0x7536[28]][_0x7536[27]])[_0x7536[13]](function(_0x1942xc){if(!_0x1942xc){return _0x1942x8[_0x7536[26]](404)};return _0x1942x8[_0x7536[11]](_0x1942xc)})[_0x7536[10]](function(_0x1942xa){return handleError(_0x1942x8,_0x1942xa)})};exports[_0x7536[30]]=function(_0x1942x7,_0x1942x8){return Agent[_0x7536[18]](_0x7536[17])[_0x7536[29]](_0x1942x7[_0x7536[28]][_0x7536[27]])[_0x7536[13]](function(_0x1942xc){if(!_0x1942xc){return _0x1942x8[_0x7536[26]](404)};return _0x1942xc[_0x7536[33]]({attributes:[_0x7536[32]]})})[_0x7536[13]](function(_0x1942xd){return _0x1942x8[_0x7536[11]]({count:_0x1942xd[_0x7536[31]],rows:_0x1942xd})})[_0x7536[10]](function(_0x1942xa){return handleError(_0x1942x8,_0x1942xa)})};exports[_0x7536[34]]=function(_0x1942x7,_0x1942x8){var _0x1942xe;_0x1942x7[_0x7536[36]][_0x7536[35]]=_0x7536[17];return sequelize[_0x7536[41]](function(_0x1942xf){return Agent[_0x7536[18]](_0x7536[17])[_0x7536[34]](_0x1942x7[_0x7536[36]],{transaction:_0x1942xf})[_0x7536[13]](function(_0x1942xc){_0x1942xe=_0x1942xc;return Team[_0x7536[40]]({where:{defaultEntry:true}})})[_0x7536[13]](function(_0x1942x10){return _0x1942x10[_0x7536[39]](_0x1942xe[_0x7536[27]],{transaction:_0x1942xf})})})[_0x7536[13]](function(){return _0x1942x8[_0x7536[12]](201)[_0x7536[11]](_0x1942xe)})[_0x7536[10]](sequelize.UniqueConstraintError,function(_0x1942xa){console[_0x7536[9]](_0x1942xa);return Util[_0x7536[38]][_0x7536[37]](_0x1942x8,_0x1942xa)})[_0x7536[10]](function(_0x1942xa){console[_0x7536[9]](_0x1942xa);return handleError(_0x1942x8,_0x1942xa)})};exports[_0x7536[42]]=function(_0x1942x7,_0x1942x8){var _0x1942x11;if(_0x1942x7[_0x7536[36]]&&_0x1942x7[_0x7536[36]][_0x7536[31]]){_0x1942x7[_0x7536[36]][_0x7536[43]](function(_0x1942xc){_0x1942xc[_0x7536[35]]=_0x7536[17]})};return sequelize[_0x7536[41]](function(_0x1942xf){return Agent[_0x7536[42]](_0x1942x7[_0x7536[36]],{transaction:_0x1942xf,individualHooks:true})[_0x7536[13]](function(_0x1942x12){_0x1942x11=_0x1942x12;return Team[_0x7536[40]]({where:{defaultEntry:true}})})[_0x7536[13]](function(_0x1942x10){return _0x1942x10[_0x7536[45]](_[_0x7536[44]](_0x1942x11,_0x7536[27]),{transaction:_0x1942xf})})})[_0x7536[13]](function(){return _0x1942x8[_0x7536[26]](201)})[_0x7536[10]](sequelize.UniqueConstraintError,function(_0x1942xa){console[_0x7536[9]](_0x1942xa);return Util[_0x7536[38]][_0x7536[37]](_0x1942x8,_0x1942xa)})[_0x7536[10]](function(_0x1942xa){console[_0x7536[9]](_0x1942xa);return handleError(_0x1942x8,_0x1942xa)})};exports[_0x7536[46]]=function(_0x1942x7,_0x1942x8){if(_0x1942x7[_0x7536[36]][_0x7536[27]]){delete _0x1942x7[_0x7536[36]][_0x7536[27]];delete _0x1942x7[_0x7536[36]][_0x7536[35]]};return sequelize[_0x7536[41]](function(_0x1942xf){return Agent[_0x7536[29]](_0x1942x7[_0x7536[28]][_0x7536[27]])[_0x7536[13]](function(_0x1942xc){if(!_0x1942xc){return _0x1942x8[_0x7536[26]](404)};var _0x1942x13=_[_0x7536[47]](_0x1942xc,_0x1942x7[_0x7536[36]]);return _0x1942x13[_0x7536[48]]({transaction:_0x1942xf})})[_0x7536[13]](function(_0x1942xc){return _0x1942x8[_0x7536[12]](200)[_0x7536[11]](_0x1942xc)})})[_0x7536[10]](sequelize.UniqueConstraintError,function(_0x1942xa){console[_0x7536[9]](_0x1942xa);return Util[_0x7536[38]][_0x7536[37]](_0x1942x8,_0x1942xa)})[_0x7536[10]](function(_0x1942xa){console[_0x7536[9]](_0x1942xa);return handleError(_0x1942x8,_0x1942xa)})};exports[_0x7536[49]]=function(_0x1942x7,_0x1942x8){var _0x1942xe;return Agent[_0x7536[29]](_0x1942x7[_0x7536[28]][_0x7536[27]])[_0x7536[13]](function(_0x1942xc){_0x1942xe=_0x1942xc;if(!_0x1942xc){return _0x1942x8[_0x7536[26]](404)};return _0x1942xc[_0x7536[49]]()})[_0x7536[13]](function(){return _0x1942x8[_0x7536[26]](204)})[_0x7536[10]](sequelize.ForeignKeyConstraintError,function(_0x1942xa){return Util[_0x7536[38]][_0x7536[50]](_0x1942x8,_0x7536[17],_0x1942xe[_0x7536[32]],_0x1942xa)})[_0x7536[10]](function(_0x1942xa){return handleError(_0x1942x8,_0x1942xa)})};exports[_0x7536[51]]=function(_0x1942x7,_0x1942x8){return Agent[_0x7536[49]]({where:{id:_0x1942x7[_0x7536[14]][_0x7536[52]]},individualHooks:true})[_0x7536[13]](function(){return _0x1942x8[_0x7536[26]](204)})[_0x7536[10]](function(_0x1942xa){return handleError(_0x1942x8,_0x1942xa)})};exports[_0x7536[53]]=function(_0x1942x7,_0x1942x8,_0x1942x9){var _0x1942x14=_0x1942x7[_0x7536[54]][_0x7536[27]];var _0x1942x15=String(_0x1942x7[_0x7536[36]][_0x7536[55]]);var _0x1942x16=String(_0x1942x7[_0x7536[36]][_0x7536[56]]);return Agent[_0x7536[29]](_0x1942x14)[_0x7536[13]](function(_0x1942x17){if(_0x1942x17[_0x7536[57]](_0x1942x15)){_0x1942x17[_0x7536[58]]=_0x1942x16;_0x1942x17[_0x7536[48]]()[_0x7536[13]](function(){return _0x1942x8[_0x7536[26]](200)})[_0x7536[10]](function(_0x1942xa){return handleError(_0x1942x8,_0x1942xa)})}else {return _0x1942x8[_0x7536[26]](403)}})};exports[_0x7536[59]]=function(_0x1942x7,_0x1942x8,_0x1942x9){var _0x1942x14=_0x1942x7[_0x7536[28]][_0x7536[27]];var _0x1942x16=String(_0x1942x7[_0x7536[36]][_0x7536[56]]);return Agent[_0x7536[29]](_0x1942x14)[_0x7536[13]](function(_0x1942x17){_0x1942x17[_0x7536[58]]=_0x1942x16;return _0x1942x17[_0x7536[48]]()})[_0x7536[13]](function(){return _0x1942x8[_0x7536[26]](200)})[_0x7536[10]](function(_0x1942xa){return handleError(_0x1942x8,_0x1942xa)})};function handleError(_0x1942x8,_0x1942xa){return _0x1942x8[_0x7536[12]](500)[_0x7536[11]](_0x1942xa)}