editorconfig added,

modelbuilder fix for local connString
This commit is contained in:
Aleksandr Popov
2023-06-26 08:58:42 +02:00
parent cd2605efe3
commit 171b640230
8 changed files with 506 additions and 19 deletions
@@ -16,7 +16,7 @@ namespace TURN.Services.Chess.Controllers
{
try
{
return HttpContext.Request.Query.TryGetValue("apikey", out Microsoft.Extensions.Primitives.StringValues value)
return HttpContext.Request.Query.TryGetValue("apikey", out var value)
? value.ToString() == Environment.GetEnvironmentVariable("AUTH_API_KEY")
? new JwtSecurityTokenHandler().WriteToken(CreateToken(user))
: StatusCode(403, "Wrong api key.")
@@ -30,7 +30,7 @@ namespace TURN.Services.Chess.Controllers
private SecurityToken CreateToken(string user)
{
List<Claim> claims = new()
var claims = new List<Claim>()
{
new Claim(ClaimTypes.Name, user),
new Claim(ClaimTypes.Role, "admin")
@@ -31,7 +31,7 @@ namespace TURN.Services.Chess.Controllers
{
try
{
ChessGame game = new();
var game = new ChessGame();
return Ok(param);
}
@@ -50,7 +50,7 @@ namespace TURN.Services.Chess.Controllers
{
try
{
ChessGame game = new();
var game = new ChessGame();
Game obj = new()
{
@@ -62,7 +62,7 @@ namespace TURN.Services.Chess.Controllers
_ = _db.Add(obj);
_ = _db.SaveChanges();
string mes = $"Game {obj.GameId} started.";
var mes = $"Game {obj.GameId} started.";
_logger.Info(mes);
return Ok(mes);