Skip to content

Migrate API routes to versioned router structure#39

Closed
TDxBruuno wants to merge 1 commit intomainfrom
feature/migrate-routes
Closed

Migrate API routes to versioned router structure#39
TDxBruuno wants to merge 1 commit intomainfrom
feature/migrate-routes

Conversation

@TDxBruuno
Copy link
Copy Markdown
Collaborator

Routing Structure Improvements:

  • Introduced a versioned API router (/api/v1) in app/api/routes/__init__.py, which includes the admin and documents routers for better route organization.
  • Added a base router in app/api/routes/base.py for global (non-versioned) routes such as the root endpoint and a health check.

Admin Endpoints:

  • Created a dedicated admin router in app/api/routes/admin.py with /admin/health and /admin/ping endpoints for administrative health checks.

Main Application Setup:

  • Updated main.py to include the new base and versioned routers, replacing direct inclusion of document routes and removing redundant root and health check endpoints. [1] [2] [3]

Copilot AI review requested due to automatic review settings December 16, 2025 00:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the API routing structure to introduce versioned endpoints (/api/v1) and separates global routes from versioned routes for better organization and maintainability.

Key Changes:

  • Introduced a versioned API router (/api/v1) that consolidates admin and document routes
  • Created a base router for non-versioned global endpoints (root and health check)
  • Added dedicated admin endpoints for health checks and ping operations

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
RAGManager/main.py Updated to include separate base and versioned API routers, removed inline root and health endpoints
RAGManager/app/api/routes/init.py Created versioned API router structure that includes admin and documents routers
RAGManager/app/api/routes/base.py Added base router with root and health check endpoints
RAGManager/app/api/routes/admin.py Created admin-specific endpoints for health and ping checks

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


@router.get("/health")
def health_check():
return {"message": "200 running..."}
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The health check message '200 running...' is inconsistent with similar endpoints. Consider using a more standardized response format like {\"status\": \"ok\"} to match the admin health endpoint pattern.

Suggested change
return {"message": "200 running..."}
return {"status": "ok"}

Copilot uses AI. Check for mistakes.
router = APIRouter(tags=["base"])

@router.get("/")
async def root():
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The root endpoint is defined as async but doesn't perform any async operations. Consider removing the async keyword for consistency with the health_check endpoint, or make health_check async for consistency.

Suggested change
async def root():
def root():

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown

🔍 PR Validation Results

Check Status
Build ✅ success
Trivy Check Security tab

View detailed results

Copy link
Copy Markdown
Collaborator

@Germanadjemian Germanadjemian left a comment

Choose a reason for hiding this comment

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

Duplicated endpoints in admin.py

@TDxBruuno TDxBruuno closed this Dec 17, 2025
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.

3 participants