Create an API endpoint to handle accepting invitation links to join an organization. This endpoint will validate the invitation link and automatically add the user to the specified organization upon successful validation.
Acceptance Criteria
API Endpoint Implementation:
The endpoint should be accessible at /api/v1/invite/accept.
The endpoint should accept HTTP POST requests.
Data Validation and Sanitization:
The API should validate the request payload to ensure the invitation link is present and valid.
The invitation link should be checked for correctness and validity (e.g., it hasn't expired and belongs to a valid organization).
Adding User to Organization:
Upon successful validation of the invitation link, the user should be added to the specified organization.
Response:
On success, the API should return a 200 OK status code with a success message.
On failure, the API should return a 400 Bad Request status code with appropriate error messages.
Request Example:
POST /api/v1/invite/accept
{
"invitation_link": "string"
}
Successful Response:
{
"message": "Invitation accepted, you have been added to the organization",
"status_code": 200
}
Error Response:
{
"message": "Invalid or expired invitation link",
"errors": [
"Invalid invitation link format",
"Expired invitation link",
"Organization not found"
],
"status_code": 400
}
Purpose
Provides a backend service to handle accepting invitation links for users to join an organization, ensuring the link is valid and automatically adding the user to the appropriate organization.
Requirements
[x] Develop server-side logic to handle invitation link submissions.
[x] Validate and sanitize incoming invitation link data.
[x] Add the user to the specified organization upon successful validation of the invitation link.
Expected Outcome
The API endpoint allows users to accept invitation links via the provided link and ensures they are added to the appropriate organization.
Status Codes
200: Invitation was successfully accepted, and the user was added to the organization.
400:
Invalid invitation link format
Expired invitation link
Organization not found
500: A server error occurred
Testing
[ ] Write unit tests to ensure the invitation link endpoint validates input correctly and adds users to the organization.
[ ] Perform load testing to ensure the endpoint can handle multiple requests.
[ ] Test various scenarios for submitting the invitation link (e.g., valid link, expired link, malformed link, etc.).
Description
Create an API endpoint to handle accepting invitation links to join an organization. This endpoint will validate the invitation link and automatically add the user to the specified organization upon successful validation.
Acceptance Criteria
API Endpoint Implementation:
/api/v1/invite/accept
.Data Validation and Sanitization:
Adding User to Organization:
Response:
Request Example:
POST /api/v1/invite/accept
Successful Response:
Error Response:
Purpose
Provides a backend service to handle accepting invitation links for users to join an organization, ensuring the link is valid and automatically adding the user to the appropriate organization.
Requirements
Expected Outcome
The API endpoint allows users to accept invitation links via the provided link and ensures they are added to the appropriate organization.
Status Codes
Testing