39 lines
945 B
C#
39 lines
945 B
C#
using System;
|
|
|
|
namespace Gameboard.ShogiUI.Sockets.Repositories.CouchModels
|
|
{
|
|
public class UserDocument : CouchDocument
|
|
{
|
|
public enum LoginPlatform
|
|
{
|
|
Microsoft,
|
|
Guest
|
|
}
|
|
|
|
public string Name { get; set; }
|
|
public LoginPlatform Platform { get; set; }
|
|
/// <summary>
|
|
/// The browser session ID saved via Set-Cookie headers.
|
|
/// Only used with guest accounts.
|
|
/// </summary>
|
|
public Guid? WebSessionId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Constructor for JSON deserializing.
|
|
/// </summary>
|
|
public UserDocument() : base(WhichDocumentType.User)
|
|
{
|
|
Name = string.Empty;
|
|
}
|
|
|
|
public UserDocument(string name, Guid? webSessionId = null) : base($"org.couchdb.user:{name}", WhichDocumentType.User)
|
|
{
|
|
Name = name;
|
|
WebSessionId = webSessionId;
|
|
Platform = WebSessionId.HasValue
|
|
? LoginPlatform.Guest
|
|
: LoginPlatform.Microsoft;
|
|
}
|
|
}
|
|
}
|