Skip to content

added support for custom membership id - #14325

Merged
Meldiron merged 6 commits into
appwrite:mainfrom
imtia33:feat/custom-membership-id
Oct 12, 2026
Merged

Meldiron merged 6 commits into
appwrite:mainfrom
imtia33:feat/custom-membership-id

Conversation

@imtia33

@imtia33 imtia33 commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds support for custom membership IDs when creating team memberships via POST /v1/teams/:teamId/memberships.

  • New optional membershipId param accepts a custom ID or ID.unique() for auto-generation
  • Defaults to ID.unique() when omitted, preserving backward compatibility
  • Returns 409 membership_already_exists when a duplicate membershipId is provided

Test Plan

docker compose exec appwrite test tests/e2e/Services/Teams --filter=testCreateTeamMembershipCustomId
  • ✅ Custom ID is persisted and retrievable via GET /v1/teams/:teamId/memberships/:membershipId
  • ✅ unique() generates a non-literal unique ID
  • ✅ Duplicate custom ID returns 409
  • ✅ Invalid custom ID returns 400

Related PRs and Issues

  • N/A

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

@ghost

ghost commented Oct 10, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

Adds optional custom membership IDs to team membership creation, retaining generated IDs when omitted and returning a conflict for duplicate IDs. The creation path also cleans up invitees when a duplicate membership prevents creation and updates team totals transactionally for privileged memberships, with API and end-to-end coverage for these behaviors.

Latest changes: The new commits make the client duplicate-case email unique inline and add server-side coverage confirming that a duplicate membership ID leaves no orphan invitee user.

Verdict New comments Fixed Still open
💬 Commented 0 0 0

Note

@imtia33 does not have write access to this repository, so Hansi does not approve automatically. A maintainer can review and approve.

📂 Walkthrough · 5
File Change
app/config/errors.php Defines the API error response for duplicate membership IDs.
src/Appwrite/Extend/Exception.php Adds the membership-already-exists exception constant.
src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php Accepts and validates custom membership IDs, handles duplicate IDs and invitee cleanup, and transactionally updates team totals for privileged memberships.
tests/e2e/Services/Teams/TeamsBaseClient.php Covers custom and generated membership IDs, duplicate and invalid IDs, and uses a unique email for the duplicate attempt.
tests/e2e/Services/Teams/TeamsBaseServer.php Adds server-side coverage for custom membership ID persistence and verifies a duplicate attempt does not leave an invitee user behind.

Reviewed the commits since ca9f9b2 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · See the inline comments. Summary

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · See the inline comments. Summary

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

The users API needs an API key, so the client suites got a 401 when
asserting that a duplicate custom membership ID leaves no orphaned
invitee. The console project has no key to fall back to, so the
assertion now lives in the server suite.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Meldiron
Meldiron merged commit 043d427 into appwrite:main Oct 12, 2026
63 checks passed
abnegate added a commit that referenced this pull request Oct 12, 2026
Brings in custom membership IDs (#14325) and the installer port fixes
(#14345). Ported to database 8.0: Utopia\Database\Id in place of
Helpers\ID in the membership route and its server tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 this pull request may close these issues.

2 participants