feat(cloud): table bookings online, with food ordered ahead
Plan phase 3S, step S.6.
- New order types "reservation" (a table only, no items) and "preorder" (a table with food,
priced at the online_preorder sales point); online_orders.party_size (migration 0005).
- services/ordering.py: the venue's booking settings (ordering.reservations in the snapshot):
hours (none = any time), time grid, notice, days ahead (≤ 90), party size; res_slots per
venue day, res_days, res_check (order.service_unavailable, order.party_invalid,
order.time_invalid). The public menu's ordering summary gains `reservations`
{enabled, with_food, party_max, days}; GET /api/orders/{site}/reservation-slots?day=.
- Bookings need a phone; a plain booking refuses items (order.items_not_allowed).
- Status steps for bookings: pending_acceptance → accepted | rejected; accepted → delivered
(arrived) | cancelled (by the venue); ordinary orders unchanged.
- Order app: "Book a table" (people, day, time, optional food at the pre-order prices),
booking summary at checkout, a booking tracking page (waiting, confirmed, welcome;
declined / cancelled with the reason). en/el.
- Tests: tests/test_reservations.py (3), order-app logic test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,8 +31,9 @@ class QuoteRequest(BaseModel):
|
||||
|
||||
|
||||
class OnlineOrderCreate(BaseModel):
|
||||
order_type: str # dine_in | takeaway | delivery | preorder
|
||||
order_type: str # dine_in | takeaway | delivery | reservation | preorder
|
||||
customer_name: str = Field(min_length=1, max_length=100)
|
||||
party_size: Optional[int] = None # reservations (S.6)
|
||||
customer_phone: Optional[str] = Field(default=None, max_length=40)
|
||||
customer_address: Optional[str] = Field(default=None, max_length=500)
|
||||
customer_notes: Optional[str] = Field(default=None, max_length=1000)
|
||||
@@ -40,7 +41,7 @@ class OnlineOrderCreate(BaseModel):
|
||||
area_id: Optional[int] = None # the delivery area picked (S.3)
|
||||
postcode: Optional[str] = Field(default=None, max_length=20)
|
||||
requested_for: Optional[datetime] = None # a time slot (S.4); None = as soon as possible
|
||||
items: list[OrderItemIn] = Field(max_length=100)
|
||||
items: list[OrderItemIn] = Field(default_factory=list, max_length=100)
|
||||
# what the customer was shown: compared, never stored as sent
|
||||
subtotal: Optional[float] = None
|
||||
delivery_fee: Optional[float] = None
|
||||
@@ -62,6 +63,7 @@ class OrderStatusOut(BaseModel):
|
||||
# S.4: what the tracking page shows (all optional: older clients ignore them)
|
||||
order_type: Optional[str] = None
|
||||
requested_for: Optional[datetime] = None
|
||||
party_size: Optional[int] = None # reservations (S.6)
|
||||
created_at: Optional[datetime] = None
|
||||
lines: Optional[list] = None
|
||||
subtotal: Optional[float] = None
|
||||
@@ -85,6 +87,7 @@ class PendingOrderOut(BaseModel):
|
||||
delivery_area: Optional[str] = None # the delivery area's name (S.3)
|
||||
delivery_area_id: Optional[int] = None # the site's area id (S.5)
|
||||
requested_for: Optional[datetime] = None # when the customer wants it (S.4); None = as soon as possible
|
||||
party_size: Optional[int] = None # reservations (S.6)
|
||||
sales_point: Optional[str] = None # the site's sales point (S.2)
|
||||
items_json: str
|
||||
subtotal: float
|
||||
|
||||
Reference in New Issue
Block a user