Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ASSUMPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,21 @@ docker run --rm -p 3000:3000 infinite-choice

Then hit <http://localhost:3000/health>.

## 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,
Expand Down
Loading