Add InPreparation intermediate state to kitchen items#4
Draft
Add InPreparation intermediate state to kitchen items#4
Conversation
Co-authored-by: marc-mueller <13311299+marc-mueller@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add in preparation state for kitchen items
Add InPreparation intermediate state to kitchen items
Mar 2, 2026
Owner
|
You changed the frontend. Did you @copilot made sure that the UI tests are also adopted to the new UI flow and controls? Please check and update the tests under src/systemtests/FastFood.Ui.System.Tests |
…flow Co-authored-by: marc-mueller <13311299+marc-mueller@users.noreply.github.com>
Contributor
Author
Updated in commit
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Kitchen items previously had no way to signal that preparation had started, causing potential double-work between cooks. This adds an
InPreparationstate betweenAwaitingPreparationandFinished, with state transition enforced server-side.State machine
Invalid transitions (e.g. finishing an
AwaitingPreparationitem) now throwInvalidOperationException.Backend (KitchenService)
InPreparation = 1toKitchenOrderItemStateandKitchenOrderItemDtoStateenums with explicit ordinals to avoid DTO cast breakageStartedAttoKitchenOrderItem/KitchenOrderItemDto; preparation duration metric now usesStartedAtinstead ofCreatedAtSetItemAsInPreparation(Guid id)toIKitchenService— validatesAwaitingPreparationstate, setsStartedAt, publisheskitcheniteminpreparationpub/sub eventSetItemAsFinishednow requiresInPreparationstate before transitioningGetPendingOrders/GetPendingItemsnow includeInPreparationitems (not justAwaitingPreparation)KitchenItemInPreparationEvent,FastFoodConstants.EventNames.KitchenItemInPreparation/DeadLetterKitchenItemInPreparation, dead-letter handler, andPOST api/kitchenwork/iteminpreparation/{id}endpointFrontend proxy (FrontendKitchenMonitor ASP.NET host)
POST api/kitchenwork/iteminpreparation/{id}Dapr proxy endpointkitcheniteminpreparationpub/sub topic — broadcastskitchenorderupdatedvia SignalR on state changeFrontend Vue (FrontendKitchenMonitor SPA)
apiClient.js/kitchenStore.js: addedstartOrderItemPreparation(itemId)WorkMonitor.vue: three distinct states with appropriate affordances:AwaitingPreparation→ Start button (data-testid="start-item-btn-{itemId}")InPreparation→ pulsing amber In Progress badge + Finish button (data-testid="finish-item-btn-{itemId}")Finished→ green Finished labelTests
KitchenServiceTests: updatedSetItemAsFinishedtests to first move items toInPreparation; added tests forSetItemAsInPreparation(happy path, already-in-preparation, finished item, non-existing)KitchenWorkControllerTests(both services): added tests for new endpointFrontendKitchenMonitorEventHandlerControllerTests(new): covers new topic subscriptionkitchenStore.test.js: addedstartOrderItemPreparationtestKitchenMonitorPage.cs(system tests page object): updated to support the two-step Start → Finish flow; addedStartItemAsync/StartItemByIdAsyncmethods;FinishItemAsyncautomatically starts items still inAwaitingPreparationso existingOrderWorkflowTestswork without changes;GetOrderAsyncnow detectsInPreparationstate; addedIsInPreparationtoKitchenOrderItemmodelOriginal prompt
Kitchen Items: Add "In Preparation" intermediate state between "Awaiting Preparation" and "Finished"
Work Item Details
Note: Please focus on the descriptions and information that provide context about the task requirements, functionality, and implementation details. Dates, priorities, and administrative metadata are less relevant for coding tasks.
Description
Currently, kitchen items in the FrontendKitchenMonitor and KitchenService only support two states: AwaitingPreparation and Finished. A cook can only mark an item as finished — there is no way to indicate that preparation has started. This makes it impossible for other cooks to see which items are already being worked on, leading to potential double-work or confusion during busy periods.
This work item introduces a new InPreparation state between
AwaitingPreparationandFinished. A cook will first click a "Start" button to claim an item (transitioning it toInPreparation), and then click "Finish" when done. The state transition chain becomes:AwaitingPreparation → InPreparation → Finished
Scope: KitchenService backend + FrontendKitchenMonitor frontend only. The OrderService and FrontendCustomerOrderStatus are not in scope — the OrderService continues to consume only the existing
kitchenitemfinishedevent.Backend Changes (KitchenService)
Add
InPreparationvalue toKitchenOrderItemStateenum in KitchenOrderItemState.cs — insert betweenAwaitingPreparation(0) andFinished. Assign explicit ordinal values to all members to avoid breaking the DTO cast.Add
InPreparationvalue toKitchenOrderItemDtoStateenum in KitchenOrderItemDtoState.cs — matching ordinal to the entity enum.Add
StartedAtproperty toKitchenOrderItementity in KitchenOrderItem.cs — nullableDateTimeOffset?to record when preparation started, consistent with existingCreatedAt/FinishedAtpattern.Add
StartedAtproperty toKitchenOrderItemDtoin KitchenOrderItemDto.cs and update the DtoConverter to map it.Add new
SetItemAsInPreparation(Guid id)method to IKitchenService and implement in KitchenService.cs:_mockStorageAwaitingPreparation(throwInvalidOperationExceptionotherwise)State = InPreparation,StartedAt = DateTimeOffset.UtcNowkitcheniteminpreparationDapr pub/sub eventUpdate
SetItemAsFinishedin KitchenService.cs — validate that item is inInPreparationstate (notAwaitingPreparation) before allowing finish. Record observability metric for preparation duration usingStartedAt.Add new
KitchenItemInPreparationEventclass in KitchenService.Common/Events/ — matching the pattern ofKitchenItemFinishedEventwithOrderIdandItemIdproperties.Add new event name constant
KitchenItemInPreparation="kitcheniteminpreparation"to FastFoodConstants.EventNames.Add dead letter constant
DeadLetterKitchenItemInPreparationinFastFoodConstants.EventNamesand add handler in DeadLetterHandlerController.cs.Add new endpoint
POST api/kitchenwork/iteminpreparation/{id}to KitchenWorkController that callsSetItemAsInPreparation.Update
GetPendingOrders/GetPendingItemsin KitchenService.cs — items withInPreparationstate should still be included in pending results (they are not finished yet).Update backend unit tests:
* KitchenServiceTests.cs — add tests for
SetItemAsInPreparation(happy ...Work item: AB#360
Created via Azure DevOps
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.