2025-05-26 01:44:26 +02:00

39 lines
1.1 KiB
C#

using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
namespace SQLiteEF;
[PrimaryKey("SteamId")]
public class Player : IUpdateable
{
public ulong SteamId { get; init; }
public string Name { get; set; }
public string ProfileUrl { get; set; }
public string AvatarUrl { get; set; }
[JsonIgnore] public ICollection<Game> Games { get; init; } = null!;
[JsonIgnore] public ICollection<TrackedTime> TrackedTimes { get; init; } = null!;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
public Player(ulong steamId, string name, string profileUrl, string avatarUrl)
{
this.SteamId = steamId;
this.Name = name;
this.ProfileUrl = profileUrl;
this.AvatarUrl = avatarUrl;
this.Games = [];
this.TrackedTimes = [];
}
/// <summary>
/// EF CORE
/// </summary>
internal Player(ulong steamId, string name, string profileUrl, string avatarUrl, DateTime updatedAt)
{
this.SteamId = steamId;
this.Name = name;
this.ProfileUrl = profileUrl;
this.AvatarUrl = avatarUrl;
this.UpdatedAt = updatedAt;
}
}