Distinguish picked-up from removed shopping list items
Soft-remove items via RemovedAt/RemovedByUserId instead of hard deleting so the row survives for undo and future history reporting. DELETE now sets the removal fields; a new POST .../restore clears them. Active list reads (summary, detail, check toggle) filter to RemovedAt IS NULL. Frontend surfaces an Undo toast on remove and handles a new ItemRestored SignalR event.
This commit is contained in:
@@ -59,6 +59,7 @@ public class YesChefDb(DbContextOptions<YesChefDb> options) : DbContext(options)
|
||||
e.Property(i => i.Name).HasMaxLength(300);
|
||||
e.HasOne(i => i.Family).WithMany().HasForeignKey(i => i.FamilyId).OnDelete(DeleteBehavior.Cascade);
|
||||
e.HasOne(i => i.CheckedByUser).WithMany().HasForeignKey(i => i.CheckedByUserId).OnDelete(DeleteBehavior.SetNull);
|
||||
e.HasOne(i => i.RemovedByUser).WithMany().HasForeignKey(i => i.RemovedByUserId).OnDelete(DeleteBehavior.SetNull);
|
||||
e.HasOne(i => i.Recipe).WithMany().HasForeignKey(i => i.RecipeId).OnDelete(DeleteBehavior.SetNull);
|
||||
e.HasIndex(i => i.FamilyId);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user