chore: migrate rooms.saveNotification endpoint to new API format w…
Merged
RO
7mo ago+45+45+01234567890123456789-24-24-01234567890123456789
Proposed changes
This PR refactors the rooms.saveNotification endpoint to use the new API.v1.post format, replacing the deprecated addRoute method. AJV schema validation has been added for both the request body and response, improving input validation and aligning with Rocket.Chat API development guidelines.
Details of Changes
- Migrated
rooms.saveNotificationto the new API format. - Added AJV schema validation for request body (
roomId,notifications) and response (success). - Improved input validation and response structure.
- Removed deprecated
addRouteusage for this endpoint.
Testing
- Verified the endpoint with existing end-to-end tests in
apps/meteor/tests/end-to-end/api/rooms.ts. - All tests pass and the endpoint behaves as expected.
- Manual testing:
- Send a POST request to
/api/v1/rooms.saveNotificationwith a validroomIdandnotificationsobject. - Confirm a
200response with{ success: true }.
- Send a POST request to
Impact
- Aligns with the deprecation of
addRoute. - Ensures automatic OpenAPI specification generation.
- Maintains backward compatibility for clients using this endpoint.
Further Comments
This refactor improves maintainability and clarity of the API codebase. No breaking changes are introduced. All dependent tests and documentation have been reviewed.
Checklist
- I have read the Contributing Guide.
- I have signed the CLA.
- Lint and unit tests pass locally.
- I have added tests that prove my fix is effective.
- I have added necessary documentation.
- Any dependent changes have been merged and published in downstream modules.
Summary by CodeRabbit
-
Breaking Changes
- The public rooms.saveNotification API endpoint has been removed. Integrations using it must be updated to the new API surface.
-
Chore
- Server-side handling for saving per-room notification settings was reorganized; notification settings continue to be persisted as before.
Task: ARCH-2020
[COMM-144]