Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create User Invite Mutation #5

Open
9 tasks
kavinphan opened this issue Jan 20, 2025 · 0 comments · May be fixed by #17
Open
9 tasks

Create User Invite Mutation #5

kavinphan opened this issue Jan 20, 2025 · 0 comments · May be fixed by #17
Assignees

Comments

@kavinphan
Copy link
Contributor

kavinphan commented Jan 20, 2025

Description

Create a POST route handler at /api/invites that accepts form data, creates a UserInvite record using the form data and a generated UUID (v4), and sends an email to the invited user. The form data will include the following fields: email and userType. The email will include a link to ${ORIGIN}/register?token=${TOKEN} where ORIGIN is the origin of the server and TOKEN is the generated UUID of the invite.

Success Criteria

  • If the request does not have a valid session, then POST /api/invites returns a 401 status code with JSON body {"message": "Session required"}
  • If the request session user type is not SUPER_ADMIN, then POST /api/invites returns a 403 status code with JSON body {"message": "You are not allowed to create an invite"}
  • The form data is validated using a zod schema
  • If there is already a User record with the given email, then POST /api/invites returns a 409 status code with JSON body {"message": "Email already registered"}
  • POST /api/invites creates a new UserInvite record, sends an email to the invited user, and returns a 200 status code
  • The sent email uses the correct origin in the register link
  • The UserInvite record will expire in one day
  • The route handler is documented with a description of its function, parameters, and responses
  • There is a test file that covers the success criteria
@nathangong nathangong linked a pull request Jan 29, 2025 that will close this issue
9 tasks
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 a pull request may close this issue.

3 participants