File tree Expand file tree Collapse file tree 6 files changed +18
-1
lines changed Expand file tree Collapse file tree 6 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -486,6 +486,10 @@ components:
486486 format : date-time
487487 description : ISO date string for when the order was ready (undefined until ready)
488488 example : ' 2025-04-10T15:05:00Z'
489+ nickname :
490+ type : string
491+ description : Optional nickname for the order
492+ example : ' John'
489493 totalPrice :
490494 type : number
491495 format : float
@@ -520,6 +524,9 @@ components:
520524 type : string
521525 format : date-time
522526 description : ISO date string for when the order was completed (undefined until completed)
527+ nickname :
528+ type : string
529+ description : Optional nickname for the order
523530 totalPrice :
524531 type : number
525532 format : float
@@ -538,6 +545,10 @@ components:
538545 userId :
539546 type : string
540547 example : ' user123'
548+ nickname :
549+ type : string
550+ description : Optional nickname for the order (first 8 characters will be displayed in the dashboard)
551+ example : ' John'
541552 items :
542553 type : array
543554 description : List of burger items (maximum 50 burgers total across all items)
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ interface CreateOrderRequest {
1010 quantity : number ;
1111 extraToppingIds ?: string [ ] ;
1212 } > ;
13+ nickname ?: string ;
1314}
1415
1516// Helper function for topping validation
@@ -176,6 +177,7 @@ app.http('orders-post', {
176177 estimatedCompletionAt : estimatedCompletionAt . toISOString ( ) ,
177178 totalPrice,
178179 status : OrderStatus . Pending ,
180+ nickname : requestBody . nickname ,
179181 completedAt : undefined ,
180182 } ) ;
181183
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ export interface Order {
2020 estimatedCompletionAt : string ; // ISO date string for estimated completion time
2121 totalPrice : number ;
2222 status : OrderStatus ;
23+ nickname ?: string ; // Optional nickname for the order
2324 readyAt ?: string ; // ISO date string for when the order was ready (undefined until ready)
2425 completedAt ?: string ; // ISO date string for when the order was completed (undefined until completed)
2526}
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ export const tools = [
7979 description : 'Place a new order with burgers (requires userId)' ,
8080 schema : z . object ( {
8181 userId : z . string ( ) . describe ( 'ID of the user placing the order' ) ,
82+ nickname : z . string ( ) . optional ( ) . describe ( 'Optional nickname for the order (first 8 characters will be displayed in the dashboard)' ) ,
8283 items : z
8384 . array (
8485 z . object ( {
Original file line number Diff line number Diff line change @@ -112,14 +112,15 @@ export class BurgerDashboard extends LitElement {
112112
113113 protected renderOrder = ( order : BurgerOrder , isLeaving = false ) => {
114114 const animClass = isLeaving ? 'fade-out' : '' ;
115+ const displayId = order . nickname ? order . nickname . slice ( 0 , 8 ) : order . id . slice ( - 8 ) ;
115116 return html `
116117 <div
117118 data- or der- id= "${ order . id } "
118119 class = "order-anim ${ animClass } "
119120 @animationend = ${ isLeaving ? ( ) => this . handleFadeOutEnd ( order . id ) : undefined }
120121 >
121122 <div class= "${ this . getOrderBoxClass ( order ) } " >
122- <div class= "order-id" > # ${ order . id . slice ( - 6 ) } </ div>
123+ <div class= "order-id" > # ${ displayId } </ div>
123124 <div class= "order-status" >
124125 <div class= "order-status-inner" > ${ this . getOrderDisplayStatus ( order ) } </ div>
125126 </ div>
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ export interface BurgerOrder {
99 estimatedCompletionAt : string ;
1010 totalPrice : number ;
1111 status : string ;
12+ nickname ?: string ;
1213 readyAt ?: string ;
1314 completedAt ?: string ;
1415}
You can’t perform that action at this time.
0 commit comments