Replace custom socket implementation with SignalR.
Replace MSAL and custom cookie auth with Microsoft.Identity.EntityFramework Also some UI redesign to accommodate different login experience.
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Shogi.Contracts.Api;
|
||||
|
||||
public class CreateGuestTokenResponse
|
||||
{
|
||||
public string UserId { get; }
|
||||
public string DisplayName { get; }
|
||||
public Guid OneTimeToken { get; }
|
||||
|
||||
public CreateGuestTokenResponse(string userId, string displayName, Guid oneTimeToken)
|
||||
{
|
||||
UserId = userId;
|
||||
DisplayName = displayName;
|
||||
OneTimeToken = oneTimeToken;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Shogi.Contracts.Api;
|
||||
|
||||
public class CreateSessionCommand
|
||||
{
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Shogi.Contracts.Api;
|
||||
|
||||
public class CreateTokenResponse
|
||||
{
|
||||
public string UserId { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public Guid OneTimeToken { get; set; }
|
||||
}
|
||||
@@ -12,7 +12,7 @@ public class MovePieceCommand : IValidatableObject
|
||||
/// </summary>
|
||||
public MovePieceCommand()
|
||||
{
|
||||
To = string.Empty;
|
||||
this.To = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -20,9 +20,9 @@ public class MovePieceCommand : IValidatableObject
|
||||
/// </summary>
|
||||
public MovePieceCommand(string from, string to, bool isPromotion)
|
||||
{
|
||||
From = from;
|
||||
To = to;
|
||||
IsPromotion = isPromotion;
|
||||
this.From = from;
|
||||
this.To = to;
|
||||
this.IsPromotion = isPromotion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -30,8 +30,8 @@ public class MovePieceCommand : IValidatableObject
|
||||
/// </summary>
|
||||
public MovePieceCommand(WhichPiece pieceFromHand, string to)
|
||||
{
|
||||
PieceFromHand = pieceFromHand;
|
||||
To = to;
|
||||
this.PieceFromHand = pieceFromHand;
|
||||
this.To = to;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -57,21 +57,21 @@ public class MovePieceCommand : IValidatableObject
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if (PieceFromHand.HasValue && !string.IsNullOrWhiteSpace(From))
|
||||
if (this.PieceFromHand.HasValue && !string.IsNullOrWhiteSpace(this.From))
|
||||
{
|
||||
yield return new ValidationResult($"{nameof(PieceFromHand)} and {nameof(From)} are mutually exclusive properties.");
|
||||
yield return new ValidationResult($"{nameof(this.PieceFromHand)} and {nameof(this.From)} are mutually exclusive properties.");
|
||||
}
|
||||
if (PieceFromHand.HasValue && IsPromotion.HasValue)
|
||||
if (this.PieceFromHand.HasValue && this.IsPromotion.HasValue)
|
||||
{
|
||||
yield return new ValidationResult($"{nameof(PieceFromHand)} and {nameof(IsPromotion)} are mutually exclusive properties.");
|
||||
yield return new ValidationResult($"{nameof(this.PieceFromHand)} and {nameof(this.IsPromotion)} are mutually exclusive properties.");
|
||||
}
|
||||
if (!Regex.IsMatch(To, "[A-I][1-9]"))
|
||||
if (!Regex.IsMatch(this.To, "[A-I][1-9]"))
|
||||
{
|
||||
yield return new ValidationResult($"{nameof(To)} must be a valid board position, between A1 and I9");
|
||||
yield return new ValidationResult($"{nameof(this.To)} must be a valid board position, between A1 and I9");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(From) && !Regex.IsMatch(From, "[A-I][1-9]"))
|
||||
if (!string.IsNullOrEmpty(this.From) && !Regex.IsMatch(this.From, "[A-I][1-9]"))
|
||||
{
|
||||
yield return new ValidationResult($"{nameof(From)} must be a valid board position, between A1 and I9");
|
||||
yield return new ValidationResult($"{nameof(this.From)} must be a valid board position, between A1 and I9");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user