feat: Add PurchaseItem entity and job locking data layer
Add PurchaseItem entity with status tracking (Pending/Ordered/Received), supplier and job relationships. Add LockedAt timestamp to Job entity for controlling editability after materials are ordered. Includes PurchaseItemService (CRUD + bulk create), JobService Lock/Unlock methods, EF Core migrations, and DI registration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,9 @@ public class Job
|
||||
public string? Notes { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
public DateTime? LockedAt { get; set; }
|
||||
|
||||
public bool IsLocked => LockedAt.HasValue;
|
||||
|
||||
public CuttingTool? CuttingTool { get; set; }
|
||||
public ICollection<JobPart> Parts { get; set; } = new List<JobPart>();
|
||||
|
||||
25
CutList.Web/Data/Entities/PurchaseItem.cs
Normal file
25
CutList.Web/Data/Entities/PurchaseItem.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace CutList.Web.Data.Entities;
|
||||
|
||||
public enum PurchaseItemStatus
|
||||
{
|
||||
Pending,
|
||||
Ordered,
|
||||
Received
|
||||
}
|
||||
|
||||
public class PurchaseItem
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int StockItemId { get; set; }
|
||||
public int? SupplierId { get; set; }
|
||||
public int Quantity { get; set; }
|
||||
public int? JobId { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
public PurchaseItemStatus Status { get; set; } = PurchaseItemStatus.Pending;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
|
||||
public StockItem StockItem { get; set; } = null!;
|
||||
public Supplier? Supplier { get; set; }
|
||||
public Job? Job { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user