Skip to content

Comprehensive audit and synchronization of the Rythmify OpenAPI - #191

Merged
Ahmedattay merged 3 commits into
developmentfrom
M8-discovery-search-feed
May 2, 2026
Merged

Ahmedattay merged 3 commits into
developmentfrom
M8-discovery-search-feed

Conversation

@OmarHamza22

Copy link
Copy Markdown
Contributor

PR Overview

This PR performs a comprehensive audit and synchronization of the Rythmify OpenAPI 3.0.3 specification (openapi.yaml) against the actual backend implementation. The goal was to establish the source code as the single source of truth and eliminate discrepancies that cause frontend integration issues.

Key Changes

🛠 Path & Route Fixes

  • Renamed /feed/discover to /feed/discovery: Aligned with the actual route defined in feed.routes.js.
  • Renamed /search/suggestions to /suggestions: Corrected the path to match its mount point at the API root (/api/v1/suggestions).
  • Added Missing Endpoints:
    • GitHub OAuth: Documented the redirect and callback endpoints for GitHub authentication.
    • Account Deletion: Added DELETE /auth/me (requires password confirmation).
    • User UUID Lookup: Added the /users/by-id/{user_id} alias used for public profile fetching.

🔐 Security & Logic Alignment

  • Feed Authentication: Updated the Activity and Discovery feeds to reflect mandatory authentication (previously incorrectly documented as public-access).
  • Pagination Refactor: Replaced offset-based pagination with cursor-based pagination for both feed endpoints to match the controller and service layer logic.
  • Schema Synchronization: Introduced the CursorFeedResponse schema to accurately describe the response envelope: { data, hasMore, nextCursor, message }.

Verification Results

  • Route Audit: 100% of the src/routes/ directory was manually cross-referenced with the YAML file.
  • Schema Check: Response shapes for key modules (Auth, Feed, Users) were verified against api-response.js utility and controller outputs.
  • Path Mapping: Base prefixes (e.g., /api/v1/auth vs root mounts) were validated via app.js.

implemented the POST /auth/check-email endpoint in the OpenAPI specification.
This endpoint allows the frontend to check if an email address is already registered before proceeding with registration.
Included the request schema for the email field and the response schema for the exists boolean.
This commit aligns the `openapi.yaml` specification with the actual implementation in the Node.js backend based on a comprehensive source-code audit.

**Key Changes:**
- **Path Corrections**: Fixed discrepancies where spec paths did not match route mounts:
    - `/feed/discover` → `/feed/discovery`
    - `/search/suggestions` → `/suggestions`
- **Missing Endpoints**: Documented endpoints that were implemented in the backend but missing from the spec:
    - **GitHub OAuth**: Added `/auth/oauth/github` and its callback.
    - **Account Deletion**: Added `DELETE /auth/me` with password confirmation.
    - **User Lookup**: Added `/users/by-id/{user_id}` alias path.
- **Authentication & Pagination Sync**:
    - Updated `/feed` and `/feed/discovery` to reflect mandatory authentication (previously marked as optional/public).
    - Switched feed endpoints from `offset` to `cursor`-based pagination to match controller logic.
    - Added `CursorFeedResponse` schema to align with the actual response shape: `{ data, hasMore, nextCursor, message }`.
- **Audit Housekeeping**:
    - Cataloged and marked legacy or spec-only routes (e.g., SoundCloud OAuth, `/notifications/read-all`) as `#
@OmarHamza22
OmarHamza22 requested a review from a team as a code owner May 2, 2026 13:30
@Ahmedattay
Ahmedattay merged commit b1bbbf3 into development May 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants