Skip to content

PR 1: user_gyms foundation (#136) [WIP]#137

Merged
ChristopherRotnes merged 2 commits into
masterfrom
claude/issue-136-foundation
May 6, 2026
Merged

PR 1: user_gyms foundation (#136) [WIP]#137
ChristopherRotnes merged 2 commits into
masterfrom
claude/issue-136-foundation

Conversation

@ChristopherRotnes
Copy link
Copy Markdown
Owner

@ChristopherRotnes ChristopherRotnes commented May 6, 2026

First PR in the multi-instruktør epic (#136). Lands the user_gyms membership table and read/upsert helpers; downstream PRs (joint-class history + opt-out toggle, profile display_name, roles FK, multi-BU sportySync) build on this.

Already done

Supabase migration applied to remote project <project-id> (irreversible — visible in the Supabase dashboard now):

  • create table user_gyms (id, user_id, sporty_business_unit_id, role, created_at) with unique(user_id, sporty_business_unit_id)
  • RLS policies: self select / insert / delete keyed on auth.uid() = user_id
  • Backfilled both existing users to BU 8 (Sporty Thon Senter Ski)
  • role is a text placeholder; PR 4 will swap it for role_id FK to a temporal roles table

Code (app/src/lib/db.js):

  • DEFAULT_SPORTY_BUSINESS_UNIT_ID = 8
  • fetchMyGyms() — read; trusts RLS
  • ensureGymMembership(buId) — idempotent upsert; intended to be called on first login

App wire-up + UI (commit d61bfd3):

  • App.jsx: calls ensureGymMembership() after getSession() resolves and on each auth state change
  • Settings.jsx: read-only "Min gym" card with Carbon Tag "Sporty Thon Senter Ski" + future-hint subtitle; inserted between Utseende and Kontakt
  • nb/en/fa locales: settings.myGym, settings.myGymMembership, settings.myGymFutureHint
  • sportySync.js: comment cross-referencing the multi-BU follow-up
  • CLAUDE.md: architecture note for user_gyms, opt-out-same-gym sharing model, role placeholder transition
  • Build passes ✓

Test plan

https://claude.ai/code/session_01PNmJDWGM4eWSDPFFHmJiyY


Generated by Claude Code

Foundation work for the multi-instruktør epic. Lands the user_gyms
membership table in Supabase and the read helper plus auto-join helper
that downstream PRs (joint-class history, opt-out toggle, multi-BU
sportySync) will build on.

Migration applied to remote Supabase project (kyolnraqudwrjjbtxhwx):
- create table user_gyms (id, user_id, sporty_business_unit_id, role,
  created_at) with unique(user_id, sporty_business_unit_id)
- RLS: self select/insert/delete; auth.uid() = user_id
- Backfilled both existing users to BU 8 (Sporty Thon Senter Ski)

db.js additions:
- DEFAULT_SPORTY_BUSINESS_UNIT_ID = 8
- fetchMyGyms() — read; trusts RLS
- ensureGymMembership(buId) — idempotent upsert; called on first login
  (wire-up in App.jsx is the next commit)

Remaining for PR 1 (handover to local dev):
- Wire ensureGymMembership() into App.jsx auth flow
- Settings.jsx: read-only "Min gym" card (Sporty Thon Senter Ski)
- i18n keys settings.my_gym_*, settings.my_gym_membership,
  settings.my_gym_future_hint in nb/en/fa
- Comment on sportySync.js BU 8 hardcode pointing at PR 5 follow-up
- CLAUDE.md architecture note for user_gyms
- npm run build verification

Plan: /root/.claude/plans/robust-exploring-sutton.md

https://claude.ai/code/session_01PNmJDWGM4eWSDPFFHmJiyY
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-island-090dfd003-137.westeurope.7.azurestaticapps.net

- App.jsx: call ensureGymMembership() on session resolve + auth state change
- Settings.jsx: read-only "Min gym" card (Carbon Tag) between Utseende and Kontakt
- nb/en/fa locales: myGym, myGymMembership, myGymFutureHint keys
- sportySync.js: comment flagging BU 8 hardcode for future multi-gym removal
- CLAUDE.md: architecture note for user_gyms, opt-out sharing model, role placeholder

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ChristopherRotnes ChristopherRotnes marked this pull request as ready for review May 6, 2026 14:51
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-island-090dfd003-137.westeurope.7.azurestaticapps.net

@ChristopherRotnes ChristopherRotnes merged commit 9e1adc1 into master May 6, 2026
1 check passed
@ChristopherRotnes ChristopherRotnes deleted the claude/issue-136-foundation branch May 6, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants