9af48fefc1ec5d2c18684046db4c92c9a397db19
[motion.git] / server / api / agent / agent.controller.js
1 var _0x7214=["\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"];_0x7214[0];var _=require(_0x7214[1]);var sequelize=require(_0x7214[3])[_0x7214[2]];var Util=require(_0x7214[4]);var Agent=require(_0x7214[3])[_0x7214[5]];var Team=require(_0x7214[3])[_0x7214[6]];var MailRoom=require(_0x7214[3])[_0x7214[7]];exports[_0x7214[8]]=function(_0x43f3x7,_0x43f3x8,_0x43f3x9){return Agent[_0x7214[18]](_0x7214[17])[_0x7214[16]](Util[_0x7214[15]](_0x43f3x7[_0x7214[14]]))[_0x7214[13]](function(_0x43f3xb){return _0x43f3x8[_0x7214[12]](200)[_0x7214[11]](_0x43f3xb)})[_0x7214[10]](function(_0x43f3xa){console[_0x7214[9]](_0x43f3xa);return handleError(_0x43f3x8,_0x43f3xa)})};exports[_0x7214[19]]=function(_0x43f3x7,_0x43f3x8,_0x43f3x9){return Agent[_0x7214[18]](_0x7214[17],{method:[_0x7214[20],_0x43f3x7[_0x7214[14]]]},{method:[_0x7214[21],_0x43f3x7[_0x7214[14]]]},{method:[_0x7214[22],_0x43f3x7[_0x7214[14]]]},{method:[_0x7214[23],_0x43f3x7[_0x7214[14]]]},_0x7214[24])[_0x7214[16]](Util[_0x7214[15]](_0x43f3x7[_0x7214[14]]))[_0x7214[13]](function(_0x43f3xb){return _0x43f3x8[_0x7214[12]](200)[_0x7214[11]](_0x43f3xb)})[_0x7214[10]](function(_0x43f3xa){console[_0x7214[9]](_0x43f3xa);return handleError(_0x43f3x8,_0x43f3xa)})};exports[_0x7214[25]]=function(_0x43f3x7,_0x43f3x8){return Agent[_0x7214[18]](_0x7214[17])[_0x7214[29]](_0x43f3x7[_0x7214[28]][_0x7214[27]])[_0x7214[13]](function(_0x43f3xc){if(!_0x43f3xc){return _0x43f3x8[_0x7214[26]](404)};return _0x43f3x8[_0x7214[11]](_0x43f3xc)})[_0x7214[10]](function(_0x43f3xa){return handleError(_0x43f3x8,_0x43f3xa)})};exports[_0x7214[30]]=function(_0x43f3x7,_0x43f3x8){return Agent[_0x7214[18]](_0x7214[17])[_0x7214[29]](_0x43f3x7[_0x7214[28]][_0x7214[27]])[_0x7214[13]](function(_0x43f3xc){if(!_0x43f3xc){return _0x43f3x8[_0x7214[26]](404)};return _0x43f3xc[_0x7214[33]]({attributes:[_0x7214[32]]})})[_0x7214[13]](function(_0x43f3xd){return _0x43f3x8[_0x7214[11]]({count:_0x43f3xd[_0x7214[31]],rows:_0x43f3xd})})[_0x7214[10]](function(_0x43f3xa){return handleError(_0x43f3x8,_0x43f3xa)})};exports[_0x7214[34]]=function(_0x43f3x7,_0x43f3x8){var _0x43f3xe;_0x43f3x7[_0x7214[36]][_0x7214[35]]=_0x7214[17];return sequelize[_0x7214[41]](function(_0x43f3xf){return Agent[_0x7214[18]](_0x7214[17])[_0x7214[34]](_0x43f3x7[_0x7214[36]],{transaction:_0x43f3xf})[_0x7214[13]](function(_0x43f3xc){_0x43f3xe=_0x43f3xc;return Team[_0x7214[40]]({where:{defaultEntry:true}})})[_0x7214[13]](function(_0x43f3x10){return _0x43f3x10[_0x7214[39]](_0x43f3xe[_0x7214[27]],{transaction:_0x43f3xf})})})[_0x7214[13]](function(){return _0x43f3x8[_0x7214[12]](201)[_0x7214[11]](_0x43f3xe)})[_0x7214[10]](sequelize.UniqueConstraintError,function(_0x43f3xa){console[_0x7214[9]](_0x43f3xa);return Util[_0x7214[38]][_0x7214[37]](_0x43f3x8,_0x43f3xa)})[_0x7214[10]](function(_0x43f3xa){console[_0x7214[9]](_0x43f3xa);return handleError(_0x43f3x8,_0x43f3xa)})};exports[_0x7214[42]]=function(_0x43f3x7,_0x43f3x8){var _0x43f3x11;if(_0x43f3x7[_0x7214[36]]&&_0x43f3x7[_0x7214[36]][_0x7214[31]]){_0x43f3x7[_0x7214[36]][_0x7214[43]](function(_0x43f3xc){_0x43f3xc[_0x7214[35]]=_0x7214[17]})};return sequelize[_0x7214[41]](function(_0x43f3xf){return Agent[_0x7214[42]](_0x43f3x7[_0x7214[36]],{transaction:_0x43f3xf,individualHooks:true})[_0x7214[13]](function(_0x43f3x12){_0x43f3x11=_0x43f3x12;return Team[_0x7214[40]]({where:{defaultEntry:true}})})[_0x7214[13]](function(_0x43f3x10){return _0x43f3x10[_0x7214[45]](_[_0x7214[44]](_0x43f3x11,_0x7214[27]),{transaction:_0x43f3xf})})})[_0x7214[13]](function(){return _0x43f3x8[_0x7214[26]](201)})[_0x7214[10]](sequelize.UniqueConstraintError,function(_0x43f3xa){console[_0x7214[9]](_0x43f3xa);return Util[_0x7214[38]][_0x7214[37]](_0x43f3x8,_0x43f3xa)})[_0x7214[10]](function(_0x43f3xa){console[_0x7214[9]](_0x43f3xa);return handleError(_0x43f3x8,_0x43f3xa)})};exports[_0x7214[46]]=function(_0x43f3x7,_0x43f3x8){if(_0x43f3x7[_0x7214[36]][_0x7214[27]]){delete _0x43f3x7[_0x7214[36]][_0x7214[27]];delete _0x43f3x7[_0x7214[36]][_0x7214[35]]};return sequelize[_0x7214[41]](function(_0x43f3xf){return Agent[_0x7214[29]](_0x43f3x7[_0x7214[28]][_0x7214[27]])[_0x7214[13]](function(_0x43f3xc){if(!_0x43f3xc){return _0x43f3x8[_0x7214[26]](404)};var _0x43f3x13=_[_0x7214[47]](_0x43f3xc,_0x43f3x7[_0x7214[36]]);return _0x43f3x13[_0x7214[48]]({transaction:_0x43f3xf})})[_0x7214[13]](function(_0x43f3xc){return _0x43f3x8[_0x7214[12]](200)[_0x7214[11]](_0x43f3xc)})})[_0x7214[10]](sequelize.UniqueConstraintError,function(_0x43f3xa){console[_0x7214[9]](_0x43f3xa);return Util[_0x7214[38]][_0x7214[37]](_0x43f3x8,_0x43f3xa)})[_0x7214[10]](function(_0x43f3xa){console[_0x7214[9]](_0x43f3xa);return handleError(_0x43f3x8,_0x43f3xa)})};exports[_0x7214[49]]=function(_0x43f3x7,_0x43f3x8){var _0x43f3xe;return Agent[_0x7214[29]](_0x43f3x7[_0x7214[28]][_0x7214[27]])[_0x7214[13]](function(_0x43f3xc){_0x43f3xe=_0x43f3xc;if(!_0x43f3xc){return _0x43f3x8[_0x7214[26]](404)};return _0x43f3xc[_0x7214[49]]()})[_0x7214[13]](function(){return _0x43f3x8[_0x7214[26]](204)})[_0x7214[10]](sequelize.ForeignKeyConstraintError,function(_0x43f3xa){return Util[_0x7214[38]][_0x7214[50]](_0x43f3x8,_0x7214[17],_0x43f3xe[_0x7214[32]],_0x43f3xa)})[_0x7214[10]](function(_0x43f3xa){return handleError(_0x43f3x8,_0x43f3xa)})};exports[_0x7214[51]]=function(_0x43f3x7,_0x43f3x8){return Agent[_0x7214[49]]({where:{id:_0x43f3x7[_0x7214[14]][_0x7214[52]]},individualHooks:true})[_0x7214[13]](function(){return _0x43f3x8[_0x7214[26]](204)})[_0x7214[10]](function(_0x43f3xa){return handleError(_0x43f3x8,_0x43f3xa)})};exports[_0x7214[53]]=function(_0x43f3x7,_0x43f3x8,_0x43f3x9){var _0x43f3x14=_0x43f3x7[_0x7214[54]][_0x7214[27]];var _0x43f3x15=String(_0x43f3x7[_0x7214[36]][_0x7214[55]]);var _0x43f3x16=String(_0x43f3x7[_0x7214[36]][_0x7214[56]]);return Agent[_0x7214[29]](_0x43f3x14)[_0x7214[13]](function(_0x43f3x17){if(_0x43f3x17[_0x7214[57]](_0x43f3x15)){_0x43f3x17[_0x7214[58]]=_0x43f3x16;_0x43f3x17[_0x7214[48]]()[_0x7214[13]](function(){return _0x43f3x8[_0x7214[26]](200)})[_0x7214[10]](function(_0x43f3xa){return handleError(_0x43f3x8,_0x43f3xa)})}else {return _0x43f3x8[_0x7214[26]](403)}})};exports[_0x7214[59]]=function(_0x43f3x7,_0x43f3x8,_0x43f3x9){var _0x43f3x14=_0x43f3x7[_0x7214[28]][_0x7214[27]];var _0x43f3x16=String(_0x43f3x7[_0x7214[36]][_0x7214[56]]);return Agent[_0x7214[29]](_0x43f3x14)[_0x7214[13]](function(_0x43f3x17){_0x43f3x17[_0x7214[58]]=_0x43f3x16;return _0x43f3x17[_0x7214[48]]()})[_0x7214[13]](function(){return _0x43f3x8[_0x7214[26]](200)})[_0x7214[10]](function(_0x43f3xa){return handleError(_0x43f3x8,_0x43f3xa)})};function handleError(_0x43f3x8,_0x43f3xa){return _0x43f3x8[_0x7214[12]](500)[_0x7214[11]](_0x43f3xa)}