From 1254797fe1d039dabcd5d3b1c29afbcbf99d6993 Mon Sep 17 00:00:00 2001 From: Aaron Po Date: Thu, 27 Aug 2026 00:53:05 -0400 Subject: [PATCH] Update docs for brewery maps/location work: frontend feature-slice layout, spatial proximity query, and new location-query tests --- README.md | 3 ++- docs/architecture.md | 38 ++++++++++++++++++++++++++++++-------- docs/website/testing.md | 2 ++ 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 53d1a44a..15c2c0cf 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,8 @@ Archived/reference areas: ## Tech stack - **Backend**: .NET 10, ASP.NET Core, SQL Server 2022, DbUp -- **Frontend**: React 19, React Router 7, Vite 7, Tailwind CSS 4, DaisyUI 5 +- **Frontend**: React 19, React Router 7, Vite 7, Tailwind CSS 4, DaisyUI 5, + Leaflet/React Leaflet (brewery maps) - **UI Documentation**: Storybook 10, Vitest browser mode, Playwright - **Testing**: xUnit, Reqnroll (BDD), FluentAssertions, Moq - **Infrastructure**: Docker, Docker Compose diff --git a/docs/architecture.md b/docs/architecture.md index cd98e485..acf7eb73 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -309,7 +309,12 @@ it, without an ORM's change-tracking or mapping magic through Dapper, with no manual `IDbCommand` parameter binding. The one wrinkle is the `GEOGRAPHY` column on `BreweryPostLocation`, which Dapper can't deserialize as a UDT: reads select `CONVERT(varbinary(max), - Coordinates)` so the value comes back as a plain `byte[]` Dapper can bind + Coordinates)` so the value comes back as a plain `byte[]` Dapper can bind. + Proximity search (`GET /api/brewery/locations/nearby`) filters and orders + rows server-side with `Coordinates.STDistance(@Origin) <= @RangeInMetres`, + avoiding a client-side distance calculation over every row. No spatial + index backs the query yet; `schema.sql` sketches one, commented out, for + when the table grows large enough to need it - Referential checks that a stored procedure used to perform (e.g. "does this `CityId` exist?") are now explicit `SELECT 1 ...` existence checks in the repository method, run inside the same transaction as the write @@ -335,11 +340,24 @@ enabled. ```text web/frontend/ ├── app/ -│ ├── components/ Shared UI such as Navbar, FormField, SubmitButton, ToastProvider -│ ├── lib/ Auth helpers, schemas, and theme metadata -│ ├── routes/ Route modules for home, login, register, dashboard, confirm, theme -│ ├── root.tsx App shell and global providers -│ └── app.css Theme tokens and global styling +│ ├── components/ Shared UI: Navbar, FormField, SubmitButton, ToastProvider, +│ │ RouteErrorState, ClientOnly (defers client-only children, +│ │ for example Leaflet maps, past hydration) +│ ├── features/ One folder per feature slice, each owning its own +│ │ routes/, components/, hooks/, schemas, and server-side +│ │ loader helpers: +│ │ - account profile/dashboard management +│ │ - auth login, register, confirm, logout +│ │ - breweries index/directory/detail routes, Leaflet +│ │ map components, nearby-search resource +│ │ route, distance/address utils +│ │ - catalog beers, beer styles +│ │ - home landing page +│ │ - theme theme switcher/guide +│ ├── hooks/ Shared hooks not tied to one feature, for example useMediaQuery +│ ├── routes.ts Route table (React Router 7 config-based routing) +│ ├── root.tsx App shell and global providers +│ └── app.css Theme tokens and global styling ├── .storybook/ Storybook config and preview setup ├── stories/ Storybook stories for shared UI and themes ├── tests/playwright/ Storybook Playwright coverage @@ -348,9 +366,13 @@ web/frontend/ ### Frontend responsibilities -- Render the auth demo and theme guide routes +- Render brewery discovery routes (`/breweries` index, `/breweries/directory`, + `/breweries/:id`) with Leaflet-powered maps and geolocation-based "nearby" + search +- Render the auth demo, account dashboard, and theme guide routes - Manage cookie-backed website session state -- Call the .NET API for login, registration, token refresh, and confirmation +- Call the .NET API for login, registration, token refresh, confirmation, and + brewery/location data - Provide shared UI building blocks for forms, navigation, themes, and toasts - Supply Storybook documentation and browser-based component verification diff --git a/docs/website/testing.md b/docs/website/testing.md index 356e7317..8a58f011 100644 --- a/docs/website/testing.md +++ b/docs/website/testing.md @@ -164,6 +164,8 @@ The default (`headless: true`) is set in `web/frontend/vite.config.ts`. **Features.Breweries.Tests**: - Brewery create/update/delete commands and get-by-id/get-all queries +- Brewery location queries: all locations, and locations within a given range + of a coordinate **Features.UserManagement.Tests**: