hngprojects / hng_boilerplate_python_fastapi_web

Apache License 2.0
153 stars 141 forks source link

[FEAT]: Accept invitation to join organization -Backend #32

Open MikeSoft007 opened 1 month ago

MikeSoft007 commented 1 month ago

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:

Data Validation and Sanitization:

Adding User to Organization:

Response:

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

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

MikeSoft007 commented 1 month ago

SlackID: @Zeus