feat: add UserInviteToTenantCommand for inviting users to a tenant#181
feat: add UserInviteToTenantCommand for inviting users to a tenant#181odinellefsen wants to merge 10 commits intomainfrom
Conversation
📝 WalkthroughWalkthroughAdds two user-facing commands: UserDeleteCommand (DELETE /api/users) and UserInviteToTenantCommand (POST /api/users/invitations), exports them from the public commands index, and adds tests plus release/version metadata updates. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Auth as Authenticator
participant UserAPI as User API
participant Parser as Response Parser
Client->>Auth: Attach bearer token
Client->>UserAPI: POST /api/users/invitations (invite payload)
UserAPI-->>Client: 200 { success, tenantName, invitedEmail }
Client->>Parser: parseResponseHelper(response, responseSchema)
Parser-->>Client: Typed UserInviteToTenantOutput
sequenceDiagram
participant Client
participant Auth as Authenticator
participant UserAPI as User API
participant Parser as Response Parser
Client->>Auth: Attach bearer token
Client->>UserAPI: DELETE /api/users
UserAPI-->>Client: 200 { id }
Client->>Parser: parseResponseHelper(response, responseSchema)
Parser-->>Client: Typed UserDeleteOutput
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…s the output for deleting the authenticated user
… the input for deleting the current authenticated user
… corresponding test
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@CHANGELOG.md`:
- Around line 3-17: Add a missing changelog entry for the new
UserInviteToTenantCommand by adding a bullet under the "Features" section
describing the addition (e.g., "add UserInviteToTenantCommand and corresponding
tests for inviting users to a tenant") and reference the commit/PR that
introduced it (use the commit hash or PR link for the change), ensuring the
symbol name UserInviteToTenantCommand appears exactly as in the codebase so the
release notes accurately reflect the new feature.
In `@test/tests/commands/user.test.ts`:
- Around line 82-88: The mock path used in the test doesn't match the path
produced by UserDeleteCommand.getPath(): the test registers DELETE "/api/users/"
(trailing slash) while the command returns "/api/users" (no trailing slash);
update the test to mock DELETE "/api/users" (remove the trailing slash) so the
fetchMockerBuilder.delete call matches UserDeleteCommand.getPath(), and ensure
matchHeaders and matchBody remain unchanged.
| ## [1.66.0](https://github.com/flowcore-io/flowcore-sdk/compare/v1.65.0...v1.66.0) (2026-01-19) | ||
|
|
||
|
|
||
| ### Features | ||
|
|
||
| * add UserDeleteCommand and corresponding tests for user deletion functionality ([85fc50e](https://github.com/flowcore-io/flowcore-sdk/commit/85fc50ed90d5df49267ae0b25ab171bcae5117b3)) | ||
| * add UserDeleteCommand to handle deletion of the authenticated user ([a674ef8](https://github.com/flowcore-io/flowcore-sdk/commit/a674ef8a59bec94917dd8aefc6f31431afa9ffb2)) | ||
| * add UserDeleteCommand to handle deletion of the authenticated user ([96c931b](https://github.com/flowcore-io/flowcore-sdk/commit/96c931b3ff0d16be6b157f0f09f9fb5fffb7d6ab)) | ||
|
|
||
|
|
||
| ### Bug Fixes | ||
|
|
||
| * remove trailing slash from user deletion API endpoint and update corresponding test ([b1c1ea4](https://github.com/flowcore-io/flowcore-sdk/commit/b1c1ea467218ab97d2b4c6263ebe14eabe0eb94f)) | ||
| * update UserDeleteInput type description to clarify it represents the input for deleting the current authenticated user ([2f092dd](https://github.com/flowcore-io/flowcore-sdk/commit/2f092ddb96ea7cdbf88b4862453dbb0508e381c6)) | ||
| * update UserDeleteOutput type description to clarify it represents the output for deleting the authenticated user ([4c5ac23](https://github.com/flowcore-io/flowcore-sdk/commit/4c5ac23d29b178cbce56e75e60ca728db8a42598)) |
There was a problem hiding this comment.
Changelog is missing UserInviteToTenantCommand entry.
The PR title indicates this PR adds UserInviteToTenantCommand, but the changelog only documents UserDeleteCommand. The UserInviteToTenantCommand should be documented as a new feature in this release.
🤖 Prompt for AI Agents
In `@CHANGELOG.md` around lines 3 - 17, Add a missing changelog entry for the new
UserInviteToTenantCommand by adding a bullet under the "Features" section
describing the addition (e.g., "add UserInviteToTenantCommand and corresponding
tests for inviting users to a tenant") and reference the commit/PR that
introduced it (use the commit hash or PR link for the change), ensuring the
symbol name UserInviteToTenantCommand appears exactly as in the codebase so the
release notes accurately reflect the new feature.
| fetchMockerBuilder.delete("/api/users/") | ||
| .matchHeaders({ | ||
| Authorization: "Bearer BEARER_TOKEN", | ||
| "Content-Type": "application/json", | ||
| }) | ||
| .matchBody({}) | ||
| .respondWith(200, responseData) |
There was a problem hiding this comment.
Path mismatch causes test failure.
The test mocks DELETE /api/users/ (with trailing slash), but the UserDeleteCommand.getPath() returns /api/users (without trailing slash). This mismatch is the cause of the pipeline failure: "Mocked requests not called: DELETE https://user-2.api.flowcore.io/api/users/".
🐛 Proposed fix
- fetchMockerBuilder.delete("/api/users/")
+ fetchMockerBuilder.delete("/api/users")📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| fetchMockerBuilder.delete("/api/users/") | |
| .matchHeaders({ | |
| Authorization: "Bearer BEARER_TOKEN", | |
| "Content-Type": "application/json", | |
| }) | |
| .matchBody({}) | |
| .respondWith(200, responseData) | |
| fetchMockerBuilder.delete("/api/users") | |
| .matchHeaders({ | |
| Authorization: "Bearer BEARER_TOKEN", | |
| "Content-Type": "application/json", | |
| }) | |
| .matchBody({}) | |
| .respondWith(200, responseData) |
🤖 Prompt for AI Agents
In `@test/tests/commands/user.test.ts` around lines 82 - 88, The mock path used in
the test doesn't match the path produced by UserDeleteCommand.getPath(): the
test registers DELETE "/api/users/" (trailing slash) while the command returns
"/api/users" (no trailing slash); update the test to mock DELETE "/api/users"
(remove the trailing slash) so the fetchMockerBuilder.delete call matches
UserDeleteCommand.getPath(), and ensure matchHeaders and matchBody remain
unchanged.
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.