fix(lint): auto-fix ruff violations and tune lint rules
- Auto-fixed 4,496 lint issues (import sorting, modern syntax, etc.) - Added ignore rules for patterns intentional in this codebase: E402 (late imports), E712 (SQLAlchemy filters), B904 (raise from), SIM108/SIM105/SIM117 (readability preferences) - Added per-file ignores for tests and scripts - Excluded broken scripts/rename_terminology.py (has curly quotes) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -41,7 +41,9 @@ def __getattr__(name: str):
|
||||
if name == "marketplace_module":
|
||||
from app.modules.marketplace.definition import marketplace_module
|
||||
return marketplace_module
|
||||
elif name == "get_marketplace_module_with_routers":
|
||||
from app.modules.marketplace.definition import get_marketplace_module_with_routers
|
||||
if name == "get_marketplace_module_with_routers":
|
||||
from app.modules.marketplace.definition import (
|
||||
get_marketplace_module_with_routers,
|
||||
)
|
||||
return get_marketplace_module_with_routers
|
||||
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||||
|
||||
@@ -8,7 +8,13 @@ dependencies, route configurations, and scheduled tasks.
|
||||
Note: This module requires the inventory module to be enabled.
|
||||
"""
|
||||
|
||||
from app.modules.base import MenuItemDefinition, MenuSectionDefinition, ModuleDefinition, PermissionDefinition, ScheduledTask
|
||||
from app.modules.base import (
|
||||
MenuItemDefinition,
|
||||
MenuSectionDefinition,
|
||||
ModuleDefinition,
|
||||
PermissionDefinition,
|
||||
ScheduledTask,
|
||||
)
|
||||
from app.modules.enums import FrontendType
|
||||
|
||||
|
||||
@@ -28,21 +34,27 @@ def _get_store_router():
|
||||
|
||||
def _get_metrics_provider():
|
||||
"""Lazy import of metrics provider to avoid circular imports."""
|
||||
from app.modules.marketplace.services.marketplace_metrics import marketplace_metrics_provider
|
||||
from app.modules.marketplace.services.marketplace_metrics import (
|
||||
marketplace_metrics_provider,
|
||||
)
|
||||
|
||||
return marketplace_metrics_provider
|
||||
|
||||
|
||||
def _get_widget_provider():
|
||||
"""Lazy import of widget provider to avoid circular imports."""
|
||||
from app.modules.marketplace.services.marketplace_widgets import marketplace_widget_provider
|
||||
from app.modules.marketplace.services.marketplace_widgets import (
|
||||
marketplace_widget_provider,
|
||||
)
|
||||
|
||||
return marketplace_widget_provider
|
||||
|
||||
|
||||
def _get_feature_provider():
|
||||
"""Lazy import of feature provider to avoid circular imports."""
|
||||
from app.modules.marketplace.services.marketplace_features import marketplace_feature_provider
|
||||
from app.modules.marketplace.services.marketplace_features import (
|
||||
marketplace_feature_provider,
|
||||
)
|
||||
|
||||
return marketplace_feature_provider
|
||||
|
||||
|
||||
@@ -4,9 +4,10 @@ Revision ID: marketplace_001
|
||||
Revises: billing_001
|
||||
Create Date: 2026-02-07
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
revision = "marketplace_001"
|
||||
down_revision = "billing_001"
|
||||
branch_labels = None
|
||||
|
||||
@@ -25,37 +25,36 @@ Usage:
|
||||
#
|
||||
# NOTE: This module owns the relationships to tenancy models (User, Store).
|
||||
# Core models should NOT have back-references to optional module models.
|
||||
from app.modules.orders.models import Order # noqa: F401
|
||||
from app.modules.tenancy.models.user import User # noqa: F401
|
||||
from app.modules.tenancy.models.store import Store # noqa: F401
|
||||
|
||||
from app.modules.marketplace.models.letzshop import (
|
||||
LetzshopFulfillmentQueue,
|
||||
# Import jobs
|
||||
LetzshopHistoricalImportJob,
|
||||
LetzshopStoreCache,
|
||||
LetzshopSyncLog,
|
||||
# Letzshop credentials and sync
|
||||
StoreLetzshopCredentials,
|
||||
)
|
||||
from app.modules.marketplace.models.marketplace_import_job import (
|
||||
MarketplaceImportError,
|
||||
MarketplaceImportJob,
|
||||
)
|
||||
from app.modules.marketplace.models.marketplace_product import (
|
||||
DigitalDeliveryMethod,
|
||||
MarketplaceProduct,
|
||||
ProductType,
|
||||
DigitalDeliveryMethod,
|
||||
)
|
||||
from app.modules.marketplace.models.marketplace_product_translation import (
|
||||
MarketplaceProductTranslation,
|
||||
)
|
||||
from app.modules.marketplace.models.marketplace_import_job import (
|
||||
MarketplaceImportJob,
|
||||
MarketplaceImportError,
|
||||
)
|
||||
from app.modules.marketplace.models.letzshop import (
|
||||
# Letzshop credentials and sync
|
||||
StoreLetzshopCredentials,
|
||||
LetzshopFulfillmentQueue,
|
||||
LetzshopStoreCache,
|
||||
LetzshopSyncLog,
|
||||
# Import jobs
|
||||
LetzshopHistoricalImportJob,
|
||||
)
|
||||
from app.modules.marketplace.models.onboarding import (
|
||||
STEP_ORDER,
|
||||
OnboardingStatus,
|
||||
OnboardingStep,
|
||||
STEP_ORDER,
|
||||
StoreOnboarding,
|
||||
)
|
||||
from app.modules.orders.models import Order # noqa: F401
|
||||
from app.modules.tenancy.models.store import Store # noqa: F401
|
||||
from app.modules.tenancy.models.user import User # noqa: F401
|
||||
|
||||
__all__ = [
|
||||
# Marketplace products
|
||||
|
||||
@@ -14,9 +14,9 @@ Includes:
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from .admin_products import admin_products_router
|
||||
from .admin_marketplace import admin_marketplace_router
|
||||
from .admin_letzshop import admin_letzshop_router
|
||||
from .admin_marketplace import admin_marketplace_router
|
||||
from .admin_products import admin_products_router
|
||||
|
||||
# Create aggregate router for auto-discovery
|
||||
# The router is named 'admin_router' for auto-discovery compatibility
|
||||
|
||||
@@ -20,19 +20,6 @@ from app.api.deps import get_current_admin_api, require_module_access
|
||||
from app.core.database import get_db
|
||||
from app.exceptions import ResourceNotFoundException, ValidationException
|
||||
from app.modules.enums import FrontendType
|
||||
from app.modules.orders.exceptions import OrderHasUnresolvedExceptionsException
|
||||
from app.modules.orders.services.order_item_exception_service import order_item_exception_service
|
||||
from app.modules.marketplace.services.letzshop import (
|
||||
CredentialsNotFoundError,
|
||||
LetzshopClientError,
|
||||
LetzshopCredentialsService,
|
||||
LetzshopOrderService,
|
||||
LetzshopStoreSyncService,
|
||||
OrderNotFoundError,
|
||||
StoreNotFoundError,
|
||||
)
|
||||
from app.modules.marketplace.tasks import process_historical_import
|
||||
from models.schema.auth import UserContext
|
||||
from app.modules.marketplace.schemas import (
|
||||
FulfillmentOperationResponse,
|
||||
LetzshopCachedStoreDetail,
|
||||
@@ -56,15 +43,28 @@ from app.modules.marketplace.schemas import (
|
||||
LetzshopOrderListResponse,
|
||||
LetzshopOrderResponse,
|
||||
LetzshopOrderStats,
|
||||
LetzshopStoreDirectoryStats,
|
||||
LetzshopStoreDirectoryStatsResponse,
|
||||
LetzshopStoreListResponse,
|
||||
LetzshopStoreOverview,
|
||||
LetzshopSuccessResponse,
|
||||
LetzshopSyncTriggerRequest,
|
||||
LetzshopSyncTriggerResponse,
|
||||
LetzshopStoreDirectoryStats,
|
||||
LetzshopStoreDirectoryStatsResponse,
|
||||
LetzshopStoreDirectorySyncResponse,
|
||||
LetzshopStoreListResponse,
|
||||
LetzshopStoreOverview,
|
||||
)
|
||||
from app.modules.marketplace.services.letzshop import (
|
||||
CredentialsNotFoundError,
|
||||
LetzshopClientError,
|
||||
LetzshopCredentialsService,
|
||||
LetzshopOrderService,
|
||||
LetzshopStoreSyncService,
|
||||
OrderNotFoundError,
|
||||
StoreNotFoundError,
|
||||
)
|
||||
from app.modules.orders.exceptions import OrderHasUnresolvedExceptionsException
|
||||
from app.modules.orders.services.order_item_exception_service import (
|
||||
order_item_exception_service,
|
||||
)
|
||||
from models.schema.auth import UserContext
|
||||
|
||||
admin_letzshop_router = APIRouter(
|
||||
prefix="/letzshop",
|
||||
@@ -1557,7 +1557,9 @@ def export_store_products_letzshop(
|
||||
"""
|
||||
from fastapi.responses import Response
|
||||
|
||||
from app.modules.marketplace.services.letzshop_export_service import letzshop_export_service
|
||||
from app.modules.marketplace.services.letzshop_export_service import (
|
||||
letzshop_export_service,
|
||||
)
|
||||
|
||||
order_service = get_order_service(db)
|
||||
|
||||
@@ -1616,7 +1618,9 @@ def export_store_products_letzshop_to_folder(
|
||||
from pathlib import Path as FilePath
|
||||
|
||||
from app.core.config import settings
|
||||
from app.modules.marketplace.services.letzshop_export_service import letzshop_export_service
|
||||
from app.modules.marketplace.services.letzshop_export_service import (
|
||||
letzshop_export_service,
|
||||
)
|
||||
|
||||
order_service = get_order_service(db)
|
||||
|
||||
|
||||
@@ -12,11 +12,9 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from app.api.deps import get_current_admin_api, require_module_access
|
||||
from app.core.database import get_db
|
||||
from app.modules.enums import FrontendType
|
||||
from app.modules.marketplace.services.marketplace_import_job_service import marketplace_import_job_service
|
||||
from app.modules.analytics.schemas import ImportStatsResponse
|
||||
from app.modules.analytics.services.stats_service import stats_service
|
||||
from app.modules.tenancy.services.store_service import store_service
|
||||
from models.schema.auth import UserContext
|
||||
from app.modules.enums import FrontendType
|
||||
from app.modules.marketplace.schemas import (
|
||||
AdminMarketplaceImportJobListResponse,
|
||||
AdminMarketplaceImportJobRequest,
|
||||
@@ -26,7 +24,11 @@ from app.modules.marketplace.schemas import (
|
||||
MarketplaceImportJobRequest,
|
||||
MarketplaceImportJobResponse,
|
||||
)
|
||||
from app.modules.analytics.schemas import ImportStatsResponse
|
||||
from app.modules.marketplace.services.marketplace_import_job_service import (
|
||||
marketplace_import_job_service,
|
||||
)
|
||||
from app.modules.tenancy.services.store_service import store_service
|
||||
from models.schema.auth import UserContext
|
||||
|
||||
admin_marketplace_router = APIRouter(
|
||||
prefix="/marketplace-import-jobs",
|
||||
|
||||
@@ -21,7 +21,9 @@ from sqlalchemy.orm import Session
|
||||
from app.api.deps import get_current_admin_api, require_module_access
|
||||
from app.core.database import get_db
|
||||
from app.modules.enums import FrontendType
|
||||
from app.modules.marketplace.services.marketplace_product_service import marketplace_product_service
|
||||
from app.modules.marketplace.services.marketplace_product_service import (
|
||||
marketplace_product_service,
|
||||
)
|
||||
from models.schema.auth import UserContext
|
||||
|
||||
admin_products_router = APIRouter(
|
||||
|
||||
@@ -18,8 +18,8 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from app.core.database import get_db
|
||||
from app.exceptions import ResourceNotFoundException
|
||||
from app.modules.marketplace.services.letzshop import LetzshopStoreSyncService
|
||||
from app.modules.marketplace.models import LetzshopStoreCache
|
||||
from app.modules.marketplace.services.letzshop import LetzshopStoreSyncService
|
||||
|
||||
router = APIRouter(prefix="/letzshop-stores")
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -13,8 +13,8 @@ Includes:
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from .store_marketplace import store_marketplace_router
|
||||
from .store_letzshop import store_letzshop_router
|
||||
from .store_marketplace import store_marketplace_router
|
||||
from .store_onboarding import store_onboarding_router
|
||||
|
||||
# Create aggregate router for auto-discovery
|
||||
|
||||
@@ -21,17 +21,7 @@ from sqlalchemy.orm import Session
|
||||
from app.api.deps import get_current_store_api, require_module_access
|
||||
from app.core.database import get_db
|
||||
from app.exceptions import ResourceNotFoundException, ValidationException
|
||||
from app.modules.orders.exceptions import OrderHasUnresolvedExceptionsException
|
||||
from app.modules.orders.services.order_item_exception_service import order_item_exception_service
|
||||
from app.modules.marketplace.services.letzshop import (
|
||||
CredentialsNotFoundError,
|
||||
LetzshopClientError,
|
||||
LetzshopCredentialsService,
|
||||
LetzshopOrderService,
|
||||
OrderNotFoundError,
|
||||
)
|
||||
from app.modules.enums import FrontendType
|
||||
from models.schema.auth import UserContext
|
||||
from app.modules.marketplace.schemas import (
|
||||
FulfillmentConfirmRequest,
|
||||
FulfillmentOperationResponse,
|
||||
@@ -54,6 +44,18 @@ from app.modules.marketplace.schemas import (
|
||||
LetzshopSyncTriggerRequest,
|
||||
LetzshopSyncTriggerResponse,
|
||||
)
|
||||
from app.modules.marketplace.services.letzshop import (
|
||||
CredentialsNotFoundError,
|
||||
LetzshopClientError,
|
||||
LetzshopCredentialsService,
|
||||
LetzshopOrderService,
|
||||
OrderNotFoundError,
|
||||
)
|
||||
from app.modules.orders.exceptions import OrderHasUnresolvedExceptionsException
|
||||
from app.modules.orders.services.order_item_exception_service import (
|
||||
order_item_exception_service,
|
||||
)
|
||||
from models.schema.auth import UserContext
|
||||
|
||||
store_letzshop_router = APIRouter(
|
||||
prefix="/letzshop",
|
||||
@@ -767,7 +769,9 @@ def export_products_letzshop(
|
||||
"""
|
||||
from fastapi.responses import Response
|
||||
|
||||
from app.modules.marketplace.services.letzshop_export_service import letzshop_export_service
|
||||
from app.modules.marketplace.services.letzshop_export_service import (
|
||||
letzshop_export_service,
|
||||
)
|
||||
from app.modules.tenancy.services.store_service import store_service
|
||||
|
||||
store_id = current_user.token_store_id
|
||||
|
||||
@@ -16,14 +16,16 @@ from sqlalchemy.orm import Session
|
||||
from app.api.deps import get_current_store_api, require_module_access
|
||||
from app.core.database import get_db
|
||||
from app.modules.enums import FrontendType
|
||||
from app.modules.marketplace.services.marketplace_import_job_service import marketplace_import_job_service
|
||||
from app.modules.tenancy.services.store_service import store_service
|
||||
from middleware.decorators import rate_limit
|
||||
from models.schema.auth import UserContext
|
||||
from app.modules.marketplace.schemas import (
|
||||
MarketplaceImportJobRequest,
|
||||
MarketplaceImportJobResponse,
|
||||
)
|
||||
from app.modules.marketplace.services.marketplace_import_job_service import (
|
||||
marketplace_import_job_service,
|
||||
)
|
||||
from app.modules.tenancy.services.store_service import store_service
|
||||
from middleware.decorators import rate_limit
|
||||
from models.schema.auth import UserContext
|
||||
|
||||
store_marketplace_router = APIRouter(
|
||||
prefix="/marketplace",
|
||||
|
||||
@@ -21,15 +21,13 @@ from sqlalchemy.orm import Session
|
||||
from app.api.deps import get_current_store_api, require_module_access
|
||||
from app.core.database import get_db
|
||||
from app.modules.enums import FrontendType
|
||||
from app.modules.marketplace.services.onboarding_service import OnboardingService
|
||||
from models.schema.auth import UserContext
|
||||
from app.modules.marketplace.schemas import (
|
||||
MerchantProfileRequest,
|
||||
MerchantProfileResponse,
|
||||
LetzshopApiConfigRequest,
|
||||
LetzshopApiConfigResponse,
|
||||
LetzshopApiTestRequest,
|
||||
LetzshopApiTestResponse,
|
||||
MerchantProfileRequest,
|
||||
MerchantProfileResponse,
|
||||
OnboardingStatusResponse,
|
||||
OrderSyncCompleteRequest,
|
||||
OrderSyncCompleteResponse,
|
||||
@@ -39,6 +37,8 @@ from app.modules.marketplace.schemas import (
|
||||
ProductImportConfigRequest,
|
||||
ProductImportConfigResponse,
|
||||
)
|
||||
from app.modules.marketplace.services.onboarding_service import OnboardingService
|
||||
from models.schema.auth import UserContext
|
||||
|
||||
store_onboarding_router = APIRouter(
|
||||
prefix="/onboarding",
|
||||
|
||||
@@ -17,9 +17,9 @@ from sqlalchemy.orm import Session
|
||||
from app.api.deps import get_db, require_menu_access
|
||||
from app.core.config import settings
|
||||
from app.modules.core.utils.page_context import get_admin_context
|
||||
from app.templates_config import templates
|
||||
from app.modules.enums import FrontendType
|
||||
from app.modules.tenancy.models import User
|
||||
from app.templates_config import templates
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ from sqlalchemy.orm import Session
|
||||
from app.api.deps import get_current_store_from_cookie_or_header, get_db
|
||||
from app.modules.core.utils.page_context import get_store_context
|
||||
from app.modules.marketplace.services.onboarding_service import OnboardingService
|
||||
from app.templates_config import templates
|
||||
from app.modules.tenancy.models import User
|
||||
from app.templates_config import templates
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@@ -12,113 +12,113 @@ Usage:
|
||||
)
|
||||
"""
|
||||
|
||||
from app.modules.marketplace.schemas.letzshop import (
|
||||
# Fulfillment
|
||||
FulfillmentConfirmRequest,
|
||||
FulfillmentOperationResponse,
|
||||
FulfillmentQueueItemResponse,
|
||||
FulfillmentQueueListResponse,
|
||||
FulfillmentRejectRequest,
|
||||
FulfillmentTrackingRequest,
|
||||
LetzshopCachedStoreDetail,
|
||||
LetzshopCachedStoreDetailResponse,
|
||||
# Store Directory
|
||||
LetzshopCachedStoreItem,
|
||||
LetzshopCachedStoreListResponse,
|
||||
# Connection
|
||||
LetzshopConnectionTestRequest,
|
||||
LetzshopConnectionTestResponse,
|
||||
LetzshopCreateStoreFromCacheResponse,
|
||||
# Credentials
|
||||
LetzshopCredentialsCreate,
|
||||
LetzshopCredentialsResponse,
|
||||
LetzshopCredentialsStatus,
|
||||
LetzshopCredentialsUpdate,
|
||||
LetzshopExportFileInfo,
|
||||
# Product Export
|
||||
LetzshopExportRequest,
|
||||
LetzshopExportResponse,
|
||||
# Historical Import
|
||||
LetzshopHistoricalImportJobResponse,
|
||||
LetzshopHistoricalImportStartResponse,
|
||||
# Jobs
|
||||
LetzshopJobItem,
|
||||
LetzshopJobsListResponse,
|
||||
LetzshopOrderDetailResponse,
|
||||
# Orders
|
||||
LetzshopOrderItemResponse,
|
||||
LetzshopOrderListResponse,
|
||||
LetzshopOrderResponse,
|
||||
LetzshopOrderStats,
|
||||
LetzshopStoreDirectoryStats,
|
||||
LetzshopStoreDirectoryStatsResponse,
|
||||
LetzshopStoreDirectorySyncResponse,
|
||||
LetzshopStoreListResponse,
|
||||
# Admin
|
||||
LetzshopStoreOverview,
|
||||
LetzshopSuccessResponse,
|
||||
LetzshopSyncLogListResponse,
|
||||
# Sync
|
||||
LetzshopSyncLogResponse,
|
||||
LetzshopSyncTriggerRequest,
|
||||
LetzshopSyncTriggerResponse,
|
||||
)
|
||||
from app.modules.marketplace.schemas.marketplace_import_job import (
|
||||
MarketplaceImportJobRequest,
|
||||
AdminMarketplaceImportJobRequest,
|
||||
MarketplaceImportJobResponse,
|
||||
MarketplaceImportJobListResponse,
|
||||
MarketplaceImportErrorResponse,
|
||||
MarketplaceImportErrorListResponse,
|
||||
AdminMarketplaceImportJobResponse,
|
||||
AdminMarketplaceImportJobListResponse,
|
||||
AdminMarketplaceImportJobRequest,
|
||||
AdminMarketplaceImportJobResponse,
|
||||
MarketplaceImportErrorListResponse,
|
||||
MarketplaceImportErrorResponse,
|
||||
MarketplaceImportJobListResponse,
|
||||
MarketplaceImportJobRequest,
|
||||
MarketplaceImportJobResponse,
|
||||
MarketplaceImportJobStatusUpdate,
|
||||
)
|
||||
from app.modules.marketplace.schemas.marketplace_product import (
|
||||
# Translation schemas
|
||||
MarketplaceProductTranslationSchema,
|
||||
# Import schemas
|
||||
MarketplaceImportRequest,
|
||||
MarketplaceImportResponse,
|
||||
# Base schemas
|
||||
MarketplaceProductBase,
|
||||
# CRUD schemas
|
||||
MarketplaceProductCreate,
|
||||
MarketplaceProductUpdate,
|
||||
MarketplaceProductDetailResponse,
|
||||
MarketplaceProductListResponse,
|
||||
# Response schemas
|
||||
MarketplaceProductResponse,
|
||||
MarketplaceProductListResponse,
|
||||
MarketplaceProductDetailResponse,
|
||||
# Import schemas
|
||||
MarketplaceImportRequest,
|
||||
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
|
||||
LetzshopStoreOverview,
|
||||
LetzshopStoreListResponse,
|
||||
# Jobs
|
||||
LetzshopJobItem,
|
||||
LetzshopJobsListResponse,
|
||||
# Historical Import
|
||||
LetzshopHistoricalImportJobResponse,
|
||||
LetzshopHistoricalImportStartResponse,
|
||||
# Store Directory
|
||||
LetzshopCachedStoreItem,
|
||||
LetzshopCachedStoreDetail,
|
||||
LetzshopStoreDirectoryStats,
|
||||
LetzshopStoreDirectoryStatsResponse,
|
||||
LetzshopCachedStoreListResponse,
|
||||
LetzshopCachedStoreDetailResponse,
|
||||
LetzshopStoreDirectorySyncResponse,
|
||||
LetzshopCreateStoreFromCacheResponse,
|
||||
# Product Export
|
||||
LetzshopExportRequest,
|
||||
LetzshopExportFileInfo,
|
||||
LetzshopExportResponse,
|
||||
# Translation schemas
|
||||
MarketplaceProductTranslationSchema,
|
||||
MarketplaceProductUpdate,
|
||||
)
|
||||
from app.modules.marketplace.schemas.onboarding import (
|
||||
# Step status
|
||||
StepStatus,
|
||||
MerchantProfileStepStatus,
|
||||
# Step 2
|
||||
LetzshopApiConfigRequest,
|
||||
LetzshopApiConfigResponse,
|
||||
LetzshopApiStepStatus,
|
||||
ProductImportStepStatus,
|
||||
OrderSyncStepStatus,
|
||||
# Main status
|
||||
OnboardingStatusResponse,
|
||||
LetzshopApiTestRequest,
|
||||
LetzshopApiTestResponse,
|
||||
# Step 1
|
||||
MerchantProfileRequest,
|
||||
MerchantProfileResponse,
|
||||
# Step 2
|
||||
LetzshopApiConfigRequest,
|
||||
LetzshopApiTestRequest,
|
||||
LetzshopApiTestResponse,
|
||||
LetzshopApiConfigResponse,
|
||||
# Step 3
|
||||
ProductImportConfigRequest,
|
||||
ProductImportConfigResponse,
|
||||
# Step 4
|
||||
OrderSyncTriggerRequest,
|
||||
OrderSyncTriggerResponse,
|
||||
OrderSyncProgressResponse,
|
||||
OrderSyncCompleteRequest,
|
||||
OrderSyncCompleteResponse,
|
||||
MerchantProfileStepStatus,
|
||||
# Admin
|
||||
OnboardingSkipRequest,
|
||||
OnboardingSkipResponse,
|
||||
# Main status
|
||||
OnboardingStatusResponse,
|
||||
OrderSyncCompleteRequest,
|
||||
OrderSyncCompleteResponse,
|
||||
OrderSyncProgressResponse,
|
||||
OrderSyncStepStatus,
|
||||
# Step 4
|
||||
OrderSyncTriggerRequest,
|
||||
OrderSyncTriggerResponse,
|
||||
# Step 3
|
||||
ProductImportConfigRequest,
|
||||
ProductImportConfigResponse,
|
||||
ProductImportStepStatus,
|
||||
# Step status
|
||||
StepStatus,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
|
||||
@@ -15,7 +15,6 @@ from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# STEP STATUS MODELS
|
||||
# =============================================================================
|
||||
|
||||
@@ -6,6 +6,18 @@ This module contains the canonical implementations of marketplace-related servic
|
||||
"""
|
||||
|
||||
# Main marketplace services
|
||||
# Letzshop submodule services
|
||||
from app.modules.marketplace.services.letzshop import (
|
||||
LetzshopClient,
|
||||
LetzshopClientError,
|
||||
)
|
||||
from app.modules.marketplace.services.letzshop.credentials_service import (
|
||||
LetzshopCredentialsService,
|
||||
)
|
||||
from app.modules.marketplace.services.letzshop.order_service import LetzshopOrderService
|
||||
from app.modules.marketplace.services.letzshop.store_sync_service import (
|
||||
LetzshopStoreSyncService,
|
||||
)
|
||||
from app.modules.marketplace.services.letzshop_export_service import (
|
||||
LetzshopExportService,
|
||||
letzshop_export_service,
|
||||
@@ -23,24 +35,11 @@ from app.modules.marketplace.services.onboarding_service import (
|
||||
get_onboarding_service,
|
||||
)
|
||||
from app.modules.marketplace.services.platform_signup_service import (
|
||||
PlatformSignupService,
|
||||
platform_signup_service,
|
||||
SignupSessionData,
|
||||
AccountCreationResult,
|
||||
PlatformSignupService,
|
||||
SignupCompletionResult,
|
||||
)
|
||||
|
||||
# Letzshop submodule services
|
||||
from app.modules.marketplace.services.letzshop import (
|
||||
LetzshopClient,
|
||||
LetzshopClientError,
|
||||
)
|
||||
from app.modules.marketplace.services.letzshop.credentials_service import (
|
||||
LetzshopCredentialsService,
|
||||
)
|
||||
from app.modules.marketplace.services.letzshop.order_service import LetzshopOrderService
|
||||
from app.modules.marketplace.services.letzshop.store_sync_service import (
|
||||
LetzshopStoreSyncService,
|
||||
SignupSessionData,
|
||||
platform_signup_service,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
|
||||
@@ -8,7 +8,8 @@ for all Letzshop API operations.
|
||||
|
||||
import logging
|
||||
import time
|
||||
from typing import Any, Callable
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ from datetime import UTC, datetime
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.utils.encryption import decrypt_value, encrypt_value, mask_api_key
|
||||
from app.modules.marketplace.models import StoreLetzshopCredentials
|
||||
from app.utils.encryption import decrypt_value, encrypt_value, mask_api_key
|
||||
|
||||
from .client_service import LetzshopClient
|
||||
|
||||
|
||||
@@ -8,14 +8,15 @@ with `channel='letzshop'`.
|
||||
"""
|
||||
|
||||
import logging
|
||||
from collections.abc import Callable
|
||||
from datetime import UTC, datetime
|
||||
from typing import Any, Callable
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import String, and_, func, or_
|
||||
from sqlalchemy import func, or_
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.modules.orders.services.order_service import order_service as unified_order_service
|
||||
from app.modules.billing.services.subscription_service import subscription_service
|
||||
from app.modules.catalog.models import Product
|
||||
from app.modules.marketplace.models import (
|
||||
LetzshopFulfillmentQueue,
|
||||
LetzshopHistoricalImportJob,
|
||||
@@ -24,7 +25,9 @@ from app.modules.marketplace.models import (
|
||||
StoreLetzshopCredentials,
|
||||
)
|
||||
from app.modules.orders.models import Order, OrderItem
|
||||
from app.modules.catalog.models import Product
|
||||
from app.modules.orders.services.order_service import (
|
||||
order_service as unified_order_service,
|
||||
)
|
||||
from app.modules.tenancy.models import Store
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -1049,7 +1052,7 @@ class LetzshopOrderService:
|
||||
return {
|
||||
"total_orders": total_orders,
|
||||
"unique_customers": unique_customers,
|
||||
"orders_by_status": {status: count for status, count in status_counts},
|
||||
"orders_by_status": dict(status_counts),
|
||||
"orders_by_locale": {
|
||||
locale or "unknown": count for locale, count in locale_counts
|
||||
},
|
||||
|
||||
@@ -7,16 +7,17 @@ in the letzshop_store_cache table for fast lookups during signup.
|
||||
"""
|
||||
|
||||
import logging
|
||||
from collections.abc import Callable
|
||||
from datetime import UTC, datetime
|
||||
from typing import Any, Callable
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import func
|
||||
from sqlalchemy.dialects.postgresql import insert as pg_insert
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from .client_service import LetzshopClient
|
||||
from app.modules.marketplace.models import LetzshopStoreCache
|
||||
|
||||
from .client_service import LetzshopClient
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -146,14 +147,13 @@ class LetzshopStoreSyncService:
|
||||
setattr(existing, key, value)
|
||||
existing.last_synced_at = datetime.now(UTC)
|
||||
return "updated"
|
||||
else:
|
||||
# Create new record
|
||||
cache_entry = LetzshopStoreCache(
|
||||
**parsed,
|
||||
last_synced_at=datetime.now(UTC),
|
||||
)
|
||||
self.db.add(cache_entry)
|
||||
return "created"
|
||||
# Create new record
|
||||
cache_entry = LetzshopStoreCache(
|
||||
**parsed,
|
||||
last_synced_at=datetime.now(UTC),
|
||||
)
|
||||
self.db.add(cache_entry)
|
||||
return "created"
|
||||
|
||||
def _parse_store_data(self, data: dict[str, Any]) -> dict[str, Any]:
|
||||
"""
|
||||
@@ -436,10 +436,9 @@ class LetzshopStoreSyncService:
|
||||
|
||||
from sqlalchemy import func
|
||||
|
||||
from app.modules.tenancy.services.admin_service import admin_service
|
||||
from app.modules.tenancy.models import Merchant
|
||||
from app.modules.tenancy.models import Store
|
||||
from app.modules.tenancy.models import Merchant, Store
|
||||
from app.modules.tenancy.schemas.store import StoreCreate
|
||||
from app.modules.tenancy.services.admin_service import admin_service
|
||||
|
||||
# Get cache entry
|
||||
cache_entry = self.get_cached_store(letzshop_slug)
|
||||
|
||||
@@ -8,12 +8,12 @@ Generates Google Shopping compatible CSV files for Letzshop marketplace.
|
||||
import csv
|
||||
import io
|
||||
import logging
|
||||
from datetime import UTC, datetime
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy.orm import Session, joinedload
|
||||
|
||||
from app.modules.marketplace.models import LetzshopSyncLog, MarketplaceProduct
|
||||
from app.modules.catalog.models import Product
|
||||
from app.modules.marketplace.models import LetzshopSyncLog, MarketplaceProduct
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ from typing import TYPE_CHECKING
|
||||
|
||||
from app.modules.contracts.features import (
|
||||
FeatureDeclaration,
|
||||
FeatureProviderProtocol,
|
||||
FeatureScope,
|
||||
FeatureType,
|
||||
FeatureUsage,
|
||||
|
||||
@@ -12,13 +12,12 @@ from app.modules.marketplace.models import (
|
||||
MarketplaceImportError,
|
||||
MarketplaceImportJob,
|
||||
)
|
||||
from app.modules.tenancy.models import User
|
||||
from app.modules.tenancy.models import Store
|
||||
from app.modules.marketplace.schemas import (
|
||||
AdminMarketplaceImportJobResponse,
|
||||
MarketplaceImportJobRequest,
|
||||
MarketplaceImportJobResponse,
|
||||
)
|
||||
from app.modules.tenancy.models import Store, User
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -16,9 +16,8 @@ from sqlalchemy import func
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.modules.contracts.metrics import (
|
||||
MetricValue,
|
||||
MetricsContext,
|
||||
MetricsProviderProtocol,
|
||||
MetricValue,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -51,7 +50,10 @@ class MarketplaceMetricsProvider:
|
||||
- Imported products (staging)
|
||||
- Import job statistics
|
||||
"""
|
||||
from app.modules.marketplace.models import MarketplaceImportJob, MarketplaceProduct
|
||||
from app.modules.marketplace.models import (
|
||||
MarketplaceImportJob,
|
||||
MarketplaceProduct,
|
||||
)
|
||||
from app.modules.tenancy.models import Store
|
||||
|
||||
try:
|
||||
@@ -194,7 +196,10 @@ class MarketplaceMetricsProvider:
|
||||
|
||||
Aggregates import and staging data across all stores.
|
||||
"""
|
||||
from app.modules.marketplace.models import MarketplaceImportJob, MarketplaceProduct
|
||||
from app.modules.marketplace.models import (
|
||||
MarketplaceImportJob,
|
||||
MarketplaceProduct,
|
||||
)
|
||||
from app.modules.tenancy.models import StorePlatform
|
||||
|
||||
try:
|
||||
|
||||
@@ -23,23 +23,26 @@ from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.orm import Session, joinedload
|
||||
|
||||
from app.exceptions import ValidationException
|
||||
from app.modules.inventory.models import Inventory
|
||||
from app.modules.inventory.schemas import (
|
||||
InventoryLocationResponse,
|
||||
InventorySummaryResponse,
|
||||
)
|
||||
from app.modules.marketplace.exceptions import (
|
||||
InvalidMarketplaceProductDataException,
|
||||
MarketplaceProductAlreadyExistsException,
|
||||
MarketplaceProductNotFoundException,
|
||||
MarketplaceProductValidationException,
|
||||
)
|
||||
from app.utils.data_processing import GTINProcessor, PriceProcessor
|
||||
from app.modules.inventory.models import Inventory
|
||||
from app.modules.marketplace.models import (
|
||||
MarketplaceProduct,
|
||||
MarketplaceProductTranslation,
|
||||
)
|
||||
from app.modules.inventory.schemas import InventoryLocationResponse, InventorySummaryResponse
|
||||
from app.modules.marketplace.schemas import (
|
||||
MarketplaceProductCreate,
|
||||
MarketplaceProductUpdate,
|
||||
)
|
||||
from app.utils.data_processing import GTINProcessor, PriceProcessor
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -859,8 +862,7 @@ class MarketplaceProductService:
|
||||
Returns:
|
||||
Dict with copied, skipped, failed counts and details
|
||||
"""
|
||||
from app.modules.catalog.models import Product
|
||||
from app.modules.catalog.models import ProductTranslation
|
||||
from app.modules.catalog.models import Product, ProductTranslation
|
||||
from app.modules.tenancy.models import Store
|
||||
|
||||
store = db.query(Store).filter(Store.id == store_id).first()
|
||||
@@ -880,9 +882,10 @@ class MarketplaceProductService:
|
||||
raise MarketplaceProductNotFoundException("No marketplace products found")
|
||||
|
||||
# Check product limit from subscription
|
||||
from app.modules.billing.services.feature_service import feature_service
|
||||
from sqlalchemy import func
|
||||
|
||||
from app.modules.billing.services.feature_service import feature_service
|
||||
|
||||
current_products = (
|
||||
db.query(func.count(Product.id))
|
||||
.filter(Product.store_id == store_id)
|
||||
|
||||
@@ -16,7 +16,6 @@ from sqlalchemy.orm import Session
|
||||
from app.modules.contracts.widgets import (
|
||||
BreakdownWidget,
|
||||
DashboardWidget,
|
||||
DashboardWidgetProviderProtocol,
|
||||
ListWidget,
|
||||
WidgetBreakdownItem,
|
||||
WidgetContext,
|
||||
@@ -140,7 +139,7 @@ class MarketplaceWidgetProvider:
|
||||
from sqlalchemy.orm import joinedload
|
||||
|
||||
from app.modules.marketplace.models import MarketplaceImportJob
|
||||
from app.modules.tenancy.models import Store, StorePlatform
|
||||
from app.modules.tenancy.models import StorePlatform
|
||||
|
||||
limit = context.limit if context else 5
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ from datetime import UTC, datetime
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.modules.tenancy.exceptions import StoreNotFoundException
|
||||
from app.modules.marketplace.exceptions import (
|
||||
OnboardingCsvUrlRequiredException,
|
||||
OnboardingNotFoundException,
|
||||
@@ -22,15 +21,16 @@ from app.modules.marketplace.exceptions import (
|
||||
OnboardingSyncJobNotFoundException,
|
||||
OnboardingSyncNotCompleteException,
|
||||
)
|
||||
from app.modules.marketplace.services.letzshop import (
|
||||
LetzshopCredentialsService,
|
||||
LetzshopOrderService,
|
||||
)
|
||||
from app.modules.marketplace.models import (
|
||||
OnboardingStatus,
|
||||
OnboardingStep,
|
||||
StoreOnboarding,
|
||||
)
|
||||
from app.modules.marketplace.services.letzshop import (
|
||||
LetzshopCredentialsService,
|
||||
LetzshopOrderService,
|
||||
)
|
||||
from app.modules.tenancy.exceptions import StoreNotFoundException
|
||||
from app.modules.tenancy.models import Store
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -295,14 +295,13 @@ class OnboardingService:
|
||||
"store_id": None,
|
||||
"shop_slug": shop_slug,
|
||||
}
|
||||
else:
|
||||
return {
|
||||
"success": False,
|
||||
"message": error or "Connection failed",
|
||||
"store_name": None,
|
||||
"store_id": None,
|
||||
"shop_slug": None,
|
||||
}
|
||||
return {
|
||||
"success": False,
|
||||
"message": error or "Connection failed",
|
||||
"store_name": None,
|
||||
"store_id": None,
|
||||
"shop_slug": None,
|
||||
}
|
||||
|
||||
def complete_letzshop_api(
|
||||
self,
|
||||
|
||||
@@ -11,8 +11,8 @@ Handles all database operations for the platform signup flow:
|
||||
|
||||
import logging
|
||||
import secrets
|
||||
from datetime import UTC, datetime, timedelta
|
||||
from dataclasses import dataclass
|
||||
from datetime import UTC, datetime, timedelta
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
@@ -22,20 +22,26 @@ from app.exceptions import (
|
||||
ResourceNotFoundException,
|
||||
ValidationException,
|
||||
)
|
||||
from app.modules.messaging.services.email_service import EmailService
|
||||
from app.modules.marketplace.services.onboarding_service import OnboardingService
|
||||
from app.modules.billing.services.stripe_service import stripe_service
|
||||
from middleware.auth import AuthManager
|
||||
from app.modules.tenancy.models import Merchant
|
||||
from app.modules.billing.models import (
|
||||
SubscriptionStatus,
|
||||
SubscriptionTier,
|
||||
TierCode,
|
||||
)
|
||||
from app.modules.billing.services.subscription_service import subscription_service as sub_service
|
||||
from app.modules.tenancy.models import User
|
||||
from app.modules.tenancy.models import Store, StorePlatform, StoreUser, StoreUserType
|
||||
from app.modules.tenancy.models import Platform
|
||||
from app.modules.billing.services.stripe_service import stripe_service
|
||||
from app.modules.billing.services.subscription_service import (
|
||||
subscription_service as sub_service,
|
||||
)
|
||||
from app.modules.marketplace.services.onboarding_service import OnboardingService
|
||||
from app.modules.messaging.services.email_service import EmailService
|
||||
from app.modules.tenancy.models import (
|
||||
Merchant,
|
||||
Platform,
|
||||
Store,
|
||||
StorePlatform,
|
||||
StoreUser,
|
||||
StoreUserType,
|
||||
User,
|
||||
)
|
||||
from middleware.auth import AuthManager
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -221,7 +227,7 @@ class PlatformSignupService:
|
||||
ResourceNotFoundException: If session not found
|
||||
ConflictException: If store already claimed
|
||||
"""
|
||||
session = self.get_session_or_raise(session_id)
|
||||
self.get_session_or_raise(session_id)
|
||||
|
||||
# Check if store is already claimed
|
||||
if self.check_store_claimed(db, letzshop_slug):
|
||||
|
||||
@@ -9,17 +9,17 @@ Tasks for:
|
||||
- Product export to Letzshop CSV format
|
||||
"""
|
||||
|
||||
from app.modules.marketplace.tasks.export_tasks import (
|
||||
export_marketplace_products,
|
||||
export_store_products_to_folder,
|
||||
)
|
||||
from app.modules.marketplace.tasks.import_tasks import (
|
||||
process_marketplace_import,
|
||||
process_historical_import,
|
||||
process_marketplace_import,
|
||||
)
|
||||
from app.modules.marketplace.tasks.sync_tasks import (
|
||||
sync_store_directory,
|
||||
)
|
||||
from app.modules.marketplace.tasks.export_tasks import (
|
||||
export_store_products_to_folder,
|
||||
export_marketplace_products,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
# Import tasks
|
||||
|
||||
@@ -40,7 +40,9 @@ def export_store_products_to_folder(
|
||||
Returns:
|
||||
dict: Export results per language with file paths
|
||||
"""
|
||||
from app.modules.marketplace.services.letzshop_export_service import letzshop_export_service
|
||||
from app.modules.marketplace.services.letzshop_export_service import (
|
||||
letzshop_export_service,
|
||||
)
|
||||
|
||||
languages = ["en", "fr", "de"]
|
||||
results = {}
|
||||
@@ -149,7 +151,9 @@ def export_marketplace_products(
|
||||
Returns:
|
||||
dict: Export result with file path
|
||||
"""
|
||||
from app.modules.marketplace.services.letzshop_export_service import letzshop_export_service
|
||||
from app.modules.marketplace.services.letzshop_export_service import (
|
||||
letzshop_export_service,
|
||||
)
|
||||
|
||||
with self.get_db() as db:
|
||||
started_at = datetime.now(UTC)
|
||||
|
||||
@@ -9,20 +9,25 @@ Includes:
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from collections.abc import Callable
|
||||
from datetime import UTC, datetime
|
||||
from typing import Callable
|
||||
|
||||
from app.core.celery_config import celery_app
|
||||
from app.modules.marketplace.models import MarketplaceImportJob, LetzshopHistoricalImportJob
|
||||
from app.modules.messaging.services.admin_notification_service import admin_notification_service
|
||||
from app.modules.marketplace.models import (
|
||||
LetzshopHistoricalImportJob,
|
||||
MarketplaceImportJob,
|
||||
)
|
||||
from app.modules.marketplace.services.letzshop import (
|
||||
LetzshopClientError,
|
||||
LetzshopCredentialsService,
|
||||
LetzshopOrderService,
|
||||
)
|
||||
from app.modules.messaging.services.admin_notification_service import (
|
||||
admin_notification_service,
|
||||
)
|
||||
from app.modules.task_base import ModuleTask
|
||||
from app.utils.csv_processor import CSVProcessor
|
||||
from app.modules.tenancy.models import Store
|
||||
from app.utils.csv_processor import CSVProcessor
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -9,9 +9,11 @@ import logging
|
||||
from typing import Any
|
||||
|
||||
from app.core.celery_config import celery_app
|
||||
from app.modules.task_base import ModuleTask
|
||||
from app.modules.messaging.services.admin_notification_service import admin_notification_service
|
||||
from app.modules.marketplace.services.letzshop import LetzshopStoreSyncService
|
||||
from app.modules.messaging.services.admin_notification_service import (
|
||||
admin_notification_service,
|
||||
)
|
||||
from app.modules.task_base import ModuleTask
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -16,16 +16,11 @@ import uuid
|
||||
|
||||
import pytest
|
||||
|
||||
from app.exceptions import ValidationException
|
||||
from app.modules.marketplace.exceptions import (
|
||||
InvalidMarketplaceProductDataException,
|
||||
MarketplaceProductNotFoundException,
|
||||
MarketplaceProductValidationException,
|
||||
)
|
||||
from app.modules.marketplace.services.marketplace_product_service import (
|
||||
MarketplaceProductService,
|
||||
marketplace_product_service,
|
||||
)
|
||||
from app.modules.marketplace.models import (
|
||||
MarketplaceProduct,
|
||||
MarketplaceProductTranslation,
|
||||
@@ -34,6 +29,10 @@ from app.modules.marketplace.schemas import (
|
||||
MarketplaceProductCreate,
|
||||
MarketplaceProductUpdate,
|
||||
)
|
||||
from app.modules.marketplace.services.marketplace_product_service import (
|
||||
MarketplaceProductService,
|
||||
marketplace_product_service,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
|
||||
@@ -15,8 +15,12 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from app.modules.marketplace.models import (
|
||||
OnboardingStatus,
|
||||
OnboardingStep,
|
||||
StoreOnboarding,
|
||||
)
|
||||
from app.modules.marketplace.services.onboarding_service import OnboardingService
|
||||
from app.modules.marketplace.models import OnboardingStatus, OnboardingStep, StoreOnboarding
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@@ -525,7 +529,9 @@ class TestOnboardingServiceStep4:
|
||||
|
||||
def test_complete_order_sync_raises_for_missing_job(self, db, test_store):
|
||||
"""Test complete_order_sync raises for non-existent job"""
|
||||
from app.modules.marketplace.exceptions import OnboardingSyncJobNotFoundException
|
||||
from app.modules.marketplace.exceptions import (
|
||||
OnboardingSyncJobNotFoundException,
|
||||
)
|
||||
|
||||
onboarding = StoreOnboarding(
|
||||
store_id=test_store.id,
|
||||
@@ -550,7 +556,9 @@ class TestOnboardingServiceStep4:
|
||||
|
||||
def test_complete_order_sync_raises_if_not_complete(self, db, test_store):
|
||||
"""Test complete_order_sync raises if job still running"""
|
||||
from app.modules.marketplace.exceptions import OnboardingSyncNotCompleteException
|
||||
from app.modules.marketplace.exceptions import (
|
||||
OnboardingSyncNotCompleteException,
|
||||
)
|
||||
|
||||
onboarding = StoreOnboarding(
|
||||
store_id=test_store.id,
|
||||
|
||||
@@ -7,11 +7,13 @@ from app.modules.marketplace.exceptions import (
|
||||
MarketplaceProductNotFoundException,
|
||||
MarketplaceProductValidationException,
|
||||
)
|
||||
from app.modules.marketplace.services.marketplace_product_service import MarketplaceProductService
|
||||
from app.modules.marketplace.schemas import (
|
||||
MarketplaceProductCreate,
|
||||
MarketplaceProductUpdate,
|
||||
)
|
||||
from app.modules.marketplace.services.marketplace_product_service import (
|
||||
MarketplaceProductService,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
|
||||
Reference in New Issue
Block a user