diff --git a/ASSUMPTIONS.md b/ASSUMPTIONS.md index cdf81b1..dbc7c1e 100644 --- a/ASSUMPTIONS.md +++ b/ASSUMPTIONS.md @@ -66,6 +66,15 @@ not. thrown `AppError`s, framework errors, unexpected exceptions — is normalized into that one error shape. +- **The detail endpoint is wrapped too — a deliberate override of the spec.** The original + spec (issue #1) said "single-resource detail is returned directly," but `GET /hotels/:id` + wraps the Property as `{ "data": ... }` like every other success. This is a conscious + divergence, recorded here rather than left silent: wrapping every response identically + means a client parses `data` the same way on every endpoint and leaves room to add + response-level `meta` to detail later without a breaking change. The cost is one extra + level of nesting — a good trade for a uniform contract. (The spec's "returned directly" + line is the stale one; this envelope decision supersedes it.) + - **snake_case on the wire.** The dataset is snake_case (`price_per_night`, `star_rating`, `available_dates`), so the API and query params stay snake_case end-to-end. Introducing a camelCase boundary would add a mapping layer and two vocabularies for one concept with diff --git a/README.md b/README.md index a9e2290..99c5817 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,21 @@ docker run --rm -p 3000:3000 infinite-choice Then hit . +## Future work + +Known, deliberately-deferred follow-ups — out of scope for this exercise, noted for +honesty rather than left as silent debt: + +- **Extract shared test factories.** The `makeRoom` / `makeProperty` fixture builders are + currently duplicated across `test/availability.test.ts`, `test/hotel-summary.test.ts`, + and `test/search.test.ts`. Pulling them into a single `test/factories.ts` would remove + the triplication and stop the defaults from drifting apart as tests grow. A related tidy + is folding the repeated unknown-id `404` guard in `src/routes/hotels.ts` behind a small + `getPropertyOr404` helper. +- **Push filters into the data store.** If the catalogue outgrew the in-memory seed, the + pure filter predicates would move into SQL and the endpoint would gain pagination — see + the [migration guide](docs/migration-postgres-sqlite.md). + ## Use of AI This project was built with AI coding-agent assistance (Claude), under human direction,