--- convoy: pricing-online-local brief_number: 12 depends_on: [1] recommended_model: composer-2.5 model_tier: standard files: - pages/settings.js - pages/api/user/settings.js - test/api/user-settings-home-zip.test.js --- # Brief 12: Settings home zip ## Goal (1 sentence) Let users save a home zip code in Settings for local store discovery. ## Files in scope (do not edit anything else) - `pages/settings.js` - `pages/api/user/settings.js` - `test/api/user-settings-home-zip.test.js` ## Conventions to follow - Auth: `getUserFromRequest` → 401 if null. - Validate zip: 5-digit US; store 5-digit string; allow `null` to clear. - Settings UI: field under **Preferences** — “Home ZIP code (for nearby game stores)”. - Owner-scoped read/write only (`user_id = session.userId`). ## Acceptance criteria - [ ] GET settings includes `home_zip` - [ ] PUT persists valid zip; 400 on invalid - [ ] Settings page loads and saves zip - [ ] Tests pass - [ ] No scope expansion ## Rationale (≤3 sentences) Phase 2 requires a default location without GPS. Reuses existing settings flow. Independent of geo API briefs once migration lands.