Skip to content

chore(api): migrate roles.create/roles.update to typed HTTP methods - #41365

Open
devin-ai-integration[bot] wants to merge 1 commit into
developfrom
devin/1784037386-api-endpoint-migration-batch3
Open

chore(api): migrate roles.create/roles.update to typed HTTP methods#41365
devin-ai-integration[bot] wants to merge 1 commit into
developfrom
devin/1784037386-api-endpoint-migration-batch3

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Proposed changes (including videos or screenshots)

Continues the API endpoint migration (docs/api-endpoint-migration.md) after batches #41361 and #41363. This batch migrates the two EE roles.* write endpoints from legacy API.v1.addRoute() to the typed API.v1.post() pattern. Endpoints from #41356 remain excluded.

Migrated endpoints (apps/meteor/ee/server/api/roles.ts)

  • roles.create (POST)
  • roles.update (POST)

Changes

  • addRoute(..., { async post() {} })API.v1.post(..., async function action() {}).
  • Request validation moved to the typed body slot, reusing the existing compiled validators isRoleCreateProps / isRoleUpdateProps (previously invoked manually inside the handler). The redundant in-handler if (!isRole*Props(this.bodyParams)) throw ... checks are removed since the router now rejects invalid bodies before the handler.
  • Strict, elaborated response schema: { role, success: true } where role uses $ref: '#/components/schemas/IRole' (the typia-generated IRole schema is already registered in the core-typings registry and added to the rest-typings ajv instance at runtime via apps/meteor/server/api/validation/ajv.ts). No weak { type: 'object' }.
  • Added 400/401/403 error response validators.
  • Enterprise licensing / permission / duplicate-name checks and their exact Meteor.Error codes are preserved unchanged (e.g. error-action-not-allowed "This is an enterprise feature"), so the existing e2e assertions in apps/meteor/tests/end-to-end/api/roles.ts still hold.
  • Manual Endpoints declaration for /v1/roles.create and /v1/roles.update kept as-is (not re-augmented).

Issue(s)

Follow-up to #41361 and #41363. Part of docs/api-endpoint-migration.md.

Steps to test or reproduce

  • tsc --noEmit clean for the changed file.
  • eslint + prettier clean for the changed file.
  • apps/meteor/tests/end-to-end/api/roles.ts covers roles.update (EE success + CE enterprise-feature 400) with unchanged expectations.

Further comments

Link to Devin session: https://app.devin.ai/sessions/daf03dc59cb54e958e31a9e9c72fb162

Review in cubic

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@dionisio-bot

dionisio-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

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 targeting the wrong base branch. It should target 8.8.0, but it targets 8.7.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


guilherme.gazzo seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@ggazzo ggazzo added this to the 8.8.0 milestone Jul 14, 2026
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.06%. Comparing base (460858e) to head (add81f5).
⚠️ Report is 3 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #41365      +/-   ##
===========================================
- Coverage    69.12%   69.06%   -0.06%     
===========================================
  Files         3762     3762              
  Lines       147936   147936              
  Branches     26428    26423       -5     
===========================================
- Hits        102261   102175      -86     
- Misses       41185    41267      +82     
- Partials      4490     4494       +4     
Flag Coverage Δ
e2e 59.21% <ø> (-0.01%) ⬇️
e2e-api 49.05% <ø> (-0.37%) ⬇️
unit 70.56% <ø> (-0.08%) ⬇️

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.

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

Projects

Development

Successfully merging this pull request may close these issues.

2 participants