refactor: move vendor info endpoint to tenancy module

MIGRATION:
- Move app/api/v1/vendor/info.py to app/modules/tenancy/routes/api/vendor.py
- Change endpoint path from GET /{vendor_code} to GET /info/{vendor_code}
- Remove catch-all route ordering dependency

TENANCY MODULE SETUP:
- Mark tenancy module as is_self_contained=True
- Add routes/api/vendor.py with vendor_router
- Add exceptions.py with TenancyException hierarchy
- Add placeholder __init__.py files for services, models, schemas

FRONTEND UPDATES:
- Update static/vendor/js/login.js to use new /vendor/info/{vendor_code} path
- Update static/vendor/js/init-alpine.js to use new /vendor/info/{vendor_code} path

The new path is more explicit and eliminates the need for catch-all route
ordering in the vendor router aggregation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-31 14:41:05 +01:00
parent 401db56258
commit 23d59492b7
11 changed files with 114 additions and 19 deletions

View File

@@ -24,6 +24,7 @@ Self-contained modules (auto-discovered from app/modules/{module}/routes/api/ven
- cms: Content pages management
- customers: Customer management
- payments: Payment configuration, Stripe connect, transactions
- tenancy: Public vendor info lookup
"""
from fastapi import APIRouter
@@ -34,7 +35,6 @@ from . import (
dashboard,
email_settings,
email_templates,
info,
media,
messages,
notifications,
@@ -51,10 +51,6 @@ router = APIRouter()
# ============================================================================
# These routes return JSON and are mounted at /api/v1/vendor/*
# IMPORTANT: Specific routes MUST be registered BEFORE catch-all routes
# The info.router has GET /{vendor_code} which catches everything,
# so it must be registered LAST
# Authentication (no prefix, specific routes like /auth/login)
router.include_router(auth.router, tags=["vendor-auth"])
@@ -98,7 +94,4 @@ for route_info in get_vendor_api_routes():
)
# Vendor info endpoint - MUST BE LAST! Has catch-all GET /{vendor_code}
router.include_router(info.router, tags=["vendor-info"])
__all__ = ["router"]