You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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"}
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
The text was updated successfully, but these errors were encountered:
Description
Create a
POST
route handler at/api/invites
that accepts form data, creates aUserInvite
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
anduserType
. The email will include a link to${ORIGIN}/register?token=${TOKEN}
whereORIGIN
is the origin of the server andTOKEN
is the generated UUID of the invite.Success Criteria
POST /api/invites
returns a401
status code with JSON body{"message": "Session required"}
SUPER_ADMIN
, thenPOST /api/invites
returns a403
status code with JSON body{"message": "You are not allowed to create an invite"}
User
record with the given email, thenPOST /api/invites
returns a409
status code with JSON body{"message": "Email already registered"}
POST /api/invites
creates a newUserInvite
record, sends an email to the invited user, and returns a200
status codeUserInvite
record will expire in one dayThe text was updated successfully, but these errors were encountered: