Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/burger-api/api.http
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,21 @@ Content-Type: application/json
]
}

### Create a new order with nickname
POST {{api_host}}/api/orders
Content-Type: application/json

{
"userId": "user123",
"nickname": "Alice",
"items": [
{
"burgerId": "1",
"quantity": 2
}
]
}

### Delete/cancel an order
DELETE {{api_host}}/api/orders/12345?userId=user123

Expand Down
11 changes: 11 additions & 0 deletions packages/burger-api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,10 @@ components:
format: date-time
description: ISO date string for when the order was ready (undefined until ready)
example: '2025-04-10T15:05:00Z'
nickname:
type: string
description: Optional nickname for the order
example: 'John'
totalPrice:
type: number
format: float
Expand Down Expand Up @@ -520,6 +524,9 @@ components:
type: string
format: date-time
description: ISO date string for when the order was completed (undefined until completed)
nickname:
type: string
description: Optional nickname for the order
totalPrice:
type: number
format: float
Expand All @@ -538,6 +545,10 @@ components:
userId:
type: string
example: 'user123'
nickname:
type: string
description: Optional nickname for the order (first 8 characters will be displayed in the dashboard)
example: 'John'
items:
type: array
description: List of burger items (maximum 50 burgers total across all items)
Expand Down
2 changes: 2 additions & 0 deletions packages/burger-api/src/functions/orders-post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface CreateOrderRequest {
quantity: number;
extraToppingIds?: string[];
}>;
nickname?: string;
}

// Helper function for topping validation
Expand Down Expand Up @@ -176,6 +177,7 @@ app.http('orders-post', {
estimatedCompletionAt: estimatedCompletionAt.toISOString(),
totalPrice,
status: OrderStatus.Pending,
nickname: requestBody.nickname,
completedAt: undefined,
});

Expand Down
1 change: 1 addition & 0 deletions packages/burger-api/src/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface Order {
estimatedCompletionAt: string; // ISO date string for estimated completion time
totalPrice: number;
status: OrderStatus;
nickname?: string; // Optional nickname for the order
readyAt?: string; // ISO date string for when the order was ready (undefined until ready)
completedAt?: string; // ISO date string for when the order was completed (undefined until completed)
}
1 change: 1 addition & 0 deletions packages/burger-mcp/src/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export const tools = [
description: 'Place a new order with burgers (requires userId)',
schema: z.object({
userId: z.string().describe('ID of the user placing the order'),
nickname: z.string().optional().describe('Optional nickname for the order (first 8 characters will be displayed in the dashboard)'),
items: z
.array(
z.object({
Expand Down
3 changes: 2 additions & 1 deletion packages/burger-webapp/src/components/burger-dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,15 @@ export class BurgerDashboard extends LitElement {

protected renderOrder = (order: BurgerOrder, isLeaving = false) => {
const animClass = isLeaving ? 'fade-out' : '';
const displayId = order.nickname ? order.nickname.slice(0, 8) : order.id.slice(-8);
return html`
<div
data-order-id="${order.id}"
class="order-anim ${animClass}"
@animationend=${isLeaving ? () => this.handleFadeOutEnd(order.id) : undefined}
>
<div class="${this.getOrderBoxClass(order)}">
<div class="order-id">#${order.id.slice(-6)}</div>
<div class="order-id">#${displayId}</div>
<div class="order-status">
<div class="order-status-inner">${this.getOrderDisplayStatus(order)}</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions packages/burger-webapp/src/orders.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface BurgerOrder {
estimatedCompletionAt: string;
totalPrice: number;
status: string;
nickname?: string;
readyAt?: string;
completedAt?: string;
}
Expand Down