init efcore

This commit is contained in:
bob
2026-05-29 12:21:42 -05:00
commit 3d3a5c2a5e
28 changed files with 2071 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
namespace BlueLaminate.EFCore.Entities;
public class InventoryItem
{
public int Id { get; set; }
public int UserId { get; set; }
public SteamUser User { get; set; } = null!;
public int SkinInstanceId { get; set; }
public SkinInstance SkinInstance { get; set; } = null!;
// Steam asset ID — changes on trade, not a stable identifier.
public string AssetId { get; set; } = null!;
public DateTimeOffset AcquiredAt { get; set; }
public ICollection<TradeItem> TradeItems { get; set; } = new List<TradeItem>();
}

View File

@@ -0,0 +1,15 @@
namespace BlueLaminate.EFCore.Entities;
public class PriceHistory
{
public int Id { get; set; }
public int SkinId { get; set; }
public Skin Skin { get; set; } = null!;
public int ConditionId { get; set; }
public SkinCondition Condition { get; set; } = null!;
public decimal Price { get; set; }
public string Currency { get; set; } = null!;
public DateTimeOffset RecordedAt { get; set; }
public string Source { get; set; } = null!;
}

View File

@@ -0,0 +1,24 @@
namespace BlueLaminate.EFCore.Entities;
public class Skin
{
public int Id { get; set; }
public int WeaponId { get; set; }
public Weapon Weapon { get; set; } = null!;
public string Name { get; set; } = null!;
public string Rarity { get; set; } = null!;
public string? Description { get; set; }
public string? ImageUrl { get; set; }
public decimal FloatMin { get; set; }
public decimal FloatMax { get; set; }
// Computed in the database: float_min = 0.0 AND float_max = 1.0.
// A skin with a capped float range behaves differently in tradeup calculations.
public bool TrueFloat { get; private set; }
public ICollection<SkinCondition> Conditions { get; set; } = new List<SkinCondition>();
public ICollection<SkinInstance> Instances { get; set; } = new List<SkinInstance>();
public ICollection<PriceHistory> PriceHistories { get; set; } = new List<PriceHistory>();
}

View File

@@ -0,0 +1,15 @@
namespace BlueLaminate.EFCore.Entities;
public class SkinCondition
{
public int Id { get; set; }
public int SkinId { get; set; }
public Skin Skin { get; set; } = null!;
public string Condition { get; set; } = null!;
public decimal MinFloat { get; set; }
public decimal MaxFloat { get; set; }
public ICollection<SkinInstance> Instances { get; set; } = new List<SkinInstance>();
public ICollection<PriceHistory> PriceHistories { get; set; } = new List<PriceHistory>();
}

View File

@@ -0,0 +1,20 @@
namespace BlueLaminate.EFCore.Entities;
public class SkinInstance
{
public int Id { get; set; }
public int SkinId { get; set; }
public Skin Skin { get; set; } = null!;
public int ConditionId { get; set; }
public SkinCondition Condition { get; set; } = null!;
// FloatValue + PaintSeed form a stable fingerprint across trades; the Steam
// asset_id changes on every trade but these do not.
public decimal FloatValue { get; set; }
public string PaintSeed { get; set; } = null!;
public bool StatTrak { get; set; }
public bool Souvenir { get; set; }
public DateTimeOffset FirstSeenAt { get; set; }
public ICollection<InventoryItem> InventoryItems { get; set; } = new List<InventoryItem>();
}

View File

@@ -0,0 +1,13 @@
namespace BlueLaminate.EFCore.Entities;
public class SteamUser
{
public int Id { get; set; }
public string SteamId { get; set; } = null!;
public string? DisplayName { get; set; }
public DateTimeOffset LastSyncedAt { get; set; }
public ICollection<InventoryItem> InventoryItems { get; set; } = new List<InventoryItem>();
public ICollection<Trade> TradesSent { get; set; } = new List<Trade>();
public ICollection<Trade> TradesReceived { get; set; } = new List<Trade>();
}

View File

@@ -0,0 +1,15 @@
namespace BlueLaminate.EFCore.Entities;
public class Trade
{
public int Id { get; set; }
public int FromUserId { get; set; }
public SteamUser FromUser { get; set; } = null!;
public int ToUserId { get; set; }
public SteamUser ToUser { get; set; } = null!;
public DateTimeOffset TradedAt { get; set; }
public string? SteamTradeId { get; set; }
public ICollection<TradeItem> TradeItems { get; set; } = new List<TradeItem>();
}

View File

@@ -0,0 +1,10 @@
namespace BlueLaminate.EFCore.Entities;
public class TradeItem
{
public int Id { get; set; }
public int TradeId { get; set; }
public Trade Trade { get; set; } = null!;
public int InventoryItemId { get; set; }
public InventoryItem InventoryItem { get; set; } = null!;
}

View File

@@ -0,0 +1,11 @@
namespace BlueLaminate.EFCore.Entities;
public class Weapon
{
public int Id { get; set; }
public string Name { get; set; } = null!;
public string Type { get; set; } = null!;
public string Team { get; set; } = null!;
public ICollection<Skin> Skins { get; set; } = new List<Skin>();
}