feat: add marketplace products admin UI with copy-to-vendor functionality

- Add admin marketplace products page to browse imported products
- Add admin vendor products page to manage vendor catalog
- Add product detail pages for both marketplace and vendor products
- Implement copy-to-vendor API to copy marketplace products to vendor catalogs
- Add vendor product service with CRUD operations
- Update sidebar navigation with new product management links
- Add integration and unit tests for new endpoints and services

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-12 22:36:04 +01:00
parent 89c98cb645
commit 9c60989f1d
28 changed files with 4575 additions and 1414 deletions

View File

@@ -92,23 +92,22 @@ def other_user(db, auth_manager):
@pytest.fixture
def auth_headers(client, test_user):
"""Get authentication headers for test user"""
response = client.post(
"/api/v1/auth/login",
json={"username": test_user.username, "password": "testpass123"},
)
assert response.status_code == 200, f"Login failed: {response.text}"
token = response.json()["access_token"]
return {"Authorization": f"Bearer {token}"}
def auth_headers(test_user, auth_manager):
"""Get authentication headers for test user (non-admin).
Uses direct JWT generation to avoid vendor context requirement of shop login.
This is used for testing non-admin access to admin endpoints.
"""
token_data = auth_manager.create_access_token(user=test_user)
return {"Authorization": f"Bearer {token_data['access_token']}"}
@pytest.fixture
def admin_headers(client, test_admin):
"""Get authentication headers for admin user"""
response = client.post(
"/api/v1/auth/login",
json={"username": test_admin.username, "password": "adminpass123"},
"/api/v1/admin/auth/login",
json={"email_or_username": test_admin.username, "password": "adminpass123"},
)
assert response.status_code == 200, f"Admin login failed: {response.text}"
token = response.json()["access_token"]
@@ -137,8 +136,8 @@ def test_vendor_user(db, auth_manager):
def vendor_user_headers(client, test_vendor_user):
"""Get authentication headers for vendor user (uses get_current_vendor_api)"""
response = client.post(
"/api/v1/auth/login",
json={"username": test_vendor_user.username, "password": "vendorpass123"},
"/api/v1/vendor/auth/login",
json={"email_or_username": test_vendor_user.username, "password": "vendorpass123"},
)
assert response.status_code == 200, f"Vendor login failed: {response.text}"
token = response.json()["access_token"]