feat(arch): add API-007 rule to enforce layered architecture
Add architecture rule that detects when API routes import database models directly, enforcing Routes → Services → Models pattern. Changes: - Add API-007 rule to .architecture-rules/api.yaml - Add _check_no_model_imports() validation to validator script - Update customer imports to use canonical module location - Add storefront module restructure implementation plan The validator now detects 81 violations across 67 API files where database models are imported directly instead of going through services. This is Phase 1 of the storefront restructure plan. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2
tests/fixtures/customer_fixtures.py
vendored
2
tests/fixtures/customer_fixtures.py
vendored
@@ -8,7 +8,7 @@ See tests/conftest.py for details on fixture best practices.
|
||||
|
||||
import pytest
|
||||
|
||||
from models.database.customer import Customer, CustomerAddress
|
||||
from app.modules.customers.models.customer import Customer, CustomerAddress
|
||||
from models.database.order import Order
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ from unittest.mock import patch
|
||||
import pytest
|
||||
from jose import jwt
|
||||
|
||||
from models.database.customer import Customer, CustomerAddress
|
||||
from app.modules.customers.models.customer import Customer, CustomerAddress
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
@@ -12,7 +12,7 @@ from unittest.mock import patch, MagicMock
|
||||
import pytest
|
||||
from jose import jwt
|
||||
|
||||
from models.database.customer import Customer
|
||||
from app.modules.customers.models.customer import Customer
|
||||
from models.database.invoice import Invoice, InvoiceStatus, VendorInvoiceSettings
|
||||
from models.database.order import Order, OrderItem
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from models.database.customer import Customer
|
||||
from app.modules.customers.models.customer import Customer
|
||||
from models.database.password_reset_token import PasswordResetToken
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from decimal import Decimal
|
||||
|
||||
import pytest
|
||||
|
||||
from models.database.customer import Customer
|
||||
from app.modules.customers.models.customer import Customer
|
||||
from models.database.invoice import Invoice, InvoiceStatus, VendorInvoiceSettings
|
||||
from models.database.order import Order
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from models.database.customer import Customer, CustomerAddress
|
||||
from app.modules.customers.models.customer import Customer, CustomerAddress
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
|
||||
@@ -9,7 +9,7 @@ import pytest
|
||||
|
||||
from app.exceptions.customer import CustomerNotFoundException
|
||||
from app.services.admin_customer_service import AdminCustomerService
|
||||
from models.database.customer import Customer
|
||||
from app.modules.customers.models.customer import Customer
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
@@ -7,7 +7,7 @@ import pytest
|
||||
|
||||
from app.exceptions import AddressLimitExceededException, AddressNotFoundException
|
||||
from app.services.customer_address_service import CustomerAddressService
|
||||
from models.database.customer import CustomerAddress
|
||||
from app.modules.customers.models.customer import CustomerAddress
|
||||
from models.schema.customer import CustomerAddressCreate, CustomerAddressUpdate
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ from app.services.order_service import (
|
||||
OrderService,
|
||||
order_service,
|
||||
)
|
||||
from models.database.customer import Customer
|
||||
from app.modules.customers.models.customer import Customer
|
||||
from models.database.order import Order, OrderItem
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user