Skip to content

feat: replace user_gyms.role placeholder with temporal roles table (#140)#145

Merged
ChristopherRotnes merged 1 commit into
masterfrom
feat/roles-table-140
May 6, 2026
Merged

feat: replace user_gyms.role placeholder with temporal roles table (#140)#145
ChristopherRotnes merged 1 commit into
masterfrom
feat/roles-table-140

Conversation

@ChristopherRotnes
Copy link
Copy Markdown
Owner

@ChristopherRotnes ChristopherRotnes commented May 6, 2026

Summary

  • Creates roles table with valid_from / valid_to for tracking instruktør tenure over time
  • Migrates both existing user_gyms.role = 'instruktor' rows into roles; drops user_gyms.role column
  • Adds fetchActiveRoles(buId) helper in db.js (returns rows where valid_from <= today AND (valid_to IS NULL OR valid_to >= today))
  • Updates CLAUDE.md: removes role-placeholder caveat, adds roles architecture note

Test plan

  • Verify user_gyms table no longer has a role column in Supabase dashboard
  • Verify roles table has 2 rows (one per user), both with valid_to = null
  • Verify sign-in still works (ensureGymMembership upserts correctly without the dropped column)
  • Verify fetchActiveRoles() returns the correct active role

Closes #140

🤖 Generated with Claude Code

)

- Adds `roles` table with valid_from/valid_to for instruktør tenure tracking
- Migrates existing user_gyms.role rows; drops the column
- Adds fetchActiveRoles(buId) helper in db.js
- Updates CLAUDE.md architecture notes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@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-145.westeurope.7.azurestaticapps.net

@ChristopherRotnes ChristopherRotnes merged commit ba40542 into master May 6, 2026
1 check passed
@ChristopherRotnes ChristopherRotnes deleted the feat/roles-table-140 branch May 6, 2026 21:27
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.

As a developer I want gym roles stored with temporal validity so we can track instruktør tenure and title history accurately

1 participant