Document brewery index data gaps and add nearby-locations query

This commit is contained in:
Aaron Po
2026-08-27 00:22:32 -04:00
parent eebb87811f
commit 8fae3f564a
2 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
# Brewery index redesign — data gaps
Frontend for the new `/breweries` layout is integrated with real data wherever the API already supports it. These gaps are filled with lorem-ipsum-style filler until the backend catches up:
- **Featured brewery** — no "editorially flagged" concept exists (no field, no endpoint). Currently defaults to the most recently created brewery. Needs a real flag (e.g. `IsFeatured` + an admin toggle, or a rotation query) plus the "week" cadence implied by the "THIS WEEK" badge.
- **Brewery tagline / one-line note** — `SimplifiedBreweryDto` (used by both `/locations` and `/locations/nearby`) has no description-like field. The nearby list and recently-added cards use filler note text. Needs a short field added to that DTO (or a truncated `Description`).
- **Founded year, beers listed count, house style** — none of these exist anywhere in the domain (`BreweryPost` has no founding date or style; there's no beer-count aggregate; `Features.Beers` has no query handlers at all yet). Featured card stats are entirely filler.
- **Total brewery count** — no lightweight count endpoint. CTA copy ("All N partner breweries...") uses a filler number rather than an unbounded fetch just to count rows. Needs something like `GET /api/brewery/count`.
- **Distance** is computed client-side (Haversine) from the coordinates `/locations/nearby` already returns — no backend change needed there.
- **Manual location entry** — "Change location" button re-requests browser geolocation only; there's no geocoding/place-search endpoint to resolve a typed address, so free-text entry isn't wired up yet.

View File

@@ -86,6 +86,30 @@ export const getBreweryLocations = async (): Promise<SimplifiedBrewery[]> => {
return body.payload;
};
export const getBreweryLocationsNearby = async (
latitude: number,
longitude: number,
rangeInMetres: number,
): Promise<SimplifiedBrewery[]> => {
const params = new URLSearchParams({
latitude: String(latitude),
longitude: String(longitude),
rangeInMetres: String(rangeInMetres),
});
const res = await fetchApi(`/api/brewery/locations/nearby?${params}`);
if (!res.ok) {
throw data(`Failed to load nearby breweries (${res.status}).`, {
status: res.status,
statusText: res.statusText,
});
}
const body: ApiResponse<SimplifiedBrewery[]> = await res.json();
return body.payload;
};
export const getBreweryById = async (id: string): Promise<Brewery | null> => {
const res = await fetchApi(`/api/brewery/${encodeURIComponent(id)}`);