refactor: migrate schemas to canonical module locations
Migrate remaining legacy schemas to their respective modules: Marketplace module (app/modules/marketplace/schemas/): - letzshop.py: Letzshop credentials, orders, fulfillment, sync - onboarding.py: Vendor onboarding wizard schemas Catalog module (app/modules/catalog/schemas/): - product.py: ProductCreate, ProductUpdate, ProductResponse Payments module (app/modules/payments/schemas/): - payment.py: PaymentConfig, Stripe, transactions, balance Delete legacy files: - models/schema/letzshop.py - models/schema/onboarding.py - models/schema/product.py - models/schema/payment.py - models/schema/marketplace_product.py (re-export) - models/schema/marketplace_import_job.py (re-export) - models/schema/search.py (empty) Update imports across 19 files to use canonical locations. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,7 +33,7 @@ from app.services.letzshop import (
|
|||||||
)
|
)
|
||||||
from app.tasks.letzshop_tasks import process_historical_import
|
from app.tasks.letzshop_tasks import process_historical_import
|
||||||
from models.database.user import User
|
from models.database.user import User
|
||||||
from models.schema.letzshop import (
|
from app.modules.marketplace.schemas import (
|
||||||
FulfillmentOperationResponse,
|
FulfillmentOperationResponse,
|
||||||
LetzshopCachedVendorDetail,
|
LetzshopCachedVendorDetail,
|
||||||
LetzshopCachedVendorDetailResponse,
|
LetzshopCachedVendorDetailResponse,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from app.services.stats_service import stats_service
|
|||||||
from app.services.vendor_service import vendor_service
|
from app.services.vendor_service import vendor_service
|
||||||
from app.tasks.background_tasks import process_marketplace_import
|
from app.tasks.background_tasks import process_marketplace_import
|
||||||
from models.database.user import User
|
from models.database.user import User
|
||||||
from models.schema.marketplace_import_job import (
|
from app.modules.marketplace.schemas import (
|
||||||
AdminMarketplaceImportJobListResponse,
|
AdminMarketplaceImportJobListResponse,
|
||||||
AdminMarketplaceImportJobRequest,
|
AdminMarketplaceImportJobRequest,
|
||||||
AdminMarketplaceImportJobResponse,
|
AdminMarketplaceImportJobResponse,
|
||||||
|
|||||||
2
app/api/v1/vendor/letzshop.py
vendored
2
app/api/v1/vendor/letzshop.py
vendored
@@ -32,7 +32,7 @@ from app.services.letzshop import (
|
|||||||
OrderNotFoundError,
|
OrderNotFoundError,
|
||||||
)
|
)
|
||||||
from models.database.user import User
|
from models.database.user import User
|
||||||
from models.schema.letzshop import (
|
from app.modules.marketplace.schemas import (
|
||||||
FulfillmentConfirmRequest,
|
FulfillmentConfirmRequest,
|
||||||
FulfillmentOperationResponse,
|
FulfillmentOperationResponse,
|
||||||
FulfillmentQueueItemResponse,
|
FulfillmentQueueItemResponse,
|
||||||
|
|||||||
2
app/api/v1/vendor/marketplace.py
vendored
2
app/api/v1/vendor/marketplace.py
vendored
@@ -18,7 +18,7 @@ from app.services.vendor_service import vendor_service
|
|||||||
from app.tasks.background_tasks import process_marketplace_import
|
from app.tasks.background_tasks import process_marketplace_import
|
||||||
from middleware.decorators import rate_limit
|
from middleware.decorators import rate_limit
|
||||||
from models.database.user import User
|
from models.database.user import User
|
||||||
from models.schema.marketplace_import_job import (
|
from app.modules.marketplace.schemas import (
|
||||||
MarketplaceImportJobRequest,
|
MarketplaceImportJobRequest,
|
||||||
MarketplaceImportJobResponse,
|
MarketplaceImportJobResponse,
|
||||||
)
|
)
|
||||||
|
|||||||
2
app/api/v1/vendor/onboarding.py
vendored
2
app/api/v1/vendor/onboarding.py
vendored
@@ -21,7 +21,7 @@ from app.core.database import get_db
|
|||||||
from app.services.onboarding_service import OnboardingService
|
from app.services.onboarding_service import OnboardingService
|
||||||
from app.tasks.letzshop_tasks import process_historical_import
|
from app.tasks.letzshop_tasks import process_historical_import
|
||||||
from models.database.user import User
|
from models.database.user import User
|
||||||
from models.schema.onboarding import (
|
from app.modules.marketplace.schemas import (
|
||||||
CompanyProfileRequest,
|
CompanyProfileRequest,
|
||||||
CompanyProfileResponse,
|
CompanyProfileResponse,
|
||||||
LetzshopApiConfigRequest,
|
LetzshopApiConfigRequest,
|
||||||
|
|||||||
6
app/api/v1/vendor/payments.py
vendored
6
app/api/v1/vendor/payments.py
vendored
@@ -15,14 +15,14 @@ from app.api.deps import get_current_vendor_api
|
|||||||
from app.core.database import get_db
|
from app.core.database import get_db
|
||||||
from app.services.vendor_service import vendor_service
|
from app.services.vendor_service import vendor_service
|
||||||
from models.database.user import User
|
from models.database.user import User
|
||||||
from models.schema.payment import (
|
from app.modules.payments.schemas import (
|
||||||
PaymentBalanceResponse,
|
PaymentBalanceResponse,
|
||||||
PaymentConfigResponse,
|
PaymentConfigResponse,
|
||||||
PaymentConfigUpdate,
|
PaymentConfigUpdate,
|
||||||
PaymentConfigUpdateResponse,
|
PaymentConfigUpdateResponse,
|
||||||
PaymentMethodsResponse,
|
PaymentMethodsResponse,
|
||||||
RefundRequest,
|
PaymentRefundRequest as RefundRequest,
|
||||||
RefundResponse,
|
PaymentRefundResponse as RefundResponse,
|
||||||
StripeConnectRequest,
|
StripeConnectRequest,
|
||||||
StripeConnectResponse,
|
StripeConnectResponse,
|
||||||
StripeDisconnectResponse,
|
StripeDisconnectResponse,
|
||||||
|
|||||||
2
app/api/v1/vendor/products.py
vendored
2
app/api/v1/vendor/products.py
vendored
@@ -17,7 +17,7 @@ from app.services.product_service import product_service
|
|||||||
from app.services.subscription_service import subscription_service
|
from app.services.subscription_service import subscription_service
|
||||||
from app.services.vendor_product_service import vendor_product_service
|
from app.services.vendor_product_service import vendor_product_service
|
||||||
from models.database.user import User
|
from models.database.user import User
|
||||||
from models.schema.product import (
|
from app.modules.catalog.schemas import (
|
||||||
ProductCreate,
|
ProductCreate,
|
||||||
ProductDeleteResponse,
|
ProductDeleteResponse,
|
||||||
ProductDetailResponse,
|
ProductDetailResponse,
|
||||||
|
|||||||
@@ -2,13 +2,31 @@
|
|||||||
"""Catalog module schemas."""
|
"""Catalog module schemas."""
|
||||||
|
|
||||||
from app.modules.catalog.schemas.catalog import (
|
from app.modules.catalog.schemas.catalog import (
|
||||||
|
ProductDetailResponse as CatalogProductDetailResponse,
|
||||||
|
ProductListResponse as CatalogProductListResponse,
|
||||||
|
ProductResponse as CatalogProductResponse,
|
||||||
|
)
|
||||||
|
from app.modules.catalog.schemas.product import (
|
||||||
|
ProductCreate,
|
||||||
|
ProductUpdate,
|
||||||
|
ProductResponse,
|
||||||
ProductDetailResponse,
|
ProductDetailResponse,
|
||||||
ProductListResponse,
|
ProductListResponse,
|
||||||
ProductResponse,
|
ProductDeleteResponse,
|
||||||
|
ProductToggleResponse,
|
||||||
)
|
)
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
# Catalog browsing schemas (storefront)
|
||||||
|
"CatalogProductResponse",
|
||||||
|
"CatalogProductDetailResponse",
|
||||||
|
"CatalogProductListResponse",
|
||||||
|
# Product CRUD schemas (vendor management)
|
||||||
|
"ProductCreate",
|
||||||
|
"ProductUpdate",
|
||||||
"ProductResponse",
|
"ProductResponse",
|
||||||
"ProductDetailResponse",
|
"ProductDetailResponse",
|
||||||
"ProductListResponse",
|
"ProductListResponse",
|
||||||
|
"ProductDeleteResponse",
|
||||||
|
"ProductToggleResponse",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from datetime import datetime
|
|||||||
from pydantic import BaseModel, ConfigDict, Field
|
from pydantic import BaseModel, ConfigDict, Field
|
||||||
|
|
||||||
from app.modules.inventory.schemas import InventoryLocationResponse
|
from app.modules.inventory.schemas import InventoryLocationResponse
|
||||||
from models.schema.marketplace_product import MarketplaceProductResponse
|
from app.modules.marketplace.schemas import MarketplaceProductResponse
|
||||||
|
|
||||||
|
|
||||||
class ProductResponse(BaseModel):
|
class ProductResponse(BaseModel):
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
# models/schema/product.py
|
# app/modules/catalog/schemas/product.py
|
||||||
|
"""
|
||||||
|
Pydantic schemas for Product CRUD operations.
|
||||||
|
|
||||||
|
These schemas are used for vendor product catalog management,
|
||||||
|
linking vendor products to marketplace products.
|
||||||
|
"""
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from pydantic import BaseModel, ConfigDict, Field
|
from pydantic import BaseModel, ConfigDict, Field
|
||||||
|
|
||||||
from app.modules.inventory.schemas import InventoryLocationResponse
|
from app.modules.inventory.schemas import InventoryLocationResponse
|
||||||
from models.schema.marketplace_product import MarketplaceProductResponse
|
from app.modules.marketplace.schemas import MarketplaceProductResponse
|
||||||
|
|
||||||
|
|
||||||
class ProductCreate(BaseModel):
|
class ProductCreate(BaseModel):
|
||||||
@@ -39,6 +39,83 @@ from app.modules.marketplace.schemas.marketplace_product import (
|
|||||||
MarketplaceImportRequest,
|
MarketplaceImportRequest,
|
||||||
MarketplaceImportResponse,
|
MarketplaceImportResponse,
|
||||||
)
|
)
|
||||||
|
from app.modules.marketplace.schemas.letzshop import (
|
||||||
|
# Credentials
|
||||||
|
LetzshopCredentialsCreate,
|
||||||
|
LetzshopCredentialsUpdate,
|
||||||
|
LetzshopCredentialsResponse,
|
||||||
|
LetzshopCredentialsStatus,
|
||||||
|
# Orders
|
||||||
|
LetzshopOrderItemResponse,
|
||||||
|
LetzshopOrderResponse,
|
||||||
|
LetzshopOrderDetailResponse,
|
||||||
|
LetzshopOrderStats,
|
||||||
|
LetzshopOrderListResponse,
|
||||||
|
# Fulfillment
|
||||||
|
FulfillmentConfirmRequest,
|
||||||
|
FulfillmentRejectRequest,
|
||||||
|
FulfillmentTrackingRequest,
|
||||||
|
FulfillmentQueueItemResponse,
|
||||||
|
FulfillmentQueueListResponse,
|
||||||
|
FulfillmentOperationResponse,
|
||||||
|
# Sync
|
||||||
|
LetzshopSyncLogResponse,
|
||||||
|
LetzshopSyncLogListResponse,
|
||||||
|
LetzshopSyncTriggerRequest,
|
||||||
|
LetzshopSyncTriggerResponse,
|
||||||
|
# Connection
|
||||||
|
LetzshopConnectionTestRequest,
|
||||||
|
LetzshopConnectionTestResponse,
|
||||||
|
LetzshopSuccessResponse,
|
||||||
|
# Admin
|
||||||
|
LetzshopVendorOverview,
|
||||||
|
LetzshopVendorListResponse,
|
||||||
|
# Jobs
|
||||||
|
LetzshopJobItem,
|
||||||
|
LetzshopJobsListResponse,
|
||||||
|
# Historical Import
|
||||||
|
LetzshopHistoricalImportJobResponse,
|
||||||
|
LetzshopHistoricalImportStartResponse,
|
||||||
|
# Vendor Directory
|
||||||
|
LetzshopCachedVendorItem,
|
||||||
|
LetzshopCachedVendorDetail,
|
||||||
|
LetzshopVendorDirectoryStats,
|
||||||
|
LetzshopVendorDirectoryStatsResponse,
|
||||||
|
LetzshopCachedVendorListResponse,
|
||||||
|
LetzshopCachedVendorDetailResponse,
|
||||||
|
LetzshopVendorDirectorySyncResponse,
|
||||||
|
LetzshopCreateVendorFromCacheResponse,
|
||||||
|
)
|
||||||
|
from app.modules.marketplace.schemas.onboarding import (
|
||||||
|
# Step status
|
||||||
|
StepStatus,
|
||||||
|
CompanyProfileStepStatus,
|
||||||
|
LetzshopApiStepStatus,
|
||||||
|
ProductImportStepStatus,
|
||||||
|
OrderSyncStepStatus,
|
||||||
|
# Main status
|
||||||
|
OnboardingStatusResponse,
|
||||||
|
# Step 1
|
||||||
|
CompanyProfileRequest,
|
||||||
|
CompanyProfileResponse,
|
||||||
|
# Step 2
|
||||||
|
LetzshopApiConfigRequest,
|
||||||
|
LetzshopApiTestRequest,
|
||||||
|
LetzshopApiTestResponse,
|
||||||
|
LetzshopApiConfigResponse,
|
||||||
|
# Step 3
|
||||||
|
ProductImportConfigRequest,
|
||||||
|
ProductImportConfigResponse,
|
||||||
|
# Step 4
|
||||||
|
OrderSyncTriggerRequest,
|
||||||
|
OrderSyncTriggerResponse,
|
||||||
|
OrderSyncProgressResponse,
|
||||||
|
OrderSyncCompleteRequest,
|
||||||
|
OrderSyncCompleteResponse,
|
||||||
|
# Admin
|
||||||
|
OnboardingSkipRequest,
|
||||||
|
OnboardingSkipResponse,
|
||||||
|
)
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
# Import job schemas
|
# Import job schemas
|
||||||
@@ -62,4 +139,77 @@ __all__ = [
|
|||||||
# Import schemas
|
# Import schemas
|
||||||
"MarketplaceImportRequest",
|
"MarketplaceImportRequest",
|
||||||
"MarketplaceImportResponse",
|
"MarketplaceImportResponse",
|
||||||
|
# Letzshop - Credentials
|
||||||
|
"LetzshopCredentialsCreate",
|
||||||
|
"LetzshopCredentialsUpdate",
|
||||||
|
"LetzshopCredentialsResponse",
|
||||||
|
"LetzshopCredentialsStatus",
|
||||||
|
# Letzshop - Orders
|
||||||
|
"LetzshopOrderItemResponse",
|
||||||
|
"LetzshopOrderResponse",
|
||||||
|
"LetzshopOrderDetailResponse",
|
||||||
|
"LetzshopOrderStats",
|
||||||
|
"LetzshopOrderListResponse",
|
||||||
|
# Letzshop - Fulfillment
|
||||||
|
"FulfillmentConfirmRequest",
|
||||||
|
"FulfillmentRejectRequest",
|
||||||
|
"FulfillmentTrackingRequest",
|
||||||
|
"FulfillmentQueueItemResponse",
|
||||||
|
"FulfillmentQueueListResponse",
|
||||||
|
"FulfillmentOperationResponse",
|
||||||
|
# Letzshop - Sync
|
||||||
|
"LetzshopSyncLogResponse",
|
||||||
|
"LetzshopSyncLogListResponse",
|
||||||
|
"LetzshopSyncTriggerRequest",
|
||||||
|
"LetzshopSyncTriggerResponse",
|
||||||
|
# Letzshop - Connection
|
||||||
|
"LetzshopConnectionTestRequest",
|
||||||
|
"LetzshopConnectionTestResponse",
|
||||||
|
"LetzshopSuccessResponse",
|
||||||
|
# Letzshop - Admin
|
||||||
|
"LetzshopVendorOverview",
|
||||||
|
"LetzshopVendorListResponse",
|
||||||
|
# Letzshop - Jobs
|
||||||
|
"LetzshopJobItem",
|
||||||
|
"LetzshopJobsListResponse",
|
||||||
|
# Letzshop - Historical Import
|
||||||
|
"LetzshopHistoricalImportJobResponse",
|
||||||
|
"LetzshopHistoricalImportStartResponse",
|
||||||
|
# Letzshop - Vendor Directory
|
||||||
|
"LetzshopCachedVendorItem",
|
||||||
|
"LetzshopCachedVendorDetail",
|
||||||
|
"LetzshopVendorDirectoryStats",
|
||||||
|
"LetzshopVendorDirectoryStatsResponse",
|
||||||
|
"LetzshopCachedVendorListResponse",
|
||||||
|
"LetzshopCachedVendorDetailResponse",
|
||||||
|
"LetzshopVendorDirectorySyncResponse",
|
||||||
|
"LetzshopCreateVendorFromCacheResponse",
|
||||||
|
# Onboarding - Step status
|
||||||
|
"StepStatus",
|
||||||
|
"CompanyProfileStepStatus",
|
||||||
|
"LetzshopApiStepStatus",
|
||||||
|
"ProductImportStepStatus",
|
||||||
|
"OrderSyncStepStatus",
|
||||||
|
# Onboarding - Main status
|
||||||
|
"OnboardingStatusResponse",
|
||||||
|
# Onboarding - Step 1
|
||||||
|
"CompanyProfileRequest",
|
||||||
|
"CompanyProfileResponse",
|
||||||
|
# Onboarding - Step 2
|
||||||
|
"LetzshopApiConfigRequest",
|
||||||
|
"LetzshopApiTestRequest",
|
||||||
|
"LetzshopApiTestResponse",
|
||||||
|
"LetzshopApiConfigResponse",
|
||||||
|
# Onboarding - Step 3
|
||||||
|
"ProductImportConfigRequest",
|
||||||
|
"ProductImportConfigResponse",
|
||||||
|
# Onboarding - Step 4
|
||||||
|
"OrderSyncTriggerRequest",
|
||||||
|
"OrderSyncTriggerResponse",
|
||||||
|
"OrderSyncProgressResponse",
|
||||||
|
"OrderSyncCompleteRequest",
|
||||||
|
"OrderSyncCompleteResponse",
|
||||||
|
# Onboarding - Admin
|
||||||
|
"OnboardingSkipRequest",
|
||||||
|
"OnboardingSkipResponse",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# models/schema/letzshop.py
|
# app/modules/marketplace/schemas/letzshop.py
|
||||||
"""
|
"""
|
||||||
Pydantic schemas for Letzshop marketplace integration.
|
Pydantic schemas for Letzshop marketplace integration.
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# models/schema/onboarding.py
|
# app/modules/marketplace/schemas/onboarding.py
|
||||||
"""
|
"""
|
||||||
Pydantic schemas for Vendor Onboarding operations.
|
Pydantic schemas for Vendor Onboarding operations.
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ from app.modules.marketplace.models import (
|
|||||||
)
|
)
|
||||||
from models.database.user import User
|
from models.database.user import User
|
||||||
from models.database.vendor import Vendor
|
from models.database.vendor import Vendor
|
||||||
from models.schema.marketplace_import_job import (
|
from app.modules.marketplace.schemas import (
|
||||||
AdminMarketplaceImportJobResponse,
|
AdminMarketplaceImportJobResponse,
|
||||||
MarketplaceImportJobRequest,
|
MarketplaceImportJobRequest,
|
||||||
MarketplaceImportJobResponse,
|
MarketplaceImportJobResponse,
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ from app.modules.marketplace.models import (
|
|||||||
MarketplaceProductTranslation,
|
MarketplaceProductTranslation,
|
||||||
)
|
)
|
||||||
from app.modules.inventory.schemas import InventoryLocationResponse, InventorySummaryResponse
|
from app.modules.inventory.schemas import InventoryLocationResponse, InventorySummaryResponse
|
||||||
from models.schema.marketplace_product import (
|
from app.modules.marketplace.schemas import (
|
||||||
MarketplaceProductCreate,
|
MarketplaceProductCreate,
|
||||||
MarketplaceProductUpdate,
|
MarketplaceProductUpdate,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,10 +3,33 @@
|
|||||||
Payments module Pydantic schemas.
|
Payments module Pydantic schemas.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
from app.modules.payments.schemas.payment import (
|
||||||
|
# Configuration
|
||||||
|
PaymentConfigResponse,
|
||||||
|
PaymentConfigUpdate,
|
||||||
|
PaymentConfigUpdateResponse,
|
||||||
|
# Stripe
|
||||||
|
StripeConnectRequest,
|
||||||
|
StripeConnectResponse,
|
||||||
|
StripeDisconnectResponse,
|
||||||
|
# Methods
|
||||||
|
PaymentMethodInfo,
|
||||||
|
PaymentMethodsResponse,
|
||||||
|
# Transactions
|
||||||
|
TransactionInfo,
|
||||||
|
TransactionsResponse,
|
||||||
|
# Balance
|
||||||
|
PaymentBalanceResponse,
|
||||||
|
# Refunds (config version)
|
||||||
|
PaymentRefundRequest,
|
||||||
|
PaymentRefundResponse,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class PaymentRequest(BaseModel):
|
class PaymentRequest(BaseModel):
|
||||||
"""Request to process a payment."""
|
"""Request to process a payment."""
|
||||||
@@ -83,6 +106,7 @@ class GatewayResponse(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
# Core payment schemas
|
||||||
"PaymentRequest",
|
"PaymentRequest",
|
||||||
"PaymentResponse",
|
"PaymentResponse",
|
||||||
"RefundRequest",
|
"RefundRequest",
|
||||||
@@ -90,4 +114,23 @@ __all__ = [
|
|||||||
"PaymentMethodCreate",
|
"PaymentMethodCreate",
|
||||||
"PaymentMethodResponse",
|
"PaymentMethodResponse",
|
||||||
"GatewayResponse",
|
"GatewayResponse",
|
||||||
|
# Configuration schemas
|
||||||
|
"PaymentConfigResponse",
|
||||||
|
"PaymentConfigUpdate",
|
||||||
|
"PaymentConfigUpdateResponse",
|
||||||
|
# Stripe integration
|
||||||
|
"StripeConnectRequest",
|
||||||
|
"StripeConnectResponse",
|
||||||
|
"StripeDisconnectResponse",
|
||||||
|
# Payment methods info
|
||||||
|
"PaymentMethodInfo",
|
||||||
|
"PaymentMethodsResponse",
|
||||||
|
# Transactions
|
||||||
|
"TransactionInfo",
|
||||||
|
"TransactionsResponse",
|
||||||
|
# Balance
|
||||||
|
"PaymentBalanceResponse",
|
||||||
|
# Refunds (config version)
|
||||||
|
"PaymentRefundRequest",
|
||||||
|
"PaymentRefundResponse",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# models/schema/payment.py
|
# app/modules/payments/schemas/payment.py
|
||||||
"""
|
"""
|
||||||
Payment Pydantic schemas for API validation and responses.
|
Payment Pydantic schemas for API validation and responses.
|
||||||
|
|
||||||
@@ -144,12 +144,12 @@ class PaymentBalanceResponse(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# REFUND SCHEMAS
|
# REFUND SCHEMAS (for payment config endpoints)
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
|
|
||||||
class RefundRequest(BaseModel):
|
class PaymentRefundRequest(BaseModel):
|
||||||
"""Request model for processing a refund."""
|
"""Request model for processing a refund (payment module version)."""
|
||||||
|
|
||||||
amount: float | None = Field(
|
amount: float | None = Field(
|
||||||
None, gt=0, description="Partial refund amount, or None for full refund"
|
None, gt=0, description="Partial refund amount, or None for full refund"
|
||||||
@@ -157,8 +157,8 @@ class RefundRequest(BaseModel):
|
|||||||
reason: str | None = Field(None, max_length=500)
|
reason: str | None = Field(None, max_length=500)
|
||||||
|
|
||||||
|
|
||||||
class RefundResponse(BaseModel):
|
class PaymentRefundResponse(BaseModel):
|
||||||
"""Response for refund operation."""
|
"""Response for refund operation (payment module version)."""
|
||||||
|
|
||||||
refund_id: int | None = None
|
refund_id: int | None = None
|
||||||
payment_id: int | None = None
|
payment_id: int | None = None
|
||||||
@@ -37,7 +37,7 @@ from app.modules.marketplace.models import MarketplaceImportJob
|
|||||||
from models.database.platform import Platform
|
from models.database.platform import Platform
|
||||||
from models.database.user import User
|
from models.database.user import User
|
||||||
from models.database.vendor import Role, Vendor
|
from models.database.vendor import Role, Vendor
|
||||||
from models.schema.marketplace_import_job import MarketplaceImportJobResponse
|
from app.modules.marketplace.schemas import MarketplaceImportJobResponse
|
||||||
from models.schema.vendor import VendorCreate
|
from models.schema.vendor import VendorCreate
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from app.exceptions import (
|
|||||||
)
|
)
|
||||||
from app.modules.marketplace.models import MarketplaceProduct
|
from app.modules.marketplace.models import MarketplaceProduct
|
||||||
from app.modules.catalog.models import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.schema.product import ProductCreate, ProductUpdate
|
from app.modules.catalog.schemas import ProductCreate, ProductUpdate
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ from app.modules.marketplace.models import MarketplaceProduct
|
|||||||
from app.modules.catalog.models import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.database.user import User
|
from models.database.user import User
|
||||||
from models.database.vendor import Vendor
|
from models.database.vendor import Vendor
|
||||||
from models.schema.product import ProductCreate
|
from app.modules.catalog.schemas import ProductCreate
|
||||||
from models.schema.vendor import VendorCreate
|
from models.schema.vendor import VendorCreate
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ from fastapi import APIRouter, Depends
|
|||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
from app.core.database import get_db
|
from app.core.database import get_db
|
||||||
from app.services.product_service import product_service
|
from app.services.product_service import product_service
|
||||||
from models.schema.product import ProductCreate, ProductResponse
|
from app.modules.catalog.schemas import ProductCreate, ProductResponse
|
||||||
|
|
||||||
router = APIRouter(prefix="/products")
|
router = APIRouter(prefix="/products")
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ Note: Many schemas have been migrated to their respective modules:
|
|||||||
- Inventory schemas: app.modules.inventory.schemas
|
- Inventory schemas: app.modules.inventory.schemas
|
||||||
- Message schemas: app.modules.messaging.schemas
|
- Message schemas: app.modules.messaging.schemas
|
||||||
- Cart schemas: app.modules.cart.schemas
|
- Cart schemas: app.modules.cart.schemas
|
||||||
|
- Marketplace schemas: app.modules.marketplace.schemas
|
||||||
|
- Catalog/Product schemas: app.modules.catalog.schemas
|
||||||
|
- Payment schemas: app.modules.payments.schemas
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Import API model modules that remain in legacy location
|
# Import API model modules that remain in legacy location
|
||||||
@@ -14,9 +17,6 @@ from . import (
|
|||||||
auth,
|
auth,
|
||||||
base,
|
base,
|
||||||
email,
|
email,
|
||||||
marketplace_import_job,
|
|
||||||
marketplace_product,
|
|
||||||
onboarding,
|
|
||||||
vendor,
|
vendor,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -27,8 +27,5 @@ __all__ = [
|
|||||||
"base",
|
"base",
|
||||||
"auth",
|
"auth",
|
||||||
"email",
|
"email",
|
||||||
"marketplace_product",
|
|
||||||
"onboarding",
|
|
||||||
"vendor",
|
"vendor",
|
||||||
"marketplace_import_job",
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
# models/schema/marketplace_import_job.py
|
|
||||||
"""
|
|
||||||
Legacy location for marketplace import job schemas.
|
|
||||||
|
|
||||||
MIGRATED: All schemas have been moved to app.modules.marketplace.schemas.marketplace_import_job.
|
|
||||||
|
|
||||||
New location:
|
|
||||||
from app.modules.marketplace.schemas import (
|
|
||||||
MarketplaceImportJobRequest,
|
|
||||||
MarketplaceImportJobResponse,
|
|
||||||
)
|
|
||||||
|
|
||||||
This file re-exports from the new location for backward compatibility.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Re-export everything from the new canonical location
|
|
||||||
from app.modules.marketplace.schemas.marketplace_import_job import (
|
|
||||||
MarketplaceImportJobRequest,
|
|
||||||
AdminMarketplaceImportJobRequest,
|
|
||||||
MarketplaceImportJobResponse,
|
|
||||||
MarketplaceImportJobListResponse,
|
|
||||||
MarketplaceImportErrorResponse,
|
|
||||||
MarketplaceImportErrorListResponse,
|
|
||||||
AdminMarketplaceImportJobResponse,
|
|
||||||
AdminMarketplaceImportJobListResponse,
|
|
||||||
MarketplaceImportJobStatusUpdate,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
"MarketplaceImportJobRequest",
|
|
||||||
"AdminMarketplaceImportJobRequest",
|
|
||||||
"MarketplaceImportJobResponse",
|
|
||||||
"MarketplaceImportJobListResponse",
|
|
||||||
"MarketplaceImportErrorResponse",
|
|
||||||
"MarketplaceImportErrorListResponse",
|
|
||||||
"AdminMarketplaceImportJobResponse",
|
|
||||||
"AdminMarketplaceImportJobListResponse",
|
|
||||||
"MarketplaceImportJobStatusUpdate",
|
|
||||||
]
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
# models/schema/marketplace_product.py
|
|
||||||
"""
|
|
||||||
Legacy location for marketplace product schemas.
|
|
||||||
|
|
||||||
MIGRATED: All schemas have been moved to app.modules.marketplace.schemas.marketplace_product.
|
|
||||||
|
|
||||||
New location:
|
|
||||||
from app.modules.marketplace.schemas import (
|
|
||||||
MarketplaceProductCreate,
|
|
||||||
MarketplaceProductResponse,
|
|
||||||
MarketplaceProductTranslationSchema,
|
|
||||||
)
|
|
||||||
|
|
||||||
This file re-exports from the new location for backward compatibility.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Re-export everything from the new canonical location
|
|
||||||
from app.modules.marketplace.schemas.marketplace_product import (
|
|
||||||
# Translation schemas
|
|
||||||
MarketplaceProductTranslationSchema,
|
|
||||||
# Base schemas
|
|
||||||
MarketplaceProductBase,
|
|
||||||
# CRUD schemas
|
|
||||||
MarketplaceProductCreate,
|
|
||||||
MarketplaceProductUpdate,
|
|
||||||
# Response schemas
|
|
||||||
MarketplaceProductResponse,
|
|
||||||
MarketplaceProductListResponse,
|
|
||||||
MarketplaceProductDetailResponse,
|
|
||||||
# Import schemas
|
|
||||||
MarketplaceImportRequest,
|
|
||||||
MarketplaceImportResponse,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
"MarketplaceProductTranslationSchema",
|
|
||||||
"MarketplaceProductBase",
|
|
||||||
"MarketplaceProductCreate",
|
|
||||||
"MarketplaceProductUpdate",
|
|
||||||
"MarketplaceProductResponse",
|
|
||||||
"MarketplaceProductListResponse",
|
|
||||||
"MarketplaceProductDetailResponse",
|
|
||||||
"MarketplaceImportRequest",
|
|
||||||
"MarketplaceImportResponse",
|
|
||||||
]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# Search models
|
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from pydantic import ValidationError
|
from pydantic import ValidationError
|
||||||
|
|
||||||
from models.schema.marketplace_import_job import (
|
from app.modules.marketplace.schemas import (
|
||||||
MarketplaceImportJobListResponse,
|
MarketplaceImportJobListResponse,
|
||||||
MarketplaceImportJobRequest,
|
MarketplaceImportJobRequest,
|
||||||
MarketplaceImportJobResponse,
|
MarketplaceImportJobResponse,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from pydantic import ValidationError
|
from pydantic import ValidationError
|
||||||
|
|
||||||
from models.schema.product import (
|
from app.modules.catalog.schemas import (
|
||||||
ProductCreate,
|
ProductCreate,
|
||||||
ProductListResponse,
|
ProductListResponse,
|
||||||
ProductResponse,
|
ProductResponse,
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ from app.modules.marketplace.models import (
|
|||||||
MarketplaceProduct,
|
MarketplaceProduct,
|
||||||
MarketplaceProductTranslation,
|
MarketplaceProductTranslation,
|
||||||
)
|
)
|
||||||
from models.schema.marketplace_product import (
|
from app.modules.marketplace.schemas import (
|
||||||
MarketplaceProductCreate,
|
MarketplaceProductCreate,
|
||||||
MarketplaceProductUpdate,
|
MarketplaceProductUpdate,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from app.exceptions.marketplace_import_job import (
|
|||||||
from app.exceptions.vendor import UnauthorizedVendorAccessException
|
from app.exceptions.vendor import UnauthorizedVendorAccessException
|
||||||
from app.services.marketplace_import_job_service import MarketplaceImportJobService
|
from app.services.marketplace_import_job_service import MarketplaceImportJobService
|
||||||
from app.modules.marketplace.models import MarketplaceImportJob
|
from app.modules.marketplace.models import MarketplaceImportJob
|
||||||
from models.schema.marketplace_import_job import MarketplaceImportJobRequest
|
from app.modules.marketplace.schemas import MarketplaceImportJobRequest
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.unit
|
@pytest.mark.unit
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from app.exceptions import (
|
|||||||
MarketplaceProductValidationException,
|
MarketplaceProductValidationException,
|
||||||
)
|
)
|
||||||
from app.services.marketplace_product_service import MarketplaceProductService
|
from app.services.marketplace_product_service import MarketplaceProductService
|
||||||
from models.schema.marketplace_product import (
|
from app.modules.marketplace.schemas import (
|
||||||
MarketplaceProductCreate,
|
MarketplaceProductCreate,
|
||||||
MarketplaceProductUpdate,
|
MarketplaceProductUpdate,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from app.exceptions import (
|
|||||||
from app.services.vendor_service import VendorService
|
from app.services.vendor_service import VendorService
|
||||||
from models.database.company import Company
|
from models.database.company import Company
|
||||||
from models.database.vendor import Vendor
|
from models.database.vendor import Vendor
|
||||||
from models.schema.product import ProductCreate
|
from app.modules.catalog.schemas import ProductCreate
|
||||||
from models.schema.vendor import VendorCreate
|
from models.schema.vendor import VendorCreate
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user