PUT
Replace my preferences

Overview

Replaces the caller’s user_preferences document. The semantics are a full PUT, not a PATCH — every field listed below must be supplied; omitted fields are not preserved. The server upserts: if the user already has a preferences document it is overwritten in place; if not (i.e. they reached this endpoint without going through onboarding step 4 — unlikely in normal flows) one is created. Either way the response is the updated document. The server derives maxRentMonthlyMinor from the supplied maxRent (weekly rents are annualised then divided by 12 and rounded to the nearest pence). The matching engine reads only maxRentMonthlyMinor, so weekly/monthly rents are directly comparable. After a successful write the server enqueues a match.recompute job with reason: "preferences_updated" so the matcher picks up the new filter (Phase 3 worker; stub in Phase 2 records the enqueue for ordering tests).

Authentication

Bearer <accessToken> required. Scope: user.

Path parameters

None.

Query parameters

None.

Request body

All fields are required.

MaxRent object

PreferredLocation object

Note: the wire format on the request body uses flat lng / lat fields (the controller maps them into GeoJSON Points server-side). The response body returns the stored GeoJSON shape — see Get my preferences.

Example payload

Response — 200 OK

Returns the updated Preferences object. maxRentMonthlyMinor is derived server-side and included.

Error responses

Example error — 400

Side effects

  • Upserts the caller’s row in the user_preferences collection.
  • maxRentMonthlyMinor is derived server-side from maxRent (MONTHLY → as-is; WEEKLY → round(amountMinor * 52 / 12)).
  • updatedAt is bumped (or set to now on insert).
  • Enqueues a match.recompute job with { userId, reason: "preferences_updated" } (Phase 3 worker; stub in Phase 2).

See also

curl