feat(maintainer/contributors): add invite system — DB schema, send invite action, accept flow #517#614
Conversation
|
please fix the conflict, then we proceed with the review |
|
@prasiddhi-105 is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel. A member of the Team first needs to authorize it. |
donee |
|
CI is still failing, please run |
|
This PR has had no activity for 7 days. Are you still working on it? If so, please push an update or leave a comment. Otherwise it will be labeled |
yeah working on it |
|
CI failure, please fix it |
|
@prasiddhi-105 ur ci and cd are failing please fix that |
Yess I will do it soon, actually there's network problem in my area due to heavy rainfall and we're under the danger zone!! So ! |
Oo Be safe |
Summary
This PR replaces the unstructured client-side referral link mechanism (
/?ref={accountLogin}) with a robust, database-tracked, email-driven structured invitation system. It introduces a complete backend management flow (send, resend, list, revoke) along with a standalone invitation landing accept page and a reactive "Pending Invites" sidebar tracking dashboard widget.Type of Change
Related Issue
Closes #517
What was changed?
invitestable tracking unique tokens, timestamps, target organization installation IDs, and statuses per invited email using Drizzle ORM dialects (src/lib/db/schema.ts).requireMaintainer()that securely manage invitations utilizing the project's nativegetDb()client instance (src/app/actions/maintainer/invites.ts):sendInvite(): Validates input email formatting, checks for pre-existing active records, generates a secure random hex token, writes to the DB, and dispatches the email invitation hook.resendInvite(): Renews an invitation by pushing the rolling expiration boundary out by another 7 days.listPendingInvites(): Filters and fetches active, non-expired invitation rows for the given repository workspace.revokeInvite(): Purges an active record from database indices cleanly.sendInviteEmail) wrapping the initializedresendclient package (src/lib/email.ts).src/app/invite/[token]/page.tsxas a separate, distraction-free screen outside the core dashboard shell layout. It evaluates the valid parameters, handles authentication redirection parameters cleanly via?next=, processes multi-table records atomically inside a Drizzle.transaction(), and updates the contributor access list safely.src/app/(app)/maintainer/invite-contributor-button.tsxto handle true form submission dispatches and appended a beautiful Pending Invites sidebar tracker grid list to view statuses, resend, or revoke actions instantly.Screenshots
Will add screenshots upon deployment to the staging environment due to a local dev auth loop. Tested via static type checking.
Checklist
npm run dev)