Skip to content

fix(registratie): oprichter krijgt expliciet school_role='admin' - #33

Merged
onder-ates merged 1 commit into
mainfrom
fix/register-school-admin-role
Jul 21, 2026
Merged

fix(registratie): oprichter krijgt expliciet school_role='admin'#33
onder-ates merged 1 commit into
mainfrom
fix/register-school-admin-role

Conversation

@onder-ates

@onder-ates onder-ates commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Wat

De web-registratie (`app/api/register-school/route.ts`) zette geen `school_role` bij de eerste instructors-insert. Sinds F3.1A (ribbaPro) is de DB-default de veilige `employee` en zijn financiën én de Stripe Billing Portal admin-only — een via de web geregistreerde school was daardoor direct beheerder-loos.

Fix (bewust minimaal): `school_role: 'admin'` op uitsluitend de registratie-oprichter, met een korte comment waarom dit pad bewust afwijkt van de veilige DB-default.

Buiten scope (onaangeraakt)

Geen DB-default-wijziging, geen invite-flow, geen portalcode, geen Mollie-paden, geen andere registratievelden, geen migratie of productiedata, geen deploy. PR #32 staat los hiervan geparkeerd.

Bewijs

  • Gerichte test `tests/register-school-admin-role.test.mjs`: precies één instructors-insert mét `school_role='admin'` (user_id/status ongewijzigd), en de multi-use uitnodigingslink blijft een leerling-invite zonder rol-parameter — invites behouden hun bestaande rolgedrag (veilige default in ribbaPro).
  • Volledige suite 115/115 groen, `tsc --noEmit` schoon.

De datacorrectie voor de bestaande E2E-school is een aparte actie met eigen GO ná merge van deze bronfix.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • School founders are now correctly assigned the administrator role during school registration.
    • Student invitation records remain unaffected and continue without an administrator role.
  • Tests

    • Added coverage to verify founder role assignment, registration success, and invitation details.

Sinds F3.1A is de DB-default voor instructors.school_role de veilige
'employee' en zijn financiën en de Stripe Billing Portal admin-only.
De web-registratie zette geen rol, dus een nieuw geregistreerde school
was direct beheerder-loos: de oprichter werd employee en kwam de
admin-afscherming nergens meer doorheen.

De registratie-oprichter wijkt nu bewust en expliciet af van de
DB-default; alle overige aanmaakpaden (invites) blijven op de veilige
default. Test pint vast: precies één instructors-insert mét
school_role='admin', en de multi-use uitnodigingslink blijft een
leerling-invite zonder rol-parameter.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ribba-pro Ready Ready Preview, Comment Jul 21, 2026 7:54pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6f4381f3-7d1b-4843-9c47-755dd9dcfbc5

📥 Commits

Reviewing files that changed from the base of the PR and between d12a1f5 and dabd033.

📒 Files selected for processing (2)
  • app/api/register-school/route.ts
  • tests/register-school-admin-role.test.mjs

📝 Walkthrough

Walkthrough

School registration now explicitly assigns the founder instructor school_role: 'admin'. A new test mocks the registration dependencies and verifies the instructor and student invitation insert payloads.

Changes

School registration role assignment

Layer / File(s) Summary
Founder role assignment and validation
app/api/register-school/route.ts, tests/register-school-admin-role.test.mjs
The registration handler assigns the founder instructor the admin role, while the test verifies the instructor insert and confirms the student invitation has no school_role field.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: explicitly assigning the founder an admin school role.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/register-school-admin-role

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant