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

feat(organizations): create endpoints to handle organization invitations #5395

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rajpatel24
Copy link
Contributor

@rajpatel24 rajpatel24 commented Dec 20, 2024

🗒️ Checklist

  1. run linter locally
  2. update all related docs (API, README, inline, etc.), if any
  3. draft PR with a title <type>(<scope>)<!>: <title> TASK-1234
  4. tag PR: at least frontend or backend unless it's global
  5. fill in the template below and delete template comments
  6. review thyself: read the diff and repro the preview as written
  7. open PR & confirm that CI passes
  8. request reviewers, if needed
  9. delete this section before merging

📣 Summary

Implemented endpoints for organization invitations, allowing organization owners to invite existing users or unregistered users to join their organization. The invitee can either accept or decline the invitation. If the invitee accepts, their assets will be transferred to the organization.

📖 Description

  • Organization owners can send invitations to users (both registered and unregistered) via email or username.
  • The invitee can accept or decline the invitation. If accepted, the invitee's assets will be transferred to the organization owner.

GET https://[kpi]/api/v2/organizations/org_12345/invites/

Response:

{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "url": "http://kf.kobo.local/api/v2/organizations/org3ua6H3F94CQpQEYs4RRz4/invites/f361ebf6-d1c1-4ced-8343-04b11863d784/",
            "invited_by": "http://kf.kobo.local/api/v2/users/demo7/",
            "status": "pending",
            "invitee_role": "member",
            "created": "2024-12-11T16:00:00Z",
            "modified": "2024-12-11T16:00:00Z",
            "invitee": "raj_patel"
        },
        {
            "url": "http://kf.kobo.local/api/v2/organizations/orgLRM8xmvWji4itYWWhLVgC/invites/1a8b93bf-eec5-4e56-bd4a-5f7657e6a2fd/",
            "invited_by": "http://kf.kobo.local/api/v2/users/raj_patel/",
            "status": "pending",
            "invitee_role": "member",
            "created": "2024-12-11T18:19:56Z",
            "modified": "2024-12-11T18:19:56Z",
            "invitee": "demo7"
        }
    ]
}

POST https://[kpi]/api/v2/organizations/org_12345/invites/

  • Create organization invites for registered and unregistered users.
  • Set the role for which the user is being invited - (Choices: member, admin). Default is member.

Payload:

    "invitees": ["demo14", "[email protected]", "[email protected]"],
    "role": "member"

Response:

[
    {
        "url": "http://kf.kobo.local/api/v2/organizations/orgLRM8xmvWji4itYWWhLVgC/invites/ee857d4b-a171-465f-8402-7bda015f9850/",
        "invited_by": "http://kf.kobo.local/api/v2/users/raj_patel/",
        "status": "pending",
        "invitee_role": "member",
        "created": "2024-12-23T08:02:21Z",
        "modified": "2024-12-23T08:02:21Z",
        "invitee": "demo14"
    },
    {
        "url": "http://kf.kobo.local/api/v2/organizations/orgLRM8xmvWji4itYWWhLVgC/invites/0bf2ec6c-bcd9-44b2-bcd0-27e9b2724811/",
        "invited_by": "http://kf.kobo.local/api/v2/users/raj_patel/",
        "status": "pending",
        "invitee_role": "member",
        "created": "2024-12-23T08:02:21Z",
        "modified": "2024-12-23T08:02:21Z",
        "invitee": "demo13"
    },
    {
        "url": "http://kf.kobo.local/api/v2/organizations/orgLRM8xmvWji4itYWWhLVgC/invites/c4720d8f-f355-4a23-b498-ed21b808e99d/",
        "invited_by": "http://kf.kobo.local/api/v2/users/raj_patel/",
        "status": "pending",
        "invitee_role": "member",
        "created": "2024-12-23T08:02:21Z",
        "modified": "2024-12-23T08:02:21Z",
        "invitee": "demo20"
    }
]

@rajpatel24 rajpatel24 force-pushed the task-969-create-endpoints-to-handle-org-invitations branch from 092d932 to 64a2b55 Compare December 30, 2024 15:46
@rajpatel24 rajpatel24 changed the title Create endpoints to handle organization invitations feat(organizations): create endpoints to handle organization invitations Dec 30, 2024
@rajpatel24 rajpatel24 marked this pull request as ready for review December 30, 2024 16:14
@rajpatel24 rajpatel24 removed the request for review from jnm December 30, 2024 16:14
Copy link

Copy link

Copy link

@rajpatel24 rajpatel24 force-pushed the task-969-create-endpoints-to-handle-org-invitations branch from 64a2b55 to 1139076 Compare January 1, 2025 15:45
@rajpatel24 rajpatel24 self-assigned this Jan 1, 2025
@rajpatel24 rajpatel24 force-pushed the task-969-create-endpoints-to-handle-org-invitations branch from 1139076 to c28ad37 Compare January 2, 2025 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant