3c: partial consumption + undo for cooking sessions
- Append-only undo via correction transactions tied to cookingSessionId. - POST /v1/cooking-sessions/:id/undo with 24h UTC window (409 + i18n after expiry). - Complete undo scope: meals removed, meal boxes discarded, recipe_cooks deleted, cookCount decremented; activation milestones left intact. - Deterministic assumption-profile rollback via lastSessionAnswers.sessionId; profile deleted when observationCount reaches 0. - New status 'undone' as TEXT validated against COOKING_SESSION_STATUSES. - Analytics event cooking_session_undone + domain events MEAL_BOX_DISCARDED, MEAL_REMOVED, COOKING_SESSION_UNDONE. - Partial consumption uses actualPortionsEaten/plannedPortions factor. - i18n coverage for cooked.undoWindowExpired across all 12 locales + server. - Invariant tests: computeBalance(transactions) === item.quantity after complete, undo, and undo + new complete; transaction count increases on undo. - Migration 0014_expand_event_types.sql adds new enum values. - Updated FAS3-COOKING-SESSIONS-AUDIT.md with chosen semantics.
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
-- Expandera event_type-enum med nya domänhändelser för 3c (undo/partiell förbrukning).
|
||||
ALTER TYPE "event_type" ADD VALUE IF NOT EXISTS 'MEAL_BOX_DISCARDED';
|
||||
ALTER TYPE "event_type" ADD VALUE IF NOT EXISTS 'MEAL_REMOVED';
|
||||
ALTER TYPE "event_type" ADD VALUE IF NOT EXISTS 'COOKING_SESSION_UNDONE';
|
||||
@@ -92,6 +92,13 @@
|
||||
"when": 1786049332540,
|
||||
"tag": "0013_dark_the_anarchist",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 13,
|
||||
"version": "7",
|
||||
"when": 1786055900000,
|
||||
"tag": "0014_expand_event_types",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user