refactor: delete legacy re-export files for migrated modules
All imports have been updated to use canonical module locations. Delete 15 legacy re-export files that are no longer needed: Database models (7 files): - models/database/order.py - models/database/inventory.py - models/database/inventory_transaction.py - models/database/message.py - models/database/invoice.py - models/database/order_item_exception.py - models/database/password_reset_token.py Schema models (8 files): - models/schema/customer.py - models/schema/order.py - models/schema/order_item_exception.py - models/schema/inventory.py - models/schema/message.py - models/schema/invoice.py - models/schema/notification.py - models/schema/stats.py Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
# models/database/inventory.py
|
||||
"""
|
||||
LEGACY LOCATION - Re-exports from module for backwards compatibility.
|
||||
|
||||
The canonical implementation is now in:
|
||||
app/modules/inventory/models/inventory.py
|
||||
|
||||
This file exists to maintain backwards compatibility with code that
|
||||
imports from the old location. All new code should import directly
|
||||
from the module:
|
||||
|
||||
from app.modules.inventory.models import Inventory
|
||||
"""
|
||||
|
||||
from app.modules.inventory.models.inventory import Inventory
|
||||
|
||||
__all__ = [
|
||||
"Inventory",
|
||||
]
|
||||
@@ -1,23 +0,0 @@
|
||||
# models/database/inventory_transaction.py
|
||||
"""
|
||||
LEGACY LOCATION - Re-exports from module for backwards compatibility.
|
||||
|
||||
The canonical implementation is now in:
|
||||
app/modules/inventory/models/inventory_transaction.py
|
||||
|
||||
This file exists to maintain backwards compatibility with code that
|
||||
imports from the old location. All new code should import directly
|
||||
from the module:
|
||||
|
||||
from app.modules.inventory.models import InventoryTransaction, TransactionType
|
||||
"""
|
||||
|
||||
from app.modules.inventory.models.inventory_transaction import (
|
||||
InventoryTransaction,
|
||||
TransactionType,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"InventoryTransaction",
|
||||
"TransactionType",
|
||||
]
|
||||
@@ -1,27 +0,0 @@
|
||||
# models/database/invoice.py
|
||||
"""
|
||||
LEGACY LOCATION - Re-exports from module for backwards compatibility.
|
||||
|
||||
The canonical implementation is now in:
|
||||
app/modules/orders/models/invoice.py
|
||||
|
||||
This file exists to maintain backwards compatibility with code that
|
||||
imports from the old location. All new code should import directly
|
||||
from the module:
|
||||
|
||||
from app.modules.orders.models import Invoice, InvoiceStatus, VATRegime, VendorInvoiceSettings
|
||||
"""
|
||||
|
||||
from app.modules.orders.models.invoice import (
|
||||
Invoice,
|
||||
InvoiceStatus,
|
||||
VATRegime,
|
||||
VendorInvoiceSettings,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"Invoice",
|
||||
"InvoiceStatus",
|
||||
"VATRegime",
|
||||
"VendorInvoiceSettings",
|
||||
]
|
||||
@@ -1,31 +0,0 @@
|
||||
# models/database/message.py
|
||||
"""
|
||||
LEGACY LOCATION - Re-exports from module for backwards compatibility.
|
||||
|
||||
The canonical implementation is now in:
|
||||
app/modules/messaging/models/message.py
|
||||
|
||||
This file exists to maintain backwards compatibility with code that
|
||||
imports from the old location. All new code should import directly
|
||||
from the module:
|
||||
|
||||
from app.modules.messaging.models import message
|
||||
"""
|
||||
|
||||
from app.modules.messaging.models.message import (
|
||||
Conversation,
|
||||
ConversationParticipant,
|
||||
ConversationType,
|
||||
Message,
|
||||
MessageAttachment,
|
||||
ParticipantType,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"Conversation",
|
||||
"ConversationParticipant",
|
||||
"ConversationType",
|
||||
"Message",
|
||||
"MessageAttachment",
|
||||
"ParticipantType",
|
||||
]
|
||||
@@ -1,20 +0,0 @@
|
||||
# models/database/order.py
|
||||
"""
|
||||
LEGACY LOCATION - Re-exports from module for backwards compatibility.
|
||||
|
||||
The canonical implementation is now in:
|
||||
app/modules/orders/models/order.py
|
||||
|
||||
This file exists to maintain backwards compatibility with code that
|
||||
imports from the old location. All new code should import directly
|
||||
from the module:
|
||||
|
||||
from app.modules.orders.models import Order, OrderItem
|
||||
"""
|
||||
|
||||
from app.modules.orders.models.order import Order, OrderItem
|
||||
|
||||
__all__ = [
|
||||
"Order",
|
||||
"OrderItem",
|
||||
]
|
||||
@@ -1,19 +0,0 @@
|
||||
# models/database/order_item_exception.py
|
||||
"""
|
||||
LEGACY LOCATION - Re-exports from module for backwards compatibility.
|
||||
|
||||
The canonical implementation is now in:
|
||||
app/modules/orders/models/order_item_exception.py
|
||||
|
||||
This file exists to maintain backwards compatibility with code that
|
||||
imports from the old location. All new code should import directly
|
||||
from the module:
|
||||
|
||||
from app.modules.orders.models import OrderItemException
|
||||
"""
|
||||
|
||||
from app.modules.orders.models.order_item_exception import OrderItemException
|
||||
|
||||
__all__ = [
|
||||
"OrderItemException",
|
||||
]
|
||||
@@ -1,19 +0,0 @@
|
||||
# models/database/password_reset_token.py
|
||||
"""
|
||||
LEGACY LOCATION - Re-exports from module for backwards compatibility.
|
||||
|
||||
The canonical implementation is now in:
|
||||
app/modules/customers/models/password_reset_token.py
|
||||
|
||||
This file exists to maintain backwards compatibility with code that
|
||||
imports from the old location. All new code should import directly
|
||||
from the module:
|
||||
|
||||
from app.modules.customers.models import PasswordResetToken
|
||||
"""
|
||||
|
||||
from app.modules.customers.models.password_reset_token import PasswordResetToken
|
||||
|
||||
__all__ = [
|
||||
"PasswordResetToken",
|
||||
]
|
||||
@@ -1,69 +0,0 @@
|
||||
# models/schema/customer.py
|
||||
"""
|
||||
LEGACY LOCATION - Re-exports from module for backwards compatibility.
|
||||
|
||||
The canonical implementation is now in:
|
||||
app/modules/customers/schemas/customer.py
|
||||
|
||||
This file exists to maintain backwards compatibility with code that
|
||||
imports from the old location. All new code should import directly
|
||||
from the module:
|
||||
|
||||
from app.modules.customers.schemas import CustomerRegister, CustomerResponse
|
||||
"""
|
||||
|
||||
from app.modules.customers.schemas.customer import (
|
||||
# Registration & Authentication
|
||||
CustomerRegister,
|
||||
CustomerUpdate,
|
||||
CustomerPasswordChange,
|
||||
# Customer Response
|
||||
CustomerResponse,
|
||||
CustomerListResponse,
|
||||
# Address
|
||||
CustomerAddressCreate,
|
||||
CustomerAddressUpdate,
|
||||
CustomerAddressResponse,
|
||||
CustomerAddressListResponse,
|
||||
# Preferences
|
||||
CustomerPreferencesUpdate,
|
||||
# Vendor Management
|
||||
CustomerMessageResponse,
|
||||
VendorCustomerListResponse,
|
||||
CustomerDetailResponse,
|
||||
CustomerOrderInfo,
|
||||
CustomerOrdersResponse,
|
||||
CustomerStatisticsResponse,
|
||||
# Admin Management
|
||||
AdminCustomerItem,
|
||||
AdminCustomerListResponse,
|
||||
AdminCustomerDetailResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
# Registration & Authentication
|
||||
"CustomerRegister",
|
||||
"CustomerUpdate",
|
||||
"CustomerPasswordChange",
|
||||
# Customer Response
|
||||
"CustomerResponse",
|
||||
"CustomerListResponse",
|
||||
# Address
|
||||
"CustomerAddressCreate",
|
||||
"CustomerAddressUpdate",
|
||||
"CustomerAddressResponse",
|
||||
"CustomerAddressListResponse",
|
||||
# Preferences
|
||||
"CustomerPreferencesUpdate",
|
||||
# Vendor Management
|
||||
"CustomerMessageResponse",
|
||||
"VendorCustomerListResponse",
|
||||
"CustomerDetailResponse",
|
||||
"CustomerOrderInfo",
|
||||
"CustomerOrdersResponse",
|
||||
"CustomerStatisticsResponse",
|
||||
# Admin Management
|
||||
"AdminCustomerItem",
|
||||
"AdminCustomerListResponse",
|
||||
"AdminCustomerDetailResponse",
|
||||
]
|
||||
@@ -1,85 +0,0 @@
|
||||
# models/schema/inventory.py
|
||||
"""
|
||||
LEGACY LOCATION - Re-exports from module for backwards compatibility.
|
||||
|
||||
The canonical implementation is now in:
|
||||
app/modules/inventory/schemas/inventory.py
|
||||
|
||||
This file exists to maintain backwards compatibility with code that
|
||||
imports from the old location. All new code should import directly
|
||||
from the module:
|
||||
|
||||
from app.modules.inventory.schemas import InventoryCreate, InventoryResponse
|
||||
"""
|
||||
|
||||
from app.modules.inventory.schemas.inventory import (
|
||||
# Base schemas
|
||||
InventoryBase,
|
||||
InventoryCreate,
|
||||
InventoryAdjust,
|
||||
InventoryUpdate,
|
||||
InventoryReserve,
|
||||
# Response schemas
|
||||
InventoryResponse,
|
||||
InventoryLocationResponse,
|
||||
ProductInventorySummary,
|
||||
InventoryListResponse,
|
||||
InventoryMessageResponse,
|
||||
InventorySummaryResponse,
|
||||
# Admin schemas
|
||||
AdminInventoryCreate,
|
||||
AdminInventoryAdjust,
|
||||
AdminInventoryItem,
|
||||
AdminInventoryListResponse,
|
||||
AdminInventoryStats,
|
||||
AdminLowStockItem,
|
||||
AdminVendorWithInventory,
|
||||
AdminVendorsWithInventoryResponse,
|
||||
AdminInventoryLocationsResponse,
|
||||
# Transaction schemas
|
||||
InventoryTransactionResponse,
|
||||
InventoryTransactionWithProduct,
|
||||
InventoryTransactionListResponse,
|
||||
ProductTransactionHistoryResponse,
|
||||
OrderTransactionHistoryResponse,
|
||||
# Admin transaction schemas
|
||||
AdminInventoryTransactionItem,
|
||||
AdminInventoryTransactionListResponse,
|
||||
AdminTransactionStatsResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
# Base schemas
|
||||
"InventoryBase",
|
||||
"InventoryCreate",
|
||||
"InventoryAdjust",
|
||||
"InventoryUpdate",
|
||||
"InventoryReserve",
|
||||
# Response schemas
|
||||
"InventoryResponse",
|
||||
"InventoryLocationResponse",
|
||||
"ProductInventorySummary",
|
||||
"InventoryListResponse",
|
||||
"InventoryMessageResponse",
|
||||
"InventorySummaryResponse",
|
||||
# Admin schemas
|
||||
"AdminInventoryCreate",
|
||||
"AdminInventoryAdjust",
|
||||
"AdminInventoryItem",
|
||||
"AdminInventoryListResponse",
|
||||
"AdminInventoryStats",
|
||||
"AdminLowStockItem",
|
||||
"AdminVendorWithInventory",
|
||||
"AdminVendorsWithInventoryResponse",
|
||||
"AdminInventoryLocationsResponse",
|
||||
# Transaction schemas
|
||||
"InventoryTransactionResponse",
|
||||
"InventoryTransactionWithProduct",
|
||||
"InventoryTransactionListResponse",
|
||||
"ProductTransactionHistoryResponse",
|
||||
"OrderTransactionHistoryResponse",
|
||||
# Admin transaction schemas
|
||||
"AdminInventoryTransactionItem",
|
||||
"AdminInventoryTransactionListResponse",
|
||||
"AdminTransactionStatsResponse",
|
||||
]
|
||||
@@ -1,61 +0,0 @@
|
||||
# models/schema/invoice.py
|
||||
"""
|
||||
LEGACY LOCATION - Re-exports from module for backwards compatibility.
|
||||
|
||||
The canonical implementation is now in:
|
||||
app/modules/orders/schemas/invoice.py
|
||||
|
||||
This file exists to maintain backwards compatibility with code that
|
||||
imports from the old location. All new code should import directly
|
||||
from the module:
|
||||
|
||||
from app.modules.orders.schemas import invoice
|
||||
"""
|
||||
|
||||
from app.modules.orders.schemas.invoice import (
|
||||
# Invoice settings schemas
|
||||
VendorInvoiceSettingsCreate,
|
||||
VendorInvoiceSettingsUpdate,
|
||||
VendorInvoiceSettingsResponse,
|
||||
# Line item schemas
|
||||
InvoiceLineItem,
|
||||
InvoiceLineItemResponse,
|
||||
# Address schemas
|
||||
InvoiceSellerDetails,
|
||||
InvoiceBuyerDetails,
|
||||
# Invoice CRUD schemas
|
||||
InvoiceCreate,
|
||||
InvoiceManualCreate,
|
||||
InvoiceResponse,
|
||||
InvoiceListResponse,
|
||||
InvoiceStatusUpdate,
|
||||
# Pagination
|
||||
InvoiceListPaginatedResponse,
|
||||
# PDF
|
||||
InvoicePDFGeneratedResponse,
|
||||
InvoiceStatsResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
# Invoice settings schemas
|
||||
"VendorInvoiceSettingsCreate",
|
||||
"VendorInvoiceSettingsUpdate",
|
||||
"VendorInvoiceSettingsResponse",
|
||||
# Line item schemas
|
||||
"InvoiceLineItem",
|
||||
"InvoiceLineItemResponse",
|
||||
# Address schemas
|
||||
"InvoiceSellerDetails",
|
||||
"InvoiceBuyerDetails",
|
||||
# Invoice CRUD schemas
|
||||
"InvoiceCreate",
|
||||
"InvoiceManualCreate",
|
||||
"InvoiceResponse",
|
||||
"InvoiceListResponse",
|
||||
"InvoiceStatusUpdate",
|
||||
# Pagination
|
||||
"InvoiceListPaginatedResponse",
|
||||
# PDF
|
||||
"InvoicePDFGeneratedResponse",
|
||||
"InvoiceStatsResponse",
|
||||
]
|
||||
@@ -1,83 +0,0 @@
|
||||
# models/schema/message.py
|
||||
"""
|
||||
LEGACY LOCATION - Re-exports from module for backwards compatibility.
|
||||
|
||||
The canonical implementation is now in:
|
||||
app/modules/messaging/schemas/message.py
|
||||
|
||||
This file exists to maintain backwards compatibility with code that
|
||||
imports from the old location. All new code should import directly
|
||||
from the module:
|
||||
|
||||
from app.modules.messaging.schemas import message
|
||||
"""
|
||||
|
||||
from app.modules.messaging.schemas.message import (
|
||||
# Attachment schemas
|
||||
AttachmentResponse,
|
||||
# Message schemas
|
||||
MessageCreate,
|
||||
MessageResponse,
|
||||
# Participant schemas
|
||||
ParticipantInfo,
|
||||
ParticipantResponse,
|
||||
# Conversation schemas
|
||||
ConversationCreate,
|
||||
ConversationSummary,
|
||||
ConversationDetailResponse,
|
||||
ConversationListResponse,
|
||||
ConversationResponse,
|
||||
# Unread count
|
||||
UnreadCountResponse,
|
||||
# Notification preferences
|
||||
NotificationPreferencesUpdate,
|
||||
# Conversation actions
|
||||
CloseConversationResponse,
|
||||
ReopenConversationResponse,
|
||||
MarkReadResponse,
|
||||
# Recipient selection
|
||||
RecipientOption,
|
||||
RecipientListResponse,
|
||||
# Admin schemas
|
||||
AdminConversationSummary,
|
||||
AdminConversationListResponse,
|
||||
AdminMessageStats,
|
||||
)
|
||||
|
||||
# Re-export enums from models for backward compatibility
|
||||
from app.modules.messaging.models.message import ConversationType, ParticipantType
|
||||
|
||||
__all__ = [
|
||||
# Attachment schemas
|
||||
"AttachmentResponse",
|
||||
# Message schemas
|
||||
"MessageCreate",
|
||||
"MessageResponse",
|
||||
# Participant schemas
|
||||
"ParticipantInfo",
|
||||
"ParticipantResponse",
|
||||
# Conversation schemas
|
||||
"ConversationCreate",
|
||||
"ConversationSummary",
|
||||
"ConversationDetailResponse",
|
||||
"ConversationListResponse",
|
||||
"ConversationResponse",
|
||||
# Unread count
|
||||
"UnreadCountResponse",
|
||||
# Notification preferences
|
||||
"NotificationPreferencesUpdate",
|
||||
# Conversation actions
|
||||
"CloseConversationResponse",
|
||||
"ReopenConversationResponse",
|
||||
"MarkReadResponse",
|
||||
# Recipient selection
|
||||
"RecipientOption",
|
||||
"RecipientListResponse",
|
||||
# Admin schemas
|
||||
"AdminConversationSummary",
|
||||
"AdminConversationListResponse",
|
||||
"AdminMessageStats",
|
||||
# Enums
|
||||
"ConversationType",
|
||||
"ParticipantType",
|
||||
]
|
||||
@@ -1,53 +0,0 @@
|
||||
# models/schema/notification.py
|
||||
"""
|
||||
LEGACY LOCATION - Re-exports from module for backwards compatibility.
|
||||
|
||||
The canonical implementation is now in:
|
||||
app/modules/messaging/schemas/notification.py
|
||||
|
||||
This file exists to maintain backwards compatibility with code that
|
||||
imports from the old location. All new code should import directly
|
||||
from the module:
|
||||
|
||||
from app.modules.messaging.schemas import notification
|
||||
"""
|
||||
|
||||
from app.modules.messaging.schemas.notification import (
|
||||
# Response schemas
|
||||
MessageResponse,
|
||||
UnreadCountResponse,
|
||||
# Notification schemas
|
||||
NotificationResponse,
|
||||
NotificationListResponse,
|
||||
# Settings schemas
|
||||
NotificationSettingsResponse,
|
||||
NotificationSettingsUpdate,
|
||||
# Template schemas
|
||||
NotificationTemplateResponse,
|
||||
NotificationTemplateListResponse,
|
||||
NotificationTemplateUpdate,
|
||||
# Test notification
|
||||
TestNotificationRequest,
|
||||
# Alert statistics
|
||||
AlertStatisticsResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
# Response schemas
|
||||
"MessageResponse",
|
||||
"UnreadCountResponse",
|
||||
# Notification schemas
|
||||
"NotificationResponse",
|
||||
"NotificationListResponse",
|
||||
# Settings schemas
|
||||
"NotificationSettingsResponse",
|
||||
"NotificationSettingsUpdate",
|
||||
# Template schemas
|
||||
"NotificationTemplateResponse",
|
||||
"NotificationTemplateListResponse",
|
||||
"NotificationTemplateUpdate",
|
||||
# Test notification
|
||||
"TestNotificationRequest",
|
||||
# Alert statistics
|
||||
"AlertStatisticsResponse",
|
||||
]
|
||||
@@ -1,89 +0,0 @@
|
||||
# models/schema/order.py
|
||||
"""
|
||||
LEGACY LOCATION - Re-exports from module for backwards compatibility.
|
||||
|
||||
The canonical implementation is now in:
|
||||
app/modules/orders/schemas/order.py
|
||||
|
||||
This file exists to maintain backwards compatibility with code that
|
||||
imports from the old location. All new code should import directly
|
||||
from the module:
|
||||
|
||||
from app.modules.orders.schemas import order
|
||||
"""
|
||||
|
||||
from app.modules.orders.schemas.order import (
|
||||
# Address schemas
|
||||
AddressSnapshot,
|
||||
AddressSnapshotResponse,
|
||||
# Order item schemas
|
||||
OrderItemCreate,
|
||||
OrderItemExceptionBrief,
|
||||
OrderItemResponse,
|
||||
# Customer schemas
|
||||
CustomerSnapshot,
|
||||
CustomerSnapshotResponse,
|
||||
# Order CRUD schemas
|
||||
OrderCreate,
|
||||
OrderUpdate,
|
||||
OrderTrackingUpdate,
|
||||
OrderItemStateUpdate,
|
||||
# Order response schemas
|
||||
OrderResponse,
|
||||
OrderDetailResponse,
|
||||
OrderListResponse,
|
||||
OrderListItem,
|
||||
# Admin schemas
|
||||
AdminOrderItem,
|
||||
AdminOrderListResponse,
|
||||
AdminOrderStats,
|
||||
AdminOrderStatusUpdate,
|
||||
AdminVendorWithOrders,
|
||||
AdminVendorsWithOrdersResponse,
|
||||
# Letzshop schemas
|
||||
LetzshopOrderImport,
|
||||
LetzshopShippingInfo,
|
||||
LetzshopOrderConfirmItem,
|
||||
LetzshopOrderConfirmRequest,
|
||||
# Shipping schemas
|
||||
MarkAsShippedRequest,
|
||||
ShippingLabelInfo,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
# Address schemas
|
||||
"AddressSnapshot",
|
||||
"AddressSnapshotResponse",
|
||||
# Order item schemas
|
||||
"OrderItemCreate",
|
||||
"OrderItemExceptionBrief",
|
||||
"OrderItemResponse",
|
||||
# Customer schemas
|
||||
"CustomerSnapshot",
|
||||
"CustomerSnapshotResponse",
|
||||
# Order CRUD schemas
|
||||
"OrderCreate",
|
||||
"OrderUpdate",
|
||||
"OrderTrackingUpdate",
|
||||
"OrderItemStateUpdate",
|
||||
# Order response schemas
|
||||
"OrderResponse",
|
||||
"OrderDetailResponse",
|
||||
"OrderListResponse",
|
||||
"OrderListItem",
|
||||
# Admin schemas
|
||||
"AdminOrderItem",
|
||||
"AdminOrderListResponse",
|
||||
"AdminOrderStats",
|
||||
"AdminOrderStatusUpdate",
|
||||
"AdminVendorWithOrders",
|
||||
"AdminVendorsWithOrdersResponse",
|
||||
# Letzshop schemas
|
||||
"LetzshopOrderImport",
|
||||
"LetzshopShippingInfo",
|
||||
"LetzshopOrderConfirmItem",
|
||||
"LetzshopOrderConfirmRequest",
|
||||
# Shipping schemas
|
||||
"MarkAsShippedRequest",
|
||||
"ShippingLabelInfo",
|
||||
]
|
||||
@@ -1,173 +0,0 @@
|
||||
# models/schema/order_item_exception.py
|
||||
"""
|
||||
Pydantic schemas for order item exception management.
|
||||
|
||||
Handles unmatched products during marketplace order imports.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Exception Response Schemas
|
||||
# ============================================================================
|
||||
|
||||
|
||||
class OrderItemExceptionResponse(BaseModel):
|
||||
"""Schema for order item exception response."""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
order_item_id: int
|
||||
vendor_id: int
|
||||
vendor_name: str | None = None # For cross-vendor views
|
||||
|
||||
# Original data from marketplace
|
||||
original_gtin: str | None
|
||||
original_product_name: str | None
|
||||
original_sku: str | None
|
||||
|
||||
# Exception classification
|
||||
exception_type: str # product_not_found, gtin_mismatch, duplicate_gtin
|
||||
|
||||
# Resolution status
|
||||
status: str # pending, resolved, ignored
|
||||
|
||||
# Resolution details
|
||||
resolved_product_id: int | None
|
||||
resolved_at: datetime | None
|
||||
resolved_by: int | None
|
||||
resolution_notes: str | None
|
||||
|
||||
# Timestamps
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
# Nested order info (populated by service)
|
||||
order_number: str | None = None
|
||||
order_id: int | None = None
|
||||
order_date: datetime | None = None
|
||||
order_status: str | None = None
|
||||
|
||||
@property
|
||||
def is_pending(self) -> bool:
|
||||
"""Check if exception is pending resolution."""
|
||||
return self.status == "pending"
|
||||
|
||||
@property
|
||||
def is_resolved(self) -> bool:
|
||||
"""Check if exception has been resolved."""
|
||||
return self.status == "resolved"
|
||||
|
||||
@property
|
||||
def is_ignored(self) -> bool:
|
||||
"""Check if exception has been ignored."""
|
||||
return self.status == "ignored"
|
||||
|
||||
|
||||
class OrderItemExceptionBriefResponse(BaseModel):
|
||||
"""Brief exception info for embedding in order item responses."""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
original_gtin: str | None
|
||||
original_product_name: str | None
|
||||
exception_type: str
|
||||
status: str
|
||||
resolved_product_id: int | None
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# List/Stats Response Schemas
|
||||
# ============================================================================
|
||||
|
||||
|
||||
class OrderItemExceptionListResponse(BaseModel):
|
||||
"""Paginated list of exceptions."""
|
||||
|
||||
exceptions: list[OrderItemExceptionResponse]
|
||||
total: int
|
||||
skip: int
|
||||
limit: int
|
||||
|
||||
|
||||
class OrderItemExceptionStats(BaseModel):
|
||||
"""Exception statistics for a vendor."""
|
||||
|
||||
pending: int = 0
|
||||
resolved: int = 0
|
||||
ignored: int = 0
|
||||
total: int = 0
|
||||
|
||||
# Additional breakdown
|
||||
orders_with_exceptions: int = 0
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Request Schemas
|
||||
# ============================================================================
|
||||
|
||||
|
||||
class ResolveExceptionRequest(BaseModel):
|
||||
"""Request to resolve an exception by assigning a product."""
|
||||
|
||||
product_id: int = Field(..., description="Product ID to assign to this order item")
|
||||
notes: str | None = Field(
|
||||
None,
|
||||
max_length=1000,
|
||||
description="Optional notes about the resolution"
|
||||
)
|
||||
|
||||
|
||||
class IgnoreExceptionRequest(BaseModel):
|
||||
"""Request to ignore an exception (still blocks confirmation)."""
|
||||
|
||||
notes: str = Field(
|
||||
...,
|
||||
min_length=1,
|
||||
max_length=1000,
|
||||
description="Reason for ignoring (required)"
|
||||
)
|
||||
|
||||
|
||||
class BulkResolveRequest(BaseModel):
|
||||
"""Request to bulk resolve all pending exceptions for a GTIN."""
|
||||
|
||||
gtin: str = Field(
|
||||
...,
|
||||
min_length=1,
|
||||
max_length=50,
|
||||
description="GTIN to match pending exceptions"
|
||||
)
|
||||
product_id: int = Field(..., description="Product ID to assign")
|
||||
notes: str | None = Field(
|
||||
None,
|
||||
max_length=1000,
|
||||
description="Optional notes about the resolution"
|
||||
)
|
||||
|
||||
|
||||
class BulkResolveResponse(BaseModel):
|
||||
"""Response from bulk resolve operation."""
|
||||
|
||||
resolved_count: int
|
||||
gtin: str
|
||||
product_id: int
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Auto-Match Response Schemas
|
||||
# ============================================================================
|
||||
|
||||
|
||||
class AutoMatchResult(BaseModel):
|
||||
"""Result of auto-matching after product import."""
|
||||
|
||||
gtin: str
|
||||
product_id: int
|
||||
resolved_count: int
|
||||
resolved_exception_ids: list[int]
|
||||
@@ -3,7 +3,7 @@ from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from models.schema.inventory import InventoryLocationResponse
|
||||
from app.modules.inventory.schemas import InventoryLocationResponse
|
||||
from models.schema.marketplace_product import MarketplaceProductResponse
|
||||
|
||||
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
# models/schema/stats.py
|
||||
"""
|
||||
Statistics schemas - LEGACY LOCATION
|
||||
|
||||
This file exists for backward compatibility.
|
||||
The canonical location is now: app/modules/analytics/schemas/stats.py
|
||||
|
||||
All imports should use the new location:
|
||||
from app.modules.analytics.schemas import StatsResponse, ...
|
||||
"""
|
||||
|
||||
# Re-export from canonical location for backward compatibility
|
||||
from app.modules.analytics.schemas.stats import (
|
||||
StatsResponse,
|
||||
MarketplaceStatsResponse,
|
||||
ImportStatsResponse,
|
||||
UserStatsResponse,
|
||||
VendorStatsResponse,
|
||||
ProductStatsResponse,
|
||||
PlatformStatsResponse,
|
||||
OrderStatsBasicResponse,
|
||||
AdminDashboardResponse,
|
||||
VendorProductStats,
|
||||
VendorOrderStats,
|
||||
VendorCustomerStats,
|
||||
VendorRevenueStats,
|
||||
VendorInfo,
|
||||
VendorDashboardStatsResponse,
|
||||
VendorAnalyticsImports,
|
||||
VendorAnalyticsCatalog,
|
||||
VendorAnalyticsInventory,
|
||||
VendorAnalyticsResponse,
|
||||
ValidatorStats,
|
||||
CodeQualityDashboardStatsResponse,
|
||||
CustomerStatsResponse,
|
||||
OrderStatsResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"StatsResponse",
|
||||
"MarketplaceStatsResponse",
|
||||
"ImportStatsResponse",
|
||||
"UserStatsResponse",
|
||||
"VendorStatsResponse",
|
||||
"ProductStatsResponse",
|
||||
"PlatformStatsResponse",
|
||||
"OrderStatsBasicResponse",
|
||||
"AdminDashboardResponse",
|
||||
"VendorProductStats",
|
||||
"VendorOrderStats",
|
||||
"VendorCustomerStats",
|
||||
"VendorRevenueStats",
|
||||
"VendorInfo",
|
||||
"VendorDashboardStatsResponse",
|
||||
"VendorAnalyticsImports",
|
||||
"VendorAnalyticsCatalog",
|
||||
"VendorAnalyticsInventory",
|
||||
"VendorAnalyticsResponse",
|
||||
"ValidatorStats",
|
||||
"CodeQualityDashboardStatsResponse",
|
||||
"CustomerStatsResponse",
|
||||
"OrderStatsResponse",
|
||||
]
|
||||
Reference in New Issue
Block a user