feat: add Letzshop vendor directory with sync and admin management

- Add LetzshopVendorCache model to store cached vendor data from Letzshop API
- Create LetzshopVendorSyncService for syncing vendor directory
- Add Celery task for background vendor sync
- Create admin page at /admin/letzshop/vendor-directory with:
  - Stats dashboard (total, claimed, unclaimed vendors)
  - Searchable/filterable vendor list
  - "Sync Now" button to trigger sync
  - Ability to create platform vendors from Letzshop cache
- Add API endpoints for vendor directory management
- Add Pydantic schemas for API responses

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-13 20:35:46 +01:00
parent 78b14a4b00
commit ccfbbcb804
13 changed files with 2571 additions and 46 deletions

View File

@@ -49,6 +49,7 @@ from app.api.deps import (
get_current_admin_optional,
get_db,
)
from app.core.config import settings
from models.database.user import User
router = APIRouter()
@@ -660,6 +661,7 @@ async def admin_background_tasks_page(
{
"request": request,
"user": current_user,
"flower_url": settings.flower_url,
},
)
@@ -760,6 +762,38 @@ async def admin_letzshop_product_detail_page(
)
# ============================================================================
# LETZSHOP VENDOR DIRECTORY
# ============================================================================
@router.get(
"/letzshop/vendor-directory",
response_class=HTMLResponse,
include_in_schema=False,
)
async def admin_letzshop_vendor_directory_page(
request: Request,
current_user: User = Depends(get_current_admin_from_cookie_or_header),
db: Session = Depends(get_db),
):
"""
Render Letzshop vendor directory management page.
Allows admins to:
- View cached Letzshop vendors
- Trigger manual sync from Letzshop API
- Create platform vendors from cached Letzshop vendors
"""
return templates.TemplateResponse(
"admin/letzshop-vendor-directory.html",
{
"request": request,
"user": current_user,
},
)
# ============================================================================
# PRODUCT CATALOG ROUTES
# ============================================================================