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:
@@ -17,7 +17,7 @@ class OnlineOrder(Base):
|
||||
public_ref = Column(String, nullable=False)
|
||||
# the customer's tracking page: random, unguessable (S.2; the ref alone was ambiguous across sites)
|
||||
tracking_token = Column(String, nullable=True)
|
||||
order_type = Column(String, nullable=False) # dine_in | takeaway | delivery | preorder
|
||||
order_type = Column(String, nullable=False) # dine_in | takeaway | delivery | reservation | preorder (S.6)
|
||||
|
||||
# Customer info
|
||||
customer_name = Column(String, nullable=False)
|
||||
@@ -28,6 +28,7 @@ class OnlineOrder(Base):
|
||||
delivery_area = Column(String, nullable=True) # the delivery area's name (S.3)
|
||||
delivery_area_id = Column(Integer, nullable=True) # the site's area id (S.5: the site checks the fee)
|
||||
requested_for = Column(DateTime(timezone=True), nullable=True) # the time slot picked (S.4); null = asap
|
||||
party_size = Column(Integer, nullable=True) # reservations (S.6): how many guests
|
||||
sales_point = Column(String, nullable=True) # the site's sales point (phase 3S, S.2)
|
||||
|
||||
# Order content — JSON array of ordered items
|
||||
@@ -41,6 +42,8 @@ class OnlineOrder(Base):
|
||||
# Status lifecycle:
|
||||
# pending_acceptance → accepted | rejected
|
||||
# accepted → preparing → ready | out_for_delivery → delivered
|
||||
# reservations (S.6): pending_acceptance → accepted (confirmed) | rejected;
|
||||
# accepted → delivered (the guests arrived) | cancelled (by the venue)
|
||||
status = Column(String, default="pending_acceptance", nullable=False, index=True)
|
||||
rejection_reason = Column(String, nullable=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user