chore(api): migrate roles.create/roles.update to typed HTTP methods - #41365
chore(api): migrate roles.create/roles.update to typed HTTP methods#41365devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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 EEroles.*write endpoints from legacyAPI.v1.addRoute()to the typedAPI.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() {}).bodyslot, reusing the existing compiled validatorsisRoleCreateProps/isRoleUpdateProps(previously invoked manually inside the handler). The redundant in-handlerif (!isRole*Props(this.bodyParams)) throw ...checks are removed since the router now rejects invalid bodies before the handler.{ role, success: true }whereroleuses$ref: '#/components/schemas/IRole'(the typia-generatedIRoleschema is already registered in the core-typings registry and added to the rest-typings ajv instance at runtime viaapps/meteor/server/api/validation/ajv.ts). No weak{ type: 'object' }.400/401/403error response validators.Meteor.Errorcodes are preserved unchanged (e.g.error-action-not-allowed"This is an enterprise feature"), so the existing e2e assertions inapps/meteor/tests/end-to-end/api/roles.tsstill hold.Endpointsdeclaration for/v1/roles.createand/v1/roles.updatekept 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 --noEmitclean for the changed file.apps/meteor/tests/end-to-end/api/roles.tscoversroles.update(EE success + CE enterprise-feature 400) with unchanged expectations.Further comments
Link to Devin session: https://app.devin.ai/sessions/daf03dc59cb54e958e31a9e9c72fb162