refactor: migrate templates and static files to self-contained modules

Templates Migration:
- Migrate admin templates to modules (tenancy, billing, monitoring, marketplace, etc.)
- Migrate vendor templates to modules (tenancy, billing, orders, messaging, etc.)
- Migrate storefront templates to modules (catalog, customers, orders, cart, checkout, cms)
- Migrate public templates to modules (billing, marketplace, cms)
- Keep shared templates in app/templates/ (base.html, errors/, partials/, macros/)
- Migrate letzshop partials to marketplace module

Static Files Migration:
- Migrate admin JS to modules: tenancy (23 files), core (5 files), monitoring (1 file)
- Migrate vendor JS to modules: tenancy (4 files), core (2 files)
- Migrate shared JS: vendor-selector.js to core, media-picker.js to cms
- Migrate storefront JS: storefront-layout.js to core
- Keep framework JS in static/ (api-client, utils, money, icons, log-config, lib/)
- Update all template references to use module_static paths

Naming Consistency:
- Rename static/platform/ to static/public/
- Rename app/templates/platform/ to app/templates/public/
- Update all extends and static references

Documentation:
- Update module-system.md with shared templates documentation
- Update frontend-structure.md with new module JS organization

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-01 14:34:16 +01:00
parent 843703258f
commit 4e28d91a78
542 changed files with 11603 additions and 9037 deletions

View File

@@ -6,8 +6,8 @@ from unittest.mock import MagicMock, patch
import pytest
from app.exceptions import VendorNotFoundException
from app.services.billing_service import (
from app.modules.tenancy.exceptions import VendorNotFoundException
from app.modules.billing.services.billing_service import (
BillingService,
NoActiveSubscriptionError,
PaymentSystemNotConfiguredError,
@@ -107,7 +107,7 @@ class TestBillingServiceCheckout:
"""Initialize service instance before each test."""
self.service = BillingService()
@patch("app.services.billing_service.stripe_service")
@patch("app.modules.billing.services.billing_service.stripe_service")
def test_create_checkout_session_stripe_not_configured(
self, mock_stripe, db, test_vendor, test_subscription_tier
):
@@ -124,7 +124,7 @@ class TestBillingServiceCheckout:
cancel_url="https://example.com/cancel",
)
@patch("app.services.billing_service.stripe_service")
@patch("app.modules.billing.services.billing_service.stripe_service")
def test_create_checkout_session_success(
self, mock_stripe, db, test_vendor, test_subscription_tier_with_stripe
):
@@ -147,7 +147,7 @@ class TestBillingServiceCheckout:
assert result["checkout_url"] == "https://checkout.stripe.com/test"
assert result["session_id"] == "cs_test_123"
@patch("app.services.billing_service.stripe_service")
@patch("app.modules.billing.services.billing_service.stripe_service")
def test_create_checkout_session_tier_not_found(
self, mock_stripe, db, test_vendor
):
@@ -164,7 +164,7 @@ class TestBillingServiceCheckout:
cancel_url="https://example.com/cancel",
)
@patch("app.services.billing_service.stripe_service")
@patch("app.modules.billing.services.billing_service.stripe_service")
def test_create_checkout_session_no_price(
self, mock_stripe, db, test_vendor, test_subscription_tier
):
@@ -191,7 +191,7 @@ class TestBillingServicePortal:
"""Initialize service instance before each test."""
self.service = BillingService()
@patch("app.services.billing_service.stripe_service")
@patch("app.modules.billing.services.billing_service.stripe_service")
def test_create_portal_session_stripe_not_configured(self, mock_stripe, db, test_vendor):
"""Test portal fails when Stripe not configured."""
mock_stripe.is_configured = False
@@ -203,7 +203,7 @@ class TestBillingServicePortal:
return_url="https://example.com/billing",
)
@patch("app.services.billing_service.stripe_service")
@patch("app.modules.billing.services.billing_service.stripe_service")
def test_create_portal_session_no_subscription(self, mock_stripe, db, test_vendor):
"""Test portal fails when no subscription exists."""
mock_stripe.is_configured = True
@@ -215,7 +215,7 @@ class TestBillingServicePortal:
return_url="https://example.com/billing",
)
@patch("app.services.billing_service.stripe_service")
@patch("app.modules.billing.services.billing_service.stripe_service")
def test_create_portal_session_success(
self, mock_stripe, db, test_vendor, test_active_subscription
):
@@ -313,7 +313,7 @@ class TestBillingServiceCancellation:
"""Initialize service instance before each test."""
self.service = BillingService()
@patch("app.services.billing_service.stripe_service")
@patch("app.modules.billing.services.billing_service.stripe_service")
def test_cancel_subscription_no_subscription(
self, mock_stripe, db, test_vendor
):
@@ -328,7 +328,7 @@ class TestBillingServiceCancellation:
immediately=False,
)
@patch("app.services.billing_service.stripe_service")
@patch("app.modules.billing.services.billing_service.stripe_service")
def test_cancel_subscription_success(
self, mock_stripe, db, test_vendor, test_active_subscription
):
@@ -346,7 +346,7 @@ class TestBillingServiceCancellation:
assert test_active_subscription.cancelled_at is not None
assert test_active_subscription.cancellation_reason == "Too expensive"
@patch("app.services.billing_service.stripe_service")
@patch("app.modules.billing.services.billing_service.stripe_service")
def test_reactivate_subscription_not_cancelled(
self, mock_stripe, db, test_vendor, test_active_subscription
):
@@ -356,7 +356,7 @@ class TestBillingServiceCancellation:
with pytest.raises(SubscriptionNotCancelledError):
self.service.reactivate_subscription(db, test_vendor.id)
@patch("app.services.billing_service.stripe_service")
@patch("app.modules.billing.services.billing_service.stripe_service")
def test_reactivate_subscription_success(
self, mock_stripe, db, test_vendor, test_cancelled_subscription
):