Proposal/teacher onboarding mvp#595
Conversation
…cceptance page, tests)
…ity signature
- Convert pages/error.js and pages/teacher/invite/[inviteToken].js to modern Next.js Link pattern (no nested anchors)
- Refactor util/inviteEmail.js to accept object params {invitedTeacherEmail, inviteUrl, expiresAt, invitedByEmail}
- Ensures proper Nodemailer integration for teacher invitation emails
- redesign invite acceptance page with FCC-aligned styling - update teacher invitation email content and branding hierarchy - fix teacher invite post-accept redirect by role - improve revoke API message for inactive invites - add README testing/setup notes for SMTP invite flow
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Overall, this PR is a solid end-to-end workflow for the teacher invite. Nice work.
Can you add some tests? Given that there are so many status change branches (pending, accepted, rejected, expired), it would be good to have a test that verifies that each status is assigned correctly. You can mock the 3rd party apps (like the SMTP server).
You may also want to add a test to confirm that an uninvited teacher cannot access the classes page.
| "updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
|
||
| CONSTRAINT "StudentInvitation_pkey" PRIMARY KEY ("studentInvitationId") | ||
| ); |
There was a problem hiding this comment.
The StudentInvitation schema changes don't seem like they belong in this PR.
| const handleSignIn = async () => { | ||
| await signIn('auth0'); | ||
| }; |
There was a problem hiding this comment.
We are hardcoding auth0 which means a contributor using the Github oAuth would not be able to test this feature locally. I'm not totally opposed to only supporting auth0, but I'm curious, how difficult/complicated would it be to support both auth0 and Github oAuth?
If we do decide to only support auth0, then we should document somewhere in the README that if a developer decides to go with Github oAuth, certain features (like Teacher Invitations) won't work.
| - No port conflicts occur because domains are different | ||
| - The port changes in this repository are primarily for local development | ||
|
|
||
| ### Teacher Invitation Email Setup |
There was a problem hiding this comment.
The documentation is great, but I'm concerned the README.md is getting too long. Can you create a subpage for this documentation and link it from the README?
Checklist:
Update index.md)This PR is not associated with a specific issue
Case Study (Teacher Invite Acceptance Flow)
/teacher/invite/<token>.ACCEPTEDand user role is set toTEACHER.What Changed (and Why)
Teacher invite backend APIs to support create/list/resend/revoke and secure acceptance.
Reason: completes the core onboarding lifecycle with role-safe state transitions.
Files:
pages/api/admin/teacher_invites/create.js
pages/api/admin/teacher_invites/list.js
pages/api/admin/teacher_invites/resend.js
pages/api/admin/teacher_invites/revoke.js
pages/api/teacher_invites/accept.js
util/inviteApiUtils.js
Email delivery + feature flag rollout support.
Reason: enables controlled rollout and real invitation delivery.
Files:
util/inviteEmail.js
util/featureFlags.js
package.json
package-lock.json
Admin + teacher UI flow.
Reason: gives a usable end-to-end path from invite creation to invite acceptance.
Files:
components/TeacherInvitesPanel.js
components/TeacherInvitesPanel.module.css
pages/admin/index.js
pages/teacher/invite/[inviteToken].js
styles/Home.module.css
pages/error.js
Data model + migration for invitation lifecycle.
Reason: persists invitation state and supports expiry/revoke/accept transitions.
Files:
prisma/schema.prisma
prisma/migrations/20260409192210_add_invitation_models/migration.sql
Env/security/docs updates.
Reason: prevent future secret leaks and keep setup clear with tracked templates.
Files:
.gitignore
.env.sample
.env.development.example
.env.production.example
README.md
.env.development/.env.productionremoved from trackingValidation
npm run lint:codenpm testHow to Test
Prerequisites
This branch allows you to create an
ADMINaccount and send out email invitations to users to onboard as teachers.You need:
Configuring this branch for local development
CarlyAThomas:proposal/teacher-onboarding-mvpbranch.cp .env.development.example .env.developmentSMTP_USERin.env.developmentwith your Admin Email.SMTP_PASSin.env.developmentwith the new password.Running the app
npx prisma migrate reset, and pressyto reset your database.npm run developandnpx prisma studioto run the project.ADMIN.Testing