feat(cloud): the online ordering app (takeaway, delivery) with hours, time slots and rate limits (platform-v2 3S, S.4)
- connect_frontend/order-app at /order/{site}: menu per service at that service's prices,
extras, basket (kept per tab), checkout priced by the cloud (fee, area by list or
postcode, minimum), name/phone/address/notes (remembered), as soon as possible or a time
slot, tracking page with steps, lines and totals; en/el; tokens in index.css. Logic in
src/logic.js, unit-tested; built and served by the connect image (npm test in the build).
- services/ordering.py: the venue's services, hours (past midnight), preparation, slot grid,
days ahead, ASAP; takeaway/delivery orders checked (order.service_unavailable,
order.closed, order.time_invalid) and need a phone; GET /api/orders/{site}/slots; the
public menu carries the ordering summary.
- services/ratelimit.py: per-caller limits on quote, order and track (429 rate.limited).
- online_orders.requested_for (0003, unreleased) stored as UTC; every datetime sent with its
offset (the database keeps no zone: a 12:00 Athens slot came back as 12:00 unzoned).
- Tracking returns what was ordered, the totals, the type and the time.
- Tests: test_ordering.py (5), checkout/fees updated; order-app unit (4).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""online orders: sales_point, table_label, delivery_area, tracking_token; public_ref unique per site (plan phase 3S, S.2/S.3)
|
||||
"""online orders: sales_point, table_label, delivery_area, requested_for, tracking_token; public_ref unique per site (plan phase 3S, S.2/S.3)
|
||||
|
||||
- sales_point / table_label: the cloud prices orders per sales point; the QR menu's table
|
||||
- public_ref ("ORD-0001") counts per site but was unique across all sites, so a second
|
||||
@@ -60,6 +60,7 @@ def upgrade() -> None:
|
||||
with op.batch_alter_table('online_orders', copy_from=_base(), recreate='always') as batch_op:
|
||||
batch_op.add_column(sa.Column('table_label', sa.String(), nullable=True))
|
||||
batch_op.add_column(sa.Column('delivery_area', sa.String(), nullable=True))
|
||||
batch_op.add_column(sa.Column('requested_for', sa.DateTime(timezone=True), nullable=True))
|
||||
batch_op.add_column(sa.Column('sales_point', sa.String(), nullable=True))
|
||||
batch_op.add_column(sa.Column('tracking_token', sa.String(), nullable=True))
|
||||
batch_op.create_unique_constraint('uq_online_orders_site_ref', ['site_id', 'public_ref'])
|
||||
@@ -73,11 +74,13 @@ def upgrade() -> None:
|
||||
def downgrade() -> None:
|
||||
current = _base(sa.Column('table_label', sa.String(), nullable=True),
|
||||
sa.Column('delivery_area', sa.String(), nullable=True),
|
||||
sa.Column('requested_for', sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column('sales_point', sa.String(), nullable=True),
|
||||
sa.Column('tracking_token', sa.String(), nullable=True))
|
||||
with op.batch_alter_table('online_orders', copy_from=current, recreate='always') as batch_op:
|
||||
batch_op.drop_column('tracking_token')
|
||||
batch_op.drop_column('sales_point')
|
||||
batch_op.drop_column('requested_for')
|
||||
batch_op.drop_column('delivery_area')
|
||||
batch_op.drop_column('table_label')
|
||||
batch_op.create_unique_constraint('uq_online_orders_public_ref', ['public_ref'])
|
||||
|
||||
Reference in New Issue
Block a user