yep
This commit is contained in:
@@ -5,7 +5,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Results\" />
|
||||
<Compile Remove="Results\**" />
|
||||
<EmbeddedResource Remove="Results\**" />
|
||||
<None Remove="Results\**" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CouchDB.Selectors
|
||||
{
|
||||
public class CouchQuery
|
||||
{
|
||||
public static CouchQuery Select => new();
|
||||
|
||||
private readonly List<Equals> equals;
|
||||
protected CouchQuery()
|
||||
{
|
||||
equals = new List<Equals>();
|
||||
}
|
||||
|
||||
public CouchQuery WithEqual(string key, string value)
|
||||
{
|
||||
equals.Add(new Equals(key, value));
|
||||
return this;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
var selector = string.Join(",", equals);
|
||||
return $"{{ \"selector\": {selector}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
namespace CouchDB.Selectors
|
||||
{
|
||||
public class Equals
|
||||
{
|
||||
private readonly string key;
|
||||
private readonly string value;
|
||||
internal Equals(string key, string value)
|
||||
{
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{{ \"{key}\": {{ \"$eq\": {value}}} }}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ namespace Gameboard.ShogiUI.Sockets.Controllers
|
||||
PlayerName = user.Name,
|
||||
Move = moveModel.ToServiceModel()
|
||||
}, session.Player1, session.Player2);
|
||||
return Ok();
|
||||
return Created(string.Empty, null);
|
||||
}
|
||||
throw new InvalidOperationException("Illegal move.");
|
||||
}
|
||||
|
||||
@@ -34,11 +34,11 @@ namespace Gameboard.ShogiUI.Sockets.Managers
|
||||
while (count < MaxTries)
|
||||
{
|
||||
count++;
|
||||
var clientId = $"Guest-{Guid.NewGuid()}";
|
||||
var isCreated = await repository.CreateGuestUser(clientId, webSessionId);
|
||||
var userName = $"Guest-{Guid.NewGuid()}";
|
||||
var isCreated = await repository.CreateUser(new User(userName, webSessionId));
|
||||
if (isCreated)
|
||||
{
|
||||
return clientId;
|
||||
return userName;
|
||||
}
|
||||
}
|
||||
throw new OperationCanceledException($"Failed to create guest user after {count} tries.");
|
||||
|
||||
@@ -241,8 +241,12 @@ namespace Gameboard.ShogiUI.Sockets.Repositories
|
||||
logger.LogError(new InvalidOperationException(result.warning), result.warning);
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Models.User(result.docs.Single().Name);
|
||||
var userDocument = result.docs.SingleOrDefault();
|
||||
if (userDocument != null)
|
||||
{
|
||||
return new Models.User(userDocument.Name);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user