Files
orion/models/database/__init__.py
Samir Boulahtit d6d658dd85 feat: add order item exception system for graceful product matching
Replaces the "fail on missing product" behavior with graceful handling:
- Orders import even when products aren't found by GTIN
- Unmatched items link to a per-vendor placeholder product
- Exceptions tracked in order_item_exceptions table for QC resolution
- Order confirmation blocked until exceptions are resolved
- Auto-matching when products are imported via catalog sync

New files:
- OrderItemException model and migration
- OrderItemExceptionService with CRUD and resolution logic
- Admin and vendor API endpoints for exception management
- Domain exceptions for error handling

Modified:
- OrderItem: added needs_product_match flag and exception relationship
- OrderService: graceful handling with placeholder products
- MarketplaceProductService: auto-match on product import
- Letzshop confirm endpoints: blocking check for unresolved exceptions

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 13:11:47 +01:00

100 lines
2.3 KiB
Python

# models/database/__init__.py
"""Database models package."""
from .admin import (
AdminAuditLog,
AdminNotification,
AdminSession,
AdminSetting,
PlatformAlert,
)
from .architecture_scan import (
ArchitectureScan,
ArchitectureViolation,
ViolationAssignment,
ViolationComment,
)
from .base import Base
from .company import Company
from .content_page import ContentPage
from .customer import Customer, CustomerAddress
from .inventory import Inventory
from .letzshop import (
LetzshopFulfillmentQueue,
LetzshopHistoricalImportJob,
LetzshopSyncLog,
VendorLetzshopCredentials,
)
from .marketplace_import_job import MarketplaceImportError, MarketplaceImportJob
from .marketplace_product import (
DigitalDeliveryMethod,
MarketplaceProduct,
ProductType,
)
from .marketplace_product_translation import MarketplaceProductTranslation
from .order import Order, OrderItem
from .order_item_exception import OrderItemException
from .product import Product
from .product_translation import ProductTranslation
from .test_run import TestCollection, TestResult, TestRun
from .user import User
from .vendor import Role, Vendor, VendorUser
from .vendor_domain import VendorDomain
from .vendor_theme import VendorTheme
__all__ = [
# Admin-specific models
"AdminAuditLog",
"AdminNotification",
"AdminSetting",
"PlatformAlert",
"AdminSession",
# Architecture/Code Quality
"ArchitectureScan",
"ArchitectureViolation",
"ViolationAssignment",
"ViolationComment",
# Test Runs
"TestRun",
"TestResult",
"TestCollection",
# Base
"Base",
# User & Auth
"User",
# Company & Vendor
"Company",
"Vendor",
"VendorUser",
"Role",
"VendorDomain",
"VendorTheme",
# Content
"ContentPage",
# Customer
"Customer",
"CustomerAddress",
# Product - Enums
"ProductType",
"DigitalDeliveryMethod",
# Product - Models
"MarketplaceProduct",
"MarketplaceProductTranslation",
"Product",
"ProductTranslation",
# Import
"MarketplaceImportJob",
"MarketplaceImportError",
# Inventory
"Inventory",
# Orders
"Order",
"OrderItem",
"OrderItemException",
# Letzshop Integration
"VendorLetzshopCredentials",
"LetzshopFulfillmentQueue",
"LetzshopSyncLog",
"LetzshopHistoricalImportJob",
]