fix(loyalty): route prefix, module migrations, and wallet barcode tests
- Fix 404 on /admin/loyalty/* and /vendor/loyalty/* by applying ROUTE_CONFIG custom_prefix when registering page routers in main.py (admin, vendor, and storefront registrations all updated) - Move loyalty alembic migrations from central alembic/versions/ into app/modules/loyalty/migrations/versions/ with proper naming convention - Add migrations_path="migrations" to loyalty module definition so the auto-discovery system finds them - Add unit tests for Apple/Google Wallet Code 128 barcode configuration (6 Apple tests, 4 Google tests) - Add integration tests for module migration auto-discovery (4 tests) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
18
main.py
18
main.py
@@ -349,10 +349,11 @@ admin_page_routes = get_admin_page_routes()
|
||||
logger.info(f" Found {len(admin_page_routes)} admin page route modules")
|
||||
|
||||
for route_info in admin_page_routes:
|
||||
logger.info(f" Registering {route_info.module_code} admin pages")
|
||||
prefix = f"/admin{route_info.custom_prefix}" if route_info.custom_prefix else "/admin"
|
||||
logger.info(f" Registering {route_info.module_code} admin pages at {prefix}")
|
||||
app.include_router(
|
||||
route_info.router,
|
||||
prefix="/admin",
|
||||
prefix=prefix,
|
||||
tags=route_info.tags,
|
||||
include_in_schema=route_info.include_in_schema,
|
||||
)
|
||||
@@ -365,10 +366,11 @@ vendor_page_routes = get_vendor_page_routes()
|
||||
logger.info(f" Found {len(vendor_page_routes)} vendor page route modules")
|
||||
|
||||
for route_info in vendor_page_routes:
|
||||
logger.info(f" Registering {route_info.module_code} vendor pages (priority={route_info.priority})")
|
||||
prefix = f"/vendor{route_info.custom_prefix}" if route_info.custom_prefix else "/vendor"
|
||||
logger.info(f" Registering {route_info.module_code} vendor pages at {prefix} (priority={route_info.priority})")
|
||||
app.include_router(
|
||||
route_info.router,
|
||||
prefix="/vendor",
|
||||
prefix=prefix,
|
||||
tags=route_info.tags,
|
||||
include_in_schema=route_info.include_in_schema,
|
||||
)
|
||||
@@ -386,10 +388,11 @@ logger.info(f" Found {len(storefront_page_routes)} storefront page route module
|
||||
# Register at /storefront/* (direct access)
|
||||
logger.info(" Registering storefront routes at /storefront/*")
|
||||
for route_info in storefront_page_routes:
|
||||
logger.info(f" - {route_info.module_code} (priority={route_info.priority})")
|
||||
prefix = f"/storefront{route_info.custom_prefix}" if route_info.custom_prefix else "/storefront"
|
||||
logger.info(f" - {route_info.module_code} at {prefix} (priority={route_info.priority})")
|
||||
app.include_router(
|
||||
route_info.router,
|
||||
prefix="/storefront",
|
||||
prefix=prefix,
|
||||
tags=["storefront-pages"],
|
||||
include_in_schema=False,
|
||||
)
|
||||
@@ -397,9 +400,10 @@ for route_info in storefront_page_routes:
|
||||
# Register at /vendors/{code}/storefront/* (path-based development mode)
|
||||
logger.info(" Registering storefront routes at /vendors/{code}/storefront/*")
|
||||
for route_info in storefront_page_routes:
|
||||
prefix = f"/vendors/{{vendor_code}}/storefront{route_info.custom_prefix}" if route_info.custom_prefix else "/vendors/{vendor_code}/storefront"
|
||||
app.include_router(
|
||||
route_info.router,
|
||||
prefix="/vendors/{vendor_code}/storefront",
|
||||
prefix=prefix,
|
||||
tags=["storefront-pages"],
|
||||
include_in_schema=False,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user