refactor: Replace SupplierStock with StockItem/SupplierOffering model

- Remove SupplierStock entity
- Update Material navigation from SupplierStocks to StockItems
- Update Supplier navigation from Stocks to Offerings
- Update ApplicationDbContext with new DbSets and configurations
- Add unique constraints: StockItem(MaterialId, LengthInches) and
  SupplierOffering(SupplierId, StockItemId)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-02 22:32:14 -05:00
parent 0ded77ce8b
commit 9929d82768
4 changed files with 32 additions and 29 deletions

View File

@@ -10,7 +10,7 @@ public class Material
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime? UpdatedAt { get; set; }
public ICollection<SupplierStock> SupplierStocks { get; set; } = new List<SupplierStock>();
public ICollection<StockItem> StockItems { get; set; } = new List<StockItem>();
public ICollection<MaterialStockLength> StockLengths { get; set; } = new List<MaterialStockLength>();
public ICollection<ProjectPart> ProjectParts { get; set; } = new List<ProjectPart>();

View File

@@ -9,5 +9,5 @@ public class Supplier
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public ICollection<SupplierStock> Stocks { get; set; } = new List<SupplierStock>();
public ICollection<SupplierOffering> Offerings { get; set; } = new List<SupplierOffering>();
}

View File

@@ -1,15 +0,0 @@
namespace CutList.Web.Data.Entities;
public class SupplierStock
{
public int Id { get; set; }
public int SupplierId { get; set; }
public int MaterialId { get; set; }
public decimal LengthInches { get; set; }
public decimal? Price { get; set; }
public string? Notes { get; set; }
public bool IsActive { get; set; } = true;
public Supplier Supplier { get; set; } = null!;
public Material Material { get; set; } = null!;
}