feat: delivery areas drawn on a map: the customer pins the address (plan 6R.G)

- services/fees.py: the site's engine (shapes matched by the pin), shared cases
- checkout: price_cart(pin=), delivery_areas with kind (+ geometry for shapes),
  venue_point in the public menu (postcodes and rules stay on the cloud)
- orders: quote / create take lat / lng; online_orders.lat / lng (Alembic 0007),
  sent to the site with the pending orders
- order app: PinMap (Leaflet + OpenStreetMap tiles), 'Pin it on the map' first
  when the venue drew areas, the browser's location offered; lat / lng sent
- tests: cloud test_fees (pinned quote and order), order-app logic

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 21:56:13 +02:00
co-authored by Claude Opus 5.5
parent e55157fa86
commit d5b8492512
17 changed files with 406 additions and 41 deletions
+6
View File
@@ -28,6 +28,8 @@ class QuoteRequest(BaseModel):
items: list[OrderItemIn] = Field(max_length=100)
area_id: Optional[int] = None # the delivery area picked (S.3)
postcode: Optional[str] = Field(default=None, max_length=20)
lat: Optional[float] = Field(default=None, ge=-90, le=90) # 6R.G: the customer's pin on the map
lng: Optional[float] = Field(default=None, ge=-180, le=180)
class OnlineOrderCreate(BaseModel):
@@ -41,6 +43,8 @@ class OnlineOrderCreate(BaseModel):
table_token: Optional[str] = Field(default=None, max_length=100) # the table's QR token (S.7)
area_id: Optional[int] = None # the delivery area picked (S.3)
postcode: Optional[str] = Field(default=None, max_length=20)
lat: Optional[float] = Field(default=None, ge=-90, le=90) # 6R.G: the customer's pin on the map
lng: Optional[float] = Field(default=None, ge=-180, le=180)
requested_for: Optional[datetime] = None # a time slot (S.4); None = as soon as possible
items: list[OrderItemIn] = Field(default_factory=list, max_length=100)
# what the customer was shown: compared, never stored as sent
@@ -88,6 +92,8 @@ class PendingOrderOut(BaseModel):
table_id: Optional[int] = None # the site's table, from a valid QR token (S.7)
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)
lat: Optional[float] = None # 6R.G: the customer's pin
lng: Optional[float] = None
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)