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:
38
app/modules/tenancy/exceptions.py
Normal file
38
app/modules/tenancy/exceptions.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# app/modules/tenancy/exceptions.py
|
||||
"""
|
||||
Tenancy module exceptions.
|
||||
|
||||
Exceptions for platform, company, vendor, and admin user management.
|
||||
"""
|
||||
|
||||
from app.exceptions import WizamartException
|
||||
|
||||
|
||||
class TenancyException(WizamartException):
|
||||
"""Base exception for tenancy module."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class VendorNotFoundException(TenancyException):
|
||||
"""Vendor not found or inactive."""
|
||||
|
||||
def __init__(self, vendor_code: str):
|
||||
super().__init__(f"Vendor '{vendor_code}' not found or inactive")
|
||||
self.vendor_code = vendor_code
|
||||
|
||||
|
||||
class CompanyNotFoundException(TenancyException):
|
||||
"""Company not found."""
|
||||
|
||||
def __init__(self, company_id: int):
|
||||
super().__init__(f"Company {company_id} not found")
|
||||
self.company_id = company_id
|
||||
|
||||
|
||||
class PlatformNotFoundException(TenancyException):
|
||||
"""Platform not found."""
|
||||
|
||||
def __init__(self, platform_id: int):
|
||||
super().__init__(f"Platform {platform_id} not found")
|
||||
self.platform_id = platform_id
|
||||
Reference in New Issue
Block a user