Allow store deletion when only archived lists reference it
Archived lists are no longer part of anyone''s workflow, so they shouldn''t block a store from being deleted. The handler now blocks only on non-archived lists and purges archived ones (items cascade) in the same transaction. Also grooms BACKLOG.md to remove items already shipped (Family/multi- tenant epic, password reset, email invites, auth rate limiting, picked-up-vs-removed, per-store sections base feature, add-recipe-to- list, store delete confirm + duplicate-name 409).
This commit is contained in:
@@ -70,7 +70,7 @@ public class StoreEndpointsTests : AuthenticatedIntegrationTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Delete_blocks_when_store_has_lists()
|
||||
public async Task Delete_blocks_when_store_has_active_lists()
|
||||
{
|
||||
var store = await Data.CreateStoreAsync();
|
||||
await Data.CreateListAsync(b => b.ForStore(store).CreatedBy(User));
|
||||
@@ -81,6 +81,19 @@ public class StoreEndpointsTests : AuthenticatedIntegrationTest
|
||||
await Assert.That(await UseDbAsync(db => db.Stores.AnyAsync(s => s.Id == store.Id))).IsTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Delete_succeeds_when_store_only_has_archived_lists()
|
||||
{
|
||||
var store = await Data.CreateStoreAsync();
|
||||
await Data.CreateListAsync(b => b.ForStore(store).CreatedBy(User).Archived());
|
||||
|
||||
var response = await Client.DeleteAsync($"/api/stores/{store.Id}");
|
||||
|
||||
await Assert.That(response.StatusCode).IsEqualTo(HttpStatusCode.NoContent);
|
||||
await Assert.That(await UseDbAsync(db => db.Stores.AnyAsync(s => s.Id == store.Id))).IsFalse();
|
||||
await Assert.That(await UseDbAsync(db => db.ShoppingLists.AnyAsync(l => l.StoreId == store.Id))).IsFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Create_returns_409_for_duplicate_name()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user