feat: api v2 team invite link endpoint#26644
Conversation
There was a problem hiding this comment.
1 issue found across 7 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="apps/api/v2/src/modules/teams/invite/outputs/invite.output.ts">
<violation number="1" location="apps/api/v2/src/modules/teams/invite/outputs/invite.output.ts:21">
P2: For consistency with other API v2 output DTOs, use `SUCCESS_STATUS` and `ERROR_STATUS` constants from `@calcom/platform-constants` with proper enum typing instead of a generic string.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Devin AI is addressing Cubic AI's review feedbackA Devin session has been created to address the issues identified by Cubic AI. |
Address Cubic AI review feedback by using proper enum typing with SUCCESS_STATUS and ERROR_STATUS constants from @calcom/platform-constants for consistency with other API v2 output DTOs. Co-Authored-By: unknown <>
…tps://git-manager.devin.ai/proxy/github.com/calcom/cal.com into rajiv/cal-7046-api-v2-teams-invite-link-endpoint
packages/trpc/server/routers/viewer/teams/createInvite.handler.ts
Outdated
Show resolved
Hide resolved
| @Controller({ | ||
| path: "/v2/teams/:teamId", | ||
| version: API_VERSIONS_VALUES, | ||
| }) | ||
| @UseGuards(ApiAuthGuard, RolesGuard) | ||
| @DocsTags("Teams / Invite") | ||
| @ApiHeader(API_KEY_HEADER) |
There was a problem hiding this comment.
It seems like this endpoint could be called for an org sub -team as well and in that case we are using createTeamInvite which might generate wrong link
There was a problem hiding this comment.
i'll try to see if we have some already existing guard to check if its a normal team and not an org team.
There was a problem hiding this comment.
@hariombalhara i've updated the code to make sure we use createInvite method from TeamService. yes this endpoint can be called for an org sub team as well as a normal team, and createInvite has the right logic to handle both of those cases. the main thing to keep in mind is that we only let team admin or team owner make successful requests here. everything should work as expected now.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@cubic-dev-ai update the PR description |
|
@hariombalhara should be good to review again! |
E2E results are ready! |
Co-Authored-By: rajiv@cal.com <sahalrajiv6900@gmail.com>
9b88ae7
What does this PR do?
Adds a new API v2 endpoint to create team invite links. Addresses Linear CAL-7046 by providing a simple way for admins to generate tokens and shareable links.
New Endpoint
POST /v2/teams/:teamId/invite- ReturnstokenandinviteLinkTEAM_ADMINrole and API authenticationTeamService.createInvitemethod handles both contexts appropriately)Implementation Details
TeamsInviteControllerwith the new invite endpointCreateInviteOutputDtoandInviteDataDtofor response types (following API v2 conventions withSUCCESS_STATUS/ERROR_STATUSconstants)TeamsInviteModuleinto the platform endpointsTeamService.createInvitemethod which generates the correct invite link format based on context:/signupwith callback to/getting-started/teamsTests
Updates since last revision
import * as request from "supertest"toimport request from "supertest"(default import) to match the pattern used by all other API v2 E2E testsMandatory Tasks (DO NOT REMOVE)
How should this be tested?
POST /v2/teams/:teamId/invitewith valid API authenticationstatus: "success",data.token, anddata.inviteLinkChecklist for human review
TeamService.createInvitegenerates correct links for both regular teams and org sub-teamsLink to Devin run: https://app.devin.ai/sessions/f7c710a65b90495a89c321afb8dc2f65
Requested by: @Ryukemeister (rajiv@cal.com)