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:
@@ -5,14 +5,14 @@ import uuid
|
||||
|
||||
import pytest
|
||||
|
||||
from app.exceptions import (
|
||||
from app.modules.inventory.exceptions import (
|
||||
InsufficientInventoryException,
|
||||
InvalidQuantityException,
|
||||
InventoryNotFoundException,
|
||||
InventoryValidationException,
|
||||
ProductNotFoundException,
|
||||
)
|
||||
from app.services.inventory_service import InventoryService
|
||||
from app.modules.catalog.exceptions import ProductNotFoundException
|
||||
from app.modules.inventory.services.inventory_service import InventoryService
|
||||
from app.modules.inventory.models import Inventory
|
||||
from app.modules.inventory.schemas import (
|
||||
InventoryAdjust,
|
||||
@@ -126,7 +126,7 @@ class TestInventoryService:
|
||||
|
||||
def test_set_inventory_product_not_found(self, db, test_vendor):
|
||||
"""Test setting inventory for non-existent product raises exception."""
|
||||
from app.exceptions.base import ValidationException
|
||||
from app.exceptions import ValidationException
|
||||
|
||||
unique_id = str(uuid.uuid4())[:8].upper()
|
||||
inventory_data = InventoryCreate(
|
||||
@@ -203,7 +203,7 @@ class TestInventoryService:
|
||||
self, db, test_inventory, test_product, test_vendor
|
||||
):
|
||||
"""Test removing more than available raises exception."""
|
||||
from app.exceptions.base import ValidationException
|
||||
from app.exceptions import ValidationException
|
||||
|
||||
inventory_data = InventoryAdjust(
|
||||
product_id=test_product.id,
|
||||
@@ -251,7 +251,7 @@ class TestInventoryService:
|
||||
self, db, test_inventory, test_product, test_vendor
|
||||
):
|
||||
"""Test reserving more than available raises exception."""
|
||||
from app.exceptions.base import ValidationException
|
||||
from app.exceptions import ValidationException
|
||||
|
||||
available = test_inventory.quantity - test_inventory.reserved_quantity
|
||||
|
||||
@@ -335,7 +335,7 @@ class TestInventoryService:
|
||||
self, db, test_inventory, test_product, test_vendor
|
||||
):
|
||||
"""Test fulfilling more than quantity raises exception."""
|
||||
from app.exceptions.base import ValidationException
|
||||
from app.exceptions import ValidationException
|
||||
|
||||
reserve_data = InventoryReserve(
|
||||
product_id=test_product.id,
|
||||
@@ -401,7 +401,7 @@ class TestInventoryService:
|
||||
|
||||
def test_get_product_inventory_not_found(self, db, test_vendor):
|
||||
"""Test getting inventory for non-existent product raises exception."""
|
||||
from app.exceptions.base import ValidationException
|
||||
from app.exceptions import ValidationException
|
||||
|
||||
# Service wraps ProductNotFoundException in ValidationException
|
||||
with pytest.raises((ProductNotFoundException, ValidationException)):
|
||||
@@ -675,7 +675,7 @@ class TestInventoryService:
|
||||
|
||||
def test_get_vendor_inventory_admin_vendor_not_found(self, db):
|
||||
"""Test get_vendor_inventory_admin raises for non-existent vendor."""
|
||||
from app.exceptions import VendorNotFoundException
|
||||
from app.modules.tenancy.exceptions import VendorNotFoundException
|
||||
|
||||
with pytest.raises(VendorNotFoundException):
|
||||
self.service.get_vendor_inventory_admin(db, vendor_id=99999)
|
||||
@@ -700,7 +700,7 @@ class TestInventoryService:
|
||||
|
||||
def test_verify_vendor_exists_not_found(self, db):
|
||||
"""Test verify_vendor_exists raises for non-existent vendor."""
|
||||
from app.exceptions import VendorNotFoundException
|
||||
from app.modules.tenancy.exceptions import VendorNotFoundException
|
||||
|
||||
with pytest.raises(VendorNotFoundException):
|
||||
self.service.verify_vendor_exists(db, 99999)
|
||||
|
||||
Reference in New Issue
Block a user