Skip to content

chore(api): migrate all teams endpoints #39824

Merged
ggazzo merged 1 commit intochore/apisfrom
chore/apis-teams
Mar 23, 2026
Merged

chore(api): migrate all teams endpoints #39824
ggazzo merged 1 commit intochore/apisfrom
chore/apis-teams

Conversation

@ggazzo
Copy link
Copy Markdown
Member

@ggazzo ggazzo commented Mar 23, 2026

…ge parameter

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Refactor
    • Restructured Teams API endpoint definitions for improved consistency and type safety across endpoint configurations.
    • Enhanced API response validation with standardized response schemas and error handling across multiple status codes.

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented Mar 23, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 23, 2026

⚠️ No Changeset found

Latest commit: 5274de8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 23, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 443a0b7a-b7b4-4f9f-a12f-cbe7bf7d6d89

📥 Commits

Reviewing files that changed from the base of the PR and between ca17e18 and 5274de8.

📒 Files selected for processing (1)
  • apps/meteor/app/api/server/v1/teams.ts

Walkthrough

The teams API routes were refactored from legacy addRoute registration to modern get/post style with integrated AJV-compiled response schemas and error validators for multiple status codes. TypeScript type exports and module augmentation were added for REST API typings.

Changes

Cohort / File(s) Summary
Teams API Route Refactoring
apps/meteor/app/api/server/v1/teams.ts
Converted all teams route registrations from API.v1.addRoute to API.v1.get/post pattern, added AJV-compiled response schemas (paginatedTeamsResponseSchema, successResponseSchema, roomResponseSchema, etc.) and error validators for multiple HTTP status codes, adjusted route implementations for new signatures (e.g., extracting result.data/total), and exported TeamsEndpoints type with module augmentation extending @rocket.chat/rest-typings Endpoints interface.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Suggested labels

type: chore


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.58%. Comparing base (9e3eb78) to head (1d16799).
⚠️ Report is 31 commits behind head on chore/apis.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff               @@
##           chore/apis   #39824      +/-   ##
==============================================
- Coverage       70.58%   70.58%   -0.01%     
==============================================
  Files            3256     3256              
  Lines          115778   115791      +13     
  Branches        21047    21039       -8     
==============================================
+ Hits            81723    81731       +8     
- Misses          31994    31996       +2     
- Partials         2061     2064       +3     
Flag Coverage Δ
e2e 60.43% <ø> (-0.01%) ⬇️
e2e-api 48.09% <ø> (-0.03%) ⬇️
unit 71.14% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ggazzo ggazzo force-pushed the chore/apis-teams branch from 1d16799 to a54b30b Compare March 23, 2026 23:19
…onse schemas

Migrates all 19 teams.* endpoints from addRoute to typed .get()/.post()
pattern with AJV response validation schemas.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@ggazzo ggazzo force-pushed the chore/apis-teams branch from a54b30b to 5274de8 Compare March 23, 2026 23:21
@ggazzo ggazzo marked this pull request as ready for review March 23, 2026 23:21
@ggazzo ggazzo requested a review from a team as a code owner March 23, 2026 23:21
@ggazzo ggazzo merged commit 2336ba3 into chore/apis Mar 23, 2026
4 of 6 checks passed
@ggazzo ggazzo deleted the chore/apis-teams branch March 23, 2026 23:21
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/meteor/app/api/server/v1/teams.ts">

<violation number="1" location="apps/meteor/app/api/server/v1/teams.ts:912">
P2: `TeamsEndpoints` is extracted from a partial route chain, so most migrated teams routes are omitted from the `Endpoints` type augmentation.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

},
);

export type TeamsEndpoints = ExtractRoutesFromAPI<typeof teamsEndpoints>;
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 23, 2026

Choose a reason for hiding this comment

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

P2: TeamsEndpoints is extracted from a partial route chain, so most migrated teams routes are omitted from the Endpoints type augmentation.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/meteor/app/api/server/v1/teams.ts, line 912:

<comment>`TeamsEndpoints` is extracted from a partial route chain, so most migrated teams routes are omitted from the `Endpoints` type augmentation.</comment>

<file context>
@@ -386,322 +501,417 @@ const getTeamByIdOrNameOrParentRoom = async (
 	},
 );
+
+export type TeamsEndpoints = ExtractRoutesFromAPI<typeof teamsEndpoints>;
+
+declare module '@rocket.chat/rest-typings' {
</file context>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant