Before changing Piece[,] to Dictionary<string,Piece>
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Gameboard.ShogiUI.Sockets.Repositories.CouchModels
|
||||
{
|
||||
public class SessionDocument : CouchDocument
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Player1 { get; set; }
|
||||
public string? Player2 { get; set; }
|
||||
public bool IsPrivate { get; set; }
|
||||
public IList<BoardStateDocument> History { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor and setters are for deserialization.
|
||||
/// </summary>
|
||||
public SessionDocument() : base(WhichDocumentType.Session)
|
||||
{
|
||||
Name = string.Empty;
|
||||
Player1 = string.Empty;
|
||||
Player2 = string.Empty;
|
||||
History = new List<BoardStateDocument>(0);
|
||||
}
|
||||
|
||||
public SessionDocument(Models.Session session)
|
||||
: base(session.Name, WhichDocumentType.Session)
|
||||
{
|
||||
Name = session.Name;
|
||||
Player1 = session.Player1;
|
||||
Player2 = session.Player2;
|
||||
IsPrivate = session.IsPrivate;
|
||||
History = new List<BoardStateDocument>(0);
|
||||
}
|
||||
|
||||
public SessionDocument(Models.SessionMetadata sessionMetaData)
|
||||
: base(sessionMetaData.Name, WhichDocumentType.Session)
|
||||
{
|
||||
Name = sessionMetaData.Name;
|
||||
Player1 = sessionMetaData.Player1;
|
||||
Player2 = sessionMetaData.Player2;
|
||||
IsPrivate = sessionMetaData.IsPrivate;
|
||||
History = new List<BoardStateDocument>(0);
|
||||
}
|
||||
|
||||
public Models.Session ToDomainModel(Models.Shogi shogi) => new(Name, IsPrivate, shogi, Player1, Player2);
|
||||
|
||||
public Models.SessionMetadata ToDomainModel() => new(Name, IsPrivate, Player1, Player2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user