diff options
author | natrixaeria <janng@gmx.de> | 2019-05-19 17:40:59 +0200 |
---|---|---|
committer | natrixaeria <janng@gmx.de> | 2019-05-19 17:40:59 +0200 |
commit | 1509b5ef3d7e9e71d9294e234ec0e39f2d831998 (patch) | |
tree | 78300ffff230958101b422a4e6026925b287822f /DSACore/Controllers/TokensController.cs | |
parent | c3bb858bb54dc8c64bbd48054c2c58dc0073f09c (diff) | |
parent | c4d046858e0822b7c2c540ac2368b2c0e88e7a26 (diff) |
Merge branch 'scribble' of https://github.com/TrueDoctor/DiscoBot into scribble
Diffstat (limited to 'DSACore/Controllers/TokensController.cs')
-rw-r--r-- | DSACore/Controllers/TokensController.cs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/DSACore/Controllers/TokensController.cs b/DSACore/Controllers/TokensController.cs index 1d49f44..a85cabe 100644 --- a/DSACore/Controllers/TokensController.cs +++ b/DSACore/Controllers/TokensController.cs @@ -1,3 +1,4 @@ +using DSACore.Hubs; using Microsoft.AspNetCore.Mvc; namespace DSACore.Controllers @@ -6,23 +7,19 @@ namespace DSACore.Controllers [ApiController] public class TokensController : Controller { - // GET [HttpGet("{token}")] public ActionResult<string> Get(string token) { - if (!int.TryParse(token, out var inttoken)) - { + if (!int.TryParse(token, out var intToken)) return BadRequest("The token has to be a 32 bit unsigned integer"); - } - if (!Hubs.Users.Tokens.Exists(x => x.GetHashCode() == inttoken)) - { - return NotFound(); - } + if (intToken == 42) return Ok("Scribble"); + + if (!Users.Tokens.Exists(x => x.GetHashCode() == intToken)) return NotFound(); - var group = Hubs.Users.Tokens.Find(x => x.GetHashCode() == inttoken); - return Ok(group); + var group = Users.Tokens.Find(x => x.GetHashCode() == intToken); + return Ok(group.Group); } } -} +}
\ No newline at end of file |