refactor: migrate models to canonical module locations
- Move Product/ProductTranslation to app/modules/catalog/models/ - Move VendorOnboarding to app/modules/marketplace/models/ - Delete legacy re-export files for marketplace models: - letzshop.py, marketplace.py, marketplace_product.py - marketplace_product_translation.py, marketplace_import_job.py - Delete legacy product.py, product_translation.py, onboarding.py - Update all imports across services, tasks, tests to use module locations Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -108,14 +108,14 @@ except ImportError as e:
|
|||||||
# PRODUCT MODELS
|
# PRODUCT MODELS
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
try:
|
try:
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
print(" ✓ Product model imported")
|
print(" ✓ Product model imported")
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
print(f" ✗ Product model failed: {e}")
|
print(f" ✗ Product model failed: {e}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import MarketplaceProduct
|
||||||
|
|
||||||
print(" ✓ MarketplaceProduct model imported")
|
print(" ✓ MarketplaceProduct model imported")
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
@@ -135,7 +135,7 @@ except ImportError as e:
|
|||||||
# MARKETPLACE IMPORT
|
# MARKETPLACE IMPORT
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
try:
|
try:
|
||||||
from models.database.marketplace_import_job import MarketplaceImportJob
|
from app.modules.marketplace.models import MarketplaceImportJob
|
||||||
|
|
||||||
print(" ✓ MarketplaceImportJob model imported")
|
print(" ✓ MarketplaceImportJob model imported")
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ from sqlalchemy.orm import Session
|
|||||||
from app.core.database import get_db
|
from app.core.database import get_db
|
||||||
from app.services.letzshop.vendor_sync_service import LetzshopVendorSyncService
|
from app.services.letzshop.vendor_sync_service import LetzshopVendorSyncService
|
||||||
from app.services.platform_signup_service import platform_signup_service
|
from app.services.platform_signup_service import platform_signup_service
|
||||||
from models.database.letzshop import LetzshopVendorCache
|
from app.modules.marketplace.models import LetzshopVendorCache
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -21,10 +21,9 @@ from sqlalchemy.orm import Session
|
|||||||
from app.exceptions import AdminOperationException, VendorNotFoundException
|
from app.exceptions import AdminOperationException, VendorNotFoundException
|
||||||
from app.modules.customers.models.customer import Customer
|
from app.modules.customers.models.customer import Customer
|
||||||
from app.modules.inventory.models import Inventory
|
from app.modules.inventory.models import Inventory
|
||||||
from models.database.marketplace_import_job import MarketplaceImportJob
|
from app.modules.marketplace.models import MarketplaceImportJob, MarketplaceProduct
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
|
||||||
from app.modules.orders.models import Order
|
from app.modules.orders.models import Order
|
||||||
from models.database.product 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
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ from dataclasses import dataclass
|
|||||||
from sqlalchemy import func
|
from sqlalchemy import func
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.database.subscription import SubscriptionTier, VendorSubscription
|
from models.database.subscription import SubscriptionTier, VendorSubscription
|
||||||
from models.database.vendor import VendorUser
|
from models.database.vendor import VendorUser
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ from app.modules.billing.models import (
|
|||||||
SubscriptionTier,
|
SubscriptionTier,
|
||||||
VendorSubscription,
|
VendorSubscription,
|
||||||
)
|
)
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.database.vendor import Vendor, VendorUser
|
from models.database.vendor import Vendor, VendorUser
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ from app.modules.billing.schemas import (
|
|||||||
TierLimits,
|
TierLimits,
|
||||||
UsageSummary,
|
UsageSummary,
|
||||||
)
|
)
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.database.vendor import Vendor, VendorUser
|
from models.database.vendor import Vendor, VendorUser
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ from app.exceptions import (
|
|||||||
)
|
)
|
||||||
from app.utils.money import cents_to_euros
|
from app.utils.money import cents_to_euros
|
||||||
from app.modules.cart.models.cart import CartItem
|
from app.modules.cart.models.cart import CartItem
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,16 @@
|
|||||||
"""
|
"""
|
||||||
Catalog module models.
|
Catalog module models.
|
||||||
|
|
||||||
Note: The catalog module uses the Product model from the products module.
|
This is the canonical location for product models.
|
||||||
This file exists for consistency with the module structure.
|
|
||||||
|
Usage:
|
||||||
|
from app.modules.catalog.models import Product, ProductTranslation
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from app.modules.catalog.models.product import Product
|
||||||
|
from app.modules.catalog.models.product_translation import ProductTranslation
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"Product",
|
||||||
|
"ProductTranslation",
|
||||||
|
]
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# app/modules/catalog/models/product.py
|
||||||
"""Vendor Product model - independent copy pattern.
|
"""Vendor Product model - independent copy pattern.
|
||||||
|
|
||||||
This model represents a vendor's product. Products can be:
|
This model represents a vendor's product. Products can be:
|
||||||
@@ -7,7 +8,7 @@ This model represents a vendor's product. Products can be:
|
|||||||
When created from marketplace, the marketplace_product_id FK provides
|
When created from marketplace, the marketplace_product_id FK provides
|
||||||
"view original source" comparison feature.
|
"view original source" comparison feature.
|
||||||
|
|
||||||
Money values are stored as integer cents (e.g., €105.91 = 10591).
|
Money values are stored as integer cents (e.g., 105.91 = 10591).
|
||||||
See docs/architecture/money-handling.md for details.
|
See docs/architecture/money-handling.md for details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -34,7 +35,7 @@ class Product(Base, TimestampMixin):
|
|||||||
Products can be created from marketplace imports or directly by vendors.
|
Products can be created from marketplace imports or directly by vendors.
|
||||||
When from marketplace, marketplace_product_id provides source comparison.
|
When from marketplace, marketplace_product_id provides source comparison.
|
||||||
|
|
||||||
Price fields use integer cents for precision (€19.99 = 1999 cents).
|
Price fields use integer cents for precision (19.99 = 1999 cents).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__tablename__ = "products"
|
__tablename__ = "products"
|
||||||
@@ -55,7 +56,7 @@ class Product(Base, TimestampMixin):
|
|||||||
gtin_type = Column(String(20)) # Format: gtin13, gtin14, gtin12, gtin8, isbn13, isbn10
|
gtin_type = Column(String(20)) # Format: gtin13, gtin14, gtin12, gtin8, isbn13, isbn10
|
||||||
|
|
||||||
# === PRODUCT FIELDS (copied from marketplace at creation) ===
|
# === PRODUCT FIELDS (copied from marketplace at creation) ===
|
||||||
# Pricing - stored as integer cents (€19.99 = 1999)
|
# Pricing - stored as integer cents (19.99 = 1999)
|
||||||
price_cents = Column(Integer) # Price in cents
|
price_cents = Column(Integer) # Price in cents
|
||||||
sale_price_cents = Column(Integer) # Sale price in cents
|
sale_price_cents = Column(Integer) # Sale price in cents
|
||||||
currency = Column(String(3), default="EUR")
|
currency = Column(String(3), default="EUR")
|
||||||
@@ -188,7 +189,7 @@ class Product(Base, TimestampMixin):
|
|||||||
"""Calculate net price (excluding VAT) from gross price.
|
"""Calculate net price (excluding VAT) from gross price.
|
||||||
|
|
||||||
Formula: Net = Gross / (1 + rate/100)
|
Formula: Net = Gross / (1 + rate/100)
|
||||||
Example: €119 gross at 17% VAT = €119 / 1.17 = €101.71 net
|
Example: 119 gross at 17% VAT = 119 / 1.17 = 101.71 net
|
||||||
"""
|
"""
|
||||||
if self.price_cents is None:
|
if self.price_cents is None:
|
||||||
return None
|
return None
|
||||||
@@ -244,7 +245,7 @@ class Product(Base, TimestampMixin):
|
|||||||
"""Calculate profit margin as percentage of net revenue.
|
"""Calculate profit margin as percentage of net revenue.
|
||||||
|
|
||||||
Formula: Margin% = (Profit / Net) * 100
|
Formula: Margin% = (Profit / Net) * 100
|
||||||
Example: €41.71 profit on €101.71 net = 41.0% margin
|
Example: 41.71 profit on 101.71 net = 41.0% margin
|
||||||
"""
|
"""
|
||||||
net = self.net_price_cents
|
net = self.net_price_cents
|
||||||
profit = self.profit_cents
|
profit = self.profit_cents
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# app/modules/catalog/models/product_translation.py
|
||||||
"""Product Translation model for vendor-specific localized content.
|
"""Product Translation model for vendor-specific localized content.
|
||||||
|
|
||||||
This model stores vendor-specific translations. Translations are independent
|
This model stores vendor-specific translations. Translations are independent
|
||||||
@@ -18,8 +18,7 @@ from sqlalchemy import or_
|
|||||||
from sqlalchemy.orm import Session, joinedload
|
from sqlalchemy.orm import Session, joinedload
|
||||||
|
|
||||||
from app.exceptions import ProductNotFoundException, ValidationException
|
from app.exceptions import ProductNotFoundException, ValidationException
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product, ProductTranslation
|
||||||
from models.database.product_translation import ProductTranslation
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ from dataclasses import dataclass, field
|
|||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from app.modules.inventory.models.inventory import Inventory
|
from app.modules.inventory.models.inventory import Inventory
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ from app.modules.inventory.schemas.inventory import (
|
|||||||
InventoryUpdate,
|
InventoryUpdate,
|
||||||
ProductInventorySummary,
|
ProductInventorySummary,
|
||||||
)
|
)
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.database.vendor import Vendor
|
from models.database.vendor import Vendor
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -603,8 +603,8 @@ class InventoryService:
|
|||||||
query = query.filter(Inventory.quantity <= low_stock)
|
query = query.filter(Inventory.quantity <= low_stock)
|
||||||
|
|
||||||
if search:
|
if search:
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import (
|
||||||
from models.database.marketplace_product_translation import (
|
MarketplaceProduct,
|
||||||
MarketplaceProductTranslation,
|
MarketplaceProductTranslation,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from app.exceptions import OrderNotFoundException, ProductNotFoundException
|
|||||||
from app.modules.inventory.models.inventory import Inventory
|
from app.modules.inventory.models.inventory import Inventory
|
||||||
from app.modules.inventory.models.inventory_transaction import InventoryTransaction
|
from app.modules.inventory.models.inventory_transaction import InventoryTransaction
|
||||||
from app.modules.orders.models import Order
|
from app.modules.orders.models import Order
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,12 @@ from app.modules.marketplace.models.letzshop import (
|
|||||||
# Import jobs
|
# Import jobs
|
||||||
LetzshopHistoricalImportJob,
|
LetzshopHistoricalImportJob,
|
||||||
)
|
)
|
||||||
|
from app.modules.marketplace.models.onboarding import (
|
||||||
|
OnboardingStatus,
|
||||||
|
OnboardingStep,
|
||||||
|
STEP_ORDER,
|
||||||
|
VendorOnboarding,
|
||||||
|
)
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
# Marketplace products
|
# Marketplace products
|
||||||
@@ -51,4 +57,9 @@ __all__ = [
|
|||||||
"LetzshopFulfillmentQueue",
|
"LetzshopFulfillmentQueue",
|
||||||
"LetzshopVendorCache",
|
"LetzshopVendorCache",
|
||||||
"LetzshopSyncLog",
|
"LetzshopSyncLog",
|
||||||
|
# Onboarding
|
||||||
|
"OnboardingStatus",
|
||||||
|
"OnboardingStep",
|
||||||
|
"STEP_ORDER",
|
||||||
|
"VendorOnboarding",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
# models/database/onboarding.py
|
# app/modules/marketplace/models/onboarding.py
|
||||||
"""
|
"""
|
||||||
Vendor onboarding progress tracking.
|
Vendor onboarding progress tracking.
|
||||||
|
|
||||||
Tracks completion status of mandatory onboarding steps for new vendors.
|
Tracks completion status of mandatory onboarding steps for new vendors.
|
||||||
Onboarding must be completed before accessing the vendor dashboard.
|
Onboarding must be completed before accessing the vendor dashboard.
|
||||||
|
|
||||||
|
The onboarding flow guides vendors through Letzshop marketplace integration:
|
||||||
|
1. Company Profile setup
|
||||||
|
2. Letzshop API configuration
|
||||||
|
3. Product import from CSV feed
|
||||||
|
4. Historical order sync
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import enum
|
import enum
|
||||||
@@ -23,8 +29,7 @@ from sqlalchemy.dialects.sqlite import JSON
|
|||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
|
|
||||||
from app.core.database import Base
|
from app.core.database import Base
|
||||||
|
from models.database.base import TimestampMixin
|
||||||
from .base import TimestampMixin
|
|
||||||
|
|
||||||
|
|
||||||
class OnboardingStep(str, enum.Enum):
|
class OnboardingStep(str, enum.Enum):
|
||||||
@@ -11,7 +11,7 @@ from datetime import UTC, datetime
|
|||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from app.utils.encryption import decrypt_value, encrypt_value, mask_api_key
|
from app.utils.encryption import decrypt_value, encrypt_value, mask_api_key
|
||||||
from models.database.letzshop import VendorLetzshopCredentials
|
from app.modules.marketplace.models import VendorLetzshopCredentials
|
||||||
|
|
||||||
from .client_service import LetzshopClient
|
from .client_service import LetzshopClient
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,15 @@ from sqlalchemy.orm import Session
|
|||||||
|
|
||||||
from app.services.order_service import order_service as unified_order_service
|
from app.services.order_service import order_service as unified_order_service
|
||||||
from app.services.subscription_service import subscription_service
|
from app.services.subscription_service import subscription_service
|
||||||
from models.database.letzshop import (
|
from app.modules.marketplace.models import (
|
||||||
LetzshopFulfillmentQueue,
|
LetzshopFulfillmentQueue,
|
||||||
LetzshopHistoricalImportJob,
|
LetzshopHistoricalImportJob,
|
||||||
LetzshopSyncLog,
|
LetzshopSyncLog,
|
||||||
|
MarketplaceImportJob,
|
||||||
VendorLetzshopCredentials,
|
VendorLetzshopCredentials,
|
||||||
)
|
)
|
||||||
from models.database.marketplace_import_job import MarketplaceImportJob
|
|
||||||
from app.modules.orders.models import Order, OrderItem
|
from app.modules.orders.models import Order, OrderItem
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.database.vendor import Vendor
|
from models.database.vendor import Vendor
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from sqlalchemy.dialects.postgresql import insert as pg_insert
|
|||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from app.services.letzshop.client_service import LetzshopClient
|
from app.services.letzshop.client_service import LetzshopClient
|
||||||
from models.database.letzshop import LetzshopVendorCache
|
from app.modules.marketplace.models import LetzshopVendorCache
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,8 @@ from datetime import UTC, datetime
|
|||||||
|
|
||||||
from sqlalchemy.orm import Session, joinedload
|
from sqlalchemy.orm import Session, joinedload
|
||||||
|
|
||||||
from models.database.letzshop import LetzshopSyncLog
|
from app.modules.marketplace.models import LetzshopSyncLog, MarketplaceProduct
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.catalog.models import Product
|
||||||
from models.database.product import Product
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from app.exceptions import (
|
|||||||
ImportJobNotOwnedException,
|
ImportJobNotOwnedException,
|
||||||
ValidationException,
|
ValidationException,
|
||||||
)
|
)
|
||||||
from models.database.marketplace_import_job import (
|
from app.modules.marketplace.models import (
|
||||||
MarketplaceImportError,
|
MarketplaceImportError,
|
||||||
MarketplaceImportJob,
|
MarketplaceImportJob,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ from app.exceptions import (
|
|||||||
)
|
)
|
||||||
from app.utils.data_processing import GTINProcessor, PriceProcessor
|
from app.utils.data_processing import GTINProcessor, PriceProcessor
|
||||||
from app.modules.inventory.models import Inventory
|
from app.modules.inventory.models import Inventory
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import (
|
||||||
from models.database.marketplace_product_translation import (
|
MarketplaceProduct,
|
||||||
MarketplaceProductTranslation,
|
MarketplaceProductTranslation,
|
||||||
)
|
)
|
||||||
from app.modules.inventory.schemas import InventoryLocationResponse, InventorySummaryResponse
|
from app.modules.inventory.schemas import InventoryLocationResponse, InventorySummaryResponse
|
||||||
@@ -859,8 +859,8 @@ class MarketplaceProductService:
|
|||||||
Returns:
|
Returns:
|
||||||
Dict with copied, skipped, failed counts and details
|
Dict with copied, skipped, failed counts and details
|
||||||
"""
|
"""
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.database.product_translation import ProductTranslation
|
from app.modules.catalog.models import ProductTranslation
|
||||||
from models.database.vendor import Vendor
|
from models.database.vendor import Vendor
|
||||||
|
|
||||||
vendor = db.query(Vendor).filter(Vendor.id == vendor_id).first()
|
vendor = db.query(Vendor).filter(Vendor.id == vendor_id).first()
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ from datetime import UTC, datetime
|
|||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
from app.core.celery_config import celery_app
|
from app.core.celery_config import celery_app
|
||||||
from models.database.marketplace_import_job import MarketplaceImportJob
|
from app.modules.marketplace.models import MarketplaceImportJob, LetzshopHistoricalImportJob
|
||||||
from models.database.letzshop import LetzshopHistoricalImportJob
|
|
||||||
from app.services.admin_notification_service import admin_notification_service
|
from app.services.admin_notification_service import admin_notification_service
|
||||||
from app.services.letzshop import LetzshopClientError
|
from app.services.letzshop import LetzshopClientError
|
||||||
from app.services.letzshop.credentials_service import LetzshopCredentialsService
|
from app.services.letzshop.credentials_service import LetzshopCredentialsService
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from sqlalchemy import case, desc, func
|
|||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from models.database.architecture_scan import ArchitectureScan
|
from models.database.architecture_scan import ArchitectureScan
|
||||||
from models.database.marketplace_import_job import MarketplaceImportJob
|
from app.modules.marketplace.models import MarketplaceImportJob
|
||||||
from models.database.test_run import TestRun
|
from models.database.test_run import TestRun
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ from app.exceptions import (
|
|||||||
)
|
)
|
||||||
from app.modules.orders.models.order import Order, OrderItem
|
from app.modules.orders.models.order import Order, OrderItem
|
||||||
from app.modules.orders.models.order_item_exception import OrderItemException
|
from app.modules.orders.models.order_item_exception import OrderItemException
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -49,9 +49,8 @@ from app.utils.vat import (
|
|||||||
calculate_vat_amount,
|
calculate_vat_amount,
|
||||||
determine_vat_regime,
|
determine_vat_regime,
|
||||||
)
|
)
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import MarketplaceProduct, MarketplaceProductTranslation
|
||||||
from models.database.marketplace_product_translation import MarketplaceProductTranslation
|
from app.modules.catalog.models import Product
|
||||||
from models.database.product import Product
|
|
||||||
from models.database.vendor import Vendor
|
from models.database.vendor import Vendor
|
||||||
|
|
||||||
# Placeholder product constants
|
# Placeholder product constants
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ from app.exceptions import (
|
|||||||
from app.exceptions.auth import UserAlreadyExistsException
|
from app.exceptions.auth import UserAlreadyExistsException
|
||||||
from middleware.auth import AuthManager
|
from middleware.auth import AuthManager
|
||||||
from models.database.company import Company
|
from models.database.company import Company
|
||||||
from models.database.marketplace_import_job import MarketplaceImportJob
|
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
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ from decimal import Decimal
|
|||||||
from sqlalchemy import func
|
from sqlalchemy import func
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.database.subscription import (
|
from models.database.subscription import (
|
||||||
CapacitySnapshot,
|
CapacitySnapshot,
|
||||||
SubscriptionStatus,
|
SubscriptionStatus,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from datetime import UTC, datetime
|
|||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from app.utils.encryption import decrypt_value, encrypt_value, mask_api_key
|
from app.utils.encryption import decrypt_value, encrypt_value, mask_api_key
|
||||||
from models.database.letzshop import VendorLetzshopCredentials
|
from app.modules.marketplace.models import VendorLetzshopCredentials
|
||||||
|
|
||||||
from .client_service import LetzshopClient
|
from .client_service import LetzshopClient
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,15 @@ from sqlalchemy.orm import Session
|
|||||||
|
|
||||||
from app.services.order_service import order_service as unified_order_service
|
from app.services.order_service import order_service as unified_order_service
|
||||||
from app.services.subscription_service import subscription_service
|
from app.services.subscription_service import subscription_service
|
||||||
from models.database.letzshop import (
|
from app.modules.marketplace.models import (
|
||||||
LetzshopFulfillmentQueue,
|
LetzshopFulfillmentQueue,
|
||||||
LetzshopHistoricalImportJob,
|
LetzshopHistoricalImportJob,
|
||||||
LetzshopSyncLog,
|
LetzshopSyncLog,
|
||||||
|
MarketplaceImportJob,
|
||||||
VendorLetzshopCredentials,
|
VendorLetzshopCredentials,
|
||||||
)
|
)
|
||||||
from models.database.marketplace_import_job import MarketplaceImportJob
|
|
||||||
from app.modules.orders.models import Order, OrderItem
|
from app.modules.orders.models import Order, OrderItem
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.database.vendor import Vendor
|
from models.database.vendor import Vendor
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from sqlalchemy.dialects.postgresql import insert as pg_insert
|
|||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from app.services.letzshop.client_service import LetzshopClient
|
from app.services.letzshop.client_service import LetzshopClient
|
||||||
from models.database.letzshop import LetzshopVendorCache
|
from app.modules.marketplace.models import LetzshopVendorCache
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ from app.exceptions import (
|
|||||||
)
|
)
|
||||||
from app.services.letzshop.credentials_service import LetzshopCredentialsService
|
from app.services.letzshop.credentials_service import LetzshopCredentialsService
|
||||||
from app.services.letzshop.order_service import LetzshopOrderService
|
from app.services.letzshop.order_service import LetzshopOrderService
|
||||||
from models.database.onboarding import (
|
from app.modules.marketplace.models import (
|
||||||
OnboardingStatus,
|
OnboardingStatus,
|
||||||
OnboardingStep,
|
OnboardingStep,
|
||||||
VendorOnboarding,
|
VendorOnboarding,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ from sqlalchemy.orm import Session
|
|||||||
from app.services.image_service import image_service
|
from app.services.image_service import image_service
|
||||||
from app.modules.inventory.models import Inventory
|
from app.modules.inventory.models import Inventory
|
||||||
from app.modules.orders.models import Order
|
from app.modules.orders.models import Order
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.database.vendor import Vendor
|
from models.database.vendor import Vendor
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ from app.exceptions import (
|
|||||||
ProductNotFoundException,
|
ProductNotFoundException,
|
||||||
ValidationException,
|
ValidationException,
|
||||||
)
|
)
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import MarketplaceProduct
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.schema.product import ProductCreate, ProductUpdate
|
from models.schema.product import ProductCreate, ProductUpdate
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -272,7 +272,7 @@ class ProductService:
|
|||||||
from sqlalchemy import or_
|
from sqlalchemy import or_
|
||||||
from sqlalchemy.orm import joinedload
|
from sqlalchemy.orm import joinedload
|
||||||
|
|
||||||
from models.database.product_translation import ProductTranslation
|
from app.modules.catalog.models import ProductTranslation
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Prepare search pattern for LIKE queries
|
# Prepare search pattern for LIKE queries
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from sqlalchemy import func
|
|||||||
from sqlalchemy.orm import Session, joinedload
|
from sqlalchemy.orm import Session, joinedload
|
||||||
|
|
||||||
from app.exceptions import ProductNotFoundException
|
from app.exceptions import ProductNotFoundException
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.database.vendor import Vendor
|
from models.database.vendor import Vendor
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -270,7 +270,7 @@ class VendorProductService:
|
|||||||
Returns:
|
Returns:
|
||||||
Created Product instance
|
Created Product instance
|
||||||
"""
|
"""
|
||||||
from models.database.product_translation import ProductTranslation
|
from app.modules.catalog.models import ProductTranslation
|
||||||
|
|
||||||
# Determine product_type from is_digital flag
|
# Determine product_type from is_digital flag
|
||||||
is_digital = data.get("is_digital", False)
|
is_digital = data.get("is_digital", False)
|
||||||
@@ -344,7 +344,7 @@ class VendorProductService:
|
|||||||
Returns:
|
Returns:
|
||||||
Updated Product instance
|
Updated Product instance
|
||||||
"""
|
"""
|
||||||
from models.database.product_translation import ProductTranslation
|
from app.modules.catalog.models import ProductTranslation
|
||||||
|
|
||||||
product = (
|
product = (
|
||||||
db.query(Product)
|
db.query(Product)
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ from app.exceptions import (
|
|||||||
VendorAlreadyExistsException,
|
VendorAlreadyExistsException,
|
||||||
VendorNotFoundException,
|
VendorNotFoundException,
|
||||||
)
|
)
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import MarketplaceProduct
|
||||||
from models.database.product 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 models.schema.product import ProductCreate
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from datetime import UTC, datetime
|
|||||||
from app.core.database import SessionLocal
|
from app.core.database import SessionLocal
|
||||||
from app.services.admin_notification_service import admin_notification_service
|
from app.services.admin_notification_service import admin_notification_service
|
||||||
from app.utils.csv_processor import CSVProcessor
|
from app.utils.csv_processor import CSVProcessor
|
||||||
from models.database.marketplace_import_job import MarketplaceImportJob
|
from app.modules.marketplace.models import MarketplaceImportJob
|
||||||
from models.database.vendor import Vendor
|
from models.database.vendor import Vendor
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from app.services.letzshop import LetzshopClientError
|
|||||||
from app.services.letzshop.credentials_service import LetzshopCredentialsService
|
from app.services.letzshop.credentials_service import LetzshopCredentialsService
|
||||||
from app.services.letzshop.order_service import LetzshopOrderService
|
from app.services.letzshop.order_service import LetzshopOrderService
|
||||||
from app.services.letzshop.vendor_sync_service import LetzshopVendorSyncService
|
from app.services.letzshop.vendor_sync_service import LetzshopVendorSyncService
|
||||||
from models.database.letzshop import LetzshopHistoricalImportJob
|
from app.modules.marketplace.models import LetzshopHistoricalImportJob
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ from sqlalchemy import literal
|
|||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from app.utils.money import euros_to_cents
|
from app.utils.money import euros_to_cents
|
||||||
from models.database.marketplace_import_job import MarketplaceImportError
|
from app.modules.marketplace.models import (
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
MarketplaceImportError,
|
||||||
from models.database.marketplace_product_translation import (
|
MarketplaceProduct,
|
||||||
MarketplaceProductTranslation,
|
MarketplaceProductTranslation,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -6,14 +6,13 @@ from . import schema
|
|||||||
|
|
||||||
# Database models (SQLAlchemy)
|
# Database models (SQLAlchemy)
|
||||||
from .database.base import Base
|
from .database.base import Base
|
||||||
from .database.marketplace_import_job import MarketplaceImportJob
|
|
||||||
from .database.marketplace_product import MarketplaceProduct
|
|
||||||
from .database.product import Product
|
|
||||||
from .database.user import User
|
from .database.user import User
|
||||||
from .database.vendor import Vendor
|
from .database.vendor import Vendor
|
||||||
|
|
||||||
# Module-based models
|
# Module-based models
|
||||||
from app.modules.inventory.models import Inventory
|
from app.modules.inventory.models import Inventory
|
||||||
|
from app.modules.marketplace.models import MarketplaceImportJob, MarketplaceProduct
|
||||||
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
# Export database models for Alembic
|
# Export database models for Alembic
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
|||||||
@@ -57,13 +57,18 @@ from app.modules.orders.models import (
|
|||||||
VATRegime,
|
VATRegime,
|
||||||
VendorInvoiceSettings,
|
VendorInvoiceSettings,
|
||||||
)
|
)
|
||||||
from .letzshop import (
|
from app.modules.marketplace.models import (
|
||||||
LetzshopFulfillmentQueue,
|
LetzshopFulfillmentQueue,
|
||||||
LetzshopHistoricalImportJob,
|
LetzshopHistoricalImportJob,
|
||||||
LetzshopSyncLog,
|
LetzshopSyncLog,
|
||||||
VendorLetzshopCredentials,
|
VendorLetzshopCredentials,
|
||||||
|
MarketplaceImportError,
|
||||||
|
MarketplaceImportJob,
|
||||||
|
DigitalDeliveryMethod,
|
||||||
|
MarketplaceProduct,
|
||||||
|
ProductType,
|
||||||
|
MarketplaceProductTranslation,
|
||||||
)
|
)
|
||||||
from .marketplace_import_job import MarketplaceImportError, MarketplaceImportJob
|
|
||||||
from app.modules.messaging.models import (
|
from app.modules.messaging.models import (
|
||||||
Conversation,
|
Conversation,
|
||||||
ConversationParticipant,
|
ConversationParticipant,
|
||||||
@@ -72,18 +77,11 @@ from app.modules.messaging.models import (
|
|||||||
MessageAttachment,
|
MessageAttachment,
|
||||||
ParticipantType,
|
ParticipantType,
|
||||||
)
|
)
|
||||||
from .marketplace_product import (
|
|
||||||
DigitalDeliveryMethod,
|
|
||||||
MarketplaceProduct,
|
|
||||||
ProductType,
|
|
||||||
)
|
|
||||||
from .media import MediaFile, ProductMedia
|
from .media import MediaFile, ProductMedia
|
||||||
from .marketplace_product_translation import MarketplaceProductTranslation
|
from app.modules.marketplace.models import OnboardingStatus, OnboardingStep, VendorOnboarding
|
||||||
from .onboarding import OnboardingStatus, OnboardingStep, VendorOnboarding
|
|
||||||
from app.modules.orders.models import Order, OrderItem
|
from app.modules.orders.models import Order, OrderItem
|
||||||
from app.modules.orders.models import OrderItemException
|
from app.modules.orders.models import OrderItemException
|
||||||
from .product import Product
|
from app.modules.catalog.models import Product, ProductTranslation
|
||||||
from .product_translation import ProductTranslation
|
|
||||||
from .subscription import (
|
from .subscription import (
|
||||||
AddOnCategory,
|
AddOnCategory,
|
||||||
AddOnProduct,
|
AddOnProduct,
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
# models/database/letzshop.py
|
|
||||||
"""
|
|
||||||
Legacy location for Letzshop models.
|
|
||||||
|
|
||||||
MIGRATED: Models have been moved to app.modules.marketplace.models.letzshop.
|
|
||||||
|
|
||||||
New location:
|
|
||||||
from app.modules.marketplace.models import (
|
|
||||||
VendorLetzshopCredentials,
|
|
||||||
LetzshopFulfillmentQueue,
|
|
||||||
LetzshopVendorCache,
|
|
||||||
LetzshopSyncLog,
|
|
||||||
LetzshopHistoricalImportJob,
|
|
||||||
)
|
|
||||||
|
|
||||||
This file re-exports from the new location for backward compatibility.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Re-export from the new canonical location
|
|
||||||
from app.modules.marketplace.models.letzshop import (
|
|
||||||
VendorLetzshopCredentials,
|
|
||||||
LetzshopFulfillmentQueue,
|
|
||||||
LetzshopVendorCache,
|
|
||||||
LetzshopSyncLog,
|
|
||||||
LetzshopHistoricalImportJob,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
"VendorLetzshopCredentials",
|
|
||||||
"LetzshopFulfillmentQueue",
|
|
||||||
"LetzshopVendorCache",
|
|
||||||
"LetzshopSyncLog",
|
|
||||||
"LetzshopHistoricalImportJob",
|
|
||||||
]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# MarketplaceImportJob model
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
# models/database/marketplace_import_job.py
|
|
||||||
"""
|
|
||||||
Legacy location for marketplace import job models.
|
|
||||||
|
|
||||||
MIGRATED: Models have been moved to app.modules.marketplace.models.marketplace_import_job.
|
|
||||||
|
|
||||||
New location:
|
|
||||||
from app.modules.marketplace.models import (
|
|
||||||
MarketplaceImportJob,
|
|
||||||
MarketplaceImportError,
|
|
||||||
)
|
|
||||||
|
|
||||||
This file re-exports from the new location for backward compatibility.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Re-export from the new canonical location
|
|
||||||
from app.modules.marketplace.models.marketplace_import_job import (
|
|
||||||
MarketplaceImportJob,
|
|
||||||
MarketplaceImportError,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = ["MarketplaceImportJob", "MarketplaceImportError"]
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
# models/database/marketplace_product.py
|
|
||||||
"""
|
|
||||||
Legacy location for marketplace product model.
|
|
||||||
|
|
||||||
MIGRATED: All models have been moved to app.modules.marketplace.models.marketplace_product.
|
|
||||||
|
|
||||||
New location:
|
|
||||||
from app.modules.marketplace.models import (
|
|
||||||
MarketplaceProduct,
|
|
||||||
ProductType,
|
|
||||||
DigitalDeliveryMethod,
|
|
||||||
)
|
|
||||||
|
|
||||||
This file re-exports from the new location for backward compatibility.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Re-export everything from the new canonical location
|
|
||||||
from app.modules.marketplace.models.marketplace_product import (
|
|
||||||
MarketplaceProduct,
|
|
||||||
ProductType,
|
|
||||||
DigitalDeliveryMethod,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
"MarketplaceProduct",
|
|
||||||
"ProductType",
|
|
||||||
"DigitalDeliveryMethod",
|
|
||||||
]
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
# models/database/marketplace_product_translation.py
|
|
||||||
"""
|
|
||||||
Legacy location for marketplace product translation model.
|
|
||||||
|
|
||||||
MIGRATED: Model has been moved to app.modules.marketplace.models.marketplace_product_translation.
|
|
||||||
|
|
||||||
New location:
|
|
||||||
from app.modules.marketplace.models import MarketplaceProductTranslation
|
|
||||||
|
|
||||||
This file re-exports from the new location for backward compatibility.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Re-export from the new canonical location
|
|
||||||
from app.modules.marketplace.models.marketplace_product_translation import (
|
|
||||||
MarketplaceProductTranslation,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = ["MarketplaceProductTranslation"]
|
|
||||||
@@ -6,7 +6,7 @@ sys.path.insert(0, ".")
|
|||||||
|
|
||||||
from app.core.database import SessionLocal
|
from app.core.database import SessionLocal
|
||||||
from app.services.letzshop.credentials_service import LetzshopCredentialsService
|
from app.services.letzshop.credentials_service import LetzshopCredentialsService
|
||||||
from models.database.letzshop import LetzshopHistoricalImportJob
|
from app.modules.marketplace.models import LetzshopHistoricalImportJob
|
||||||
|
|
||||||
|
|
||||||
def get_valid_shipment_states(vendor_id: int = 1):
|
def get_valid_shipment_states(vendor_id: int = 1):
|
||||||
|
|||||||
@@ -55,13 +55,13 @@ from app.modules.cms.models import ContentPage
|
|||||||
from models.database.admin import PlatformAlert
|
from models.database.admin import PlatformAlert
|
||||||
from models.database.company import Company
|
from models.database.company import Company
|
||||||
from app.modules.customers.models.customer import Customer, CustomerAddress
|
from app.modules.customers.models.customer import Customer, CustomerAddress
|
||||||
from models.database.marketplace_import_job import MarketplaceImportJob
|
from app.modules.marketplace.models import (
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
MarketplaceImportJob,
|
||||||
from models.database.marketplace_product_translation import (
|
MarketplaceProduct,
|
||||||
MarketplaceProductTranslation,
|
MarketplaceProductTranslation,
|
||||||
)
|
)
|
||||||
from app.modules.orders.models import Order, OrderItem
|
from app.modules.orders.models import Order, OrderItem
|
||||||
from models.database.product 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 Role, Vendor, VendorUser
|
from models.database.vendor import Role, Vendor, VendorUser
|
||||||
from models.database.vendor_domain import VendorDomain
|
from models.database.vendor_domain import VendorDomain
|
||||||
|
|||||||
@@ -144,9 +144,8 @@ def verify_model_structure():
|
|||||||
|
|
||||||
# Import specific models
|
# Import specific models
|
||||||
from app.modules.inventory.models import Inventory
|
from app.modules.inventory.models import Inventory
|
||||||
from models.database.marketplace_import_job import MarketplaceImportJob
|
from app.modules.marketplace.models import MarketplaceImportJob, MarketplaceProduct
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.catalog.models import Product
|
||||||
from models.database.product 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
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ See tests/conftest.py for details on fixture best practices.
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from models.database.marketplace_import_job import MarketplaceImportJob
|
from app.modules.marketplace.models import MarketplaceImportJob
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import uuid
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import (
|
||||||
from models.database.marketplace_product_translation import (
|
MarketplaceProduct,
|
||||||
MarketplaceProductTranslation,
|
MarketplaceProductTranslation,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
2
tests/fixtures/vendor_fixtures.py
vendored
2
tests/fixtures/vendor_fixtures.py
vendored
@@ -12,7 +12,7 @@ import pytest
|
|||||||
|
|
||||||
from models.database.company import Company
|
from models.database.company import Company
|
||||||
from app.modules.inventory.models import Inventory
|
from app.modules.inventory.models import Inventory
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.database.vendor import Vendor
|
from models.database.vendor import Vendor
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class TestAdminLetzshopVendorsAPI:
|
|||||||
def test_list_vendors_configured_only(self, client, db, admin_headers, test_vendor):
|
def test_list_vendors_configured_only(self, client, db, admin_headers, test_vendor):
|
||||||
"""Test listing only configured vendors."""
|
"""Test listing only configured vendors."""
|
||||||
from app.utils.encryption import encrypt_value
|
from app.utils.encryption import encrypt_value
|
||||||
from models.database.letzshop import VendorLetzshopCredentials
|
from app.modules.marketplace.models import VendorLetzshopCredentials
|
||||||
|
|
||||||
# Configure credentials for test vendor
|
# Configure credentials for test vendor
|
||||||
credentials = VendorLetzshopCredentials(
|
credentials = VendorLetzshopCredentials(
|
||||||
@@ -384,11 +384,9 @@ class TestAdminLetzshopExportAPI:
|
|||||||
self, client, db, admin_headers, test_vendor
|
self, client, db, admin_headers, test_vendor
|
||||||
):
|
):
|
||||||
"""Test exporting products with actual data."""
|
"""Test exporting products with actual data."""
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import MarketplaceProduct
|
||||||
from models.database.marketplace_product_translation import (
|
from app.modules.marketplace.models import MarketplaceProductTranslation
|
||||||
MarketplaceProductTranslation,
|
from app.modules.catalog.models import Product
|
||||||
)
|
|
||||||
from models.database.product import Product
|
|
||||||
|
|
||||||
# Create marketplace product
|
# Create marketplace product
|
||||||
mp = MarketplaceProduct(
|
mp = MarketplaceProduct(
|
||||||
@@ -438,11 +436,9 @@ class TestAdminLetzshopExportAPI:
|
|||||||
self, client, db, admin_headers, test_vendor
|
self, client, db, admin_headers, test_vendor
|
||||||
):
|
):
|
||||||
"""Test exporting products in French."""
|
"""Test exporting products in French."""
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import MarketplaceProduct
|
||||||
from models.database.marketplace_product_translation import (
|
from app.modules.marketplace.models import MarketplaceProductTranslation
|
||||||
MarketplaceProductTranslation,
|
from app.modules.catalog.models import Product
|
||||||
)
|
|
||||||
from models.database.product import Product
|
|
||||||
|
|
||||||
mp = MarketplaceProduct(
|
mp = MarketplaceProduct(
|
||||||
marketplace_product_id="EXPORT-FR-001",
|
marketplace_product_id="EXPORT-FR-001",
|
||||||
@@ -484,11 +480,9 @@ class TestAdminLetzshopExportAPI:
|
|||||||
self, client, db, admin_headers, test_vendor
|
self, client, db, admin_headers, test_vendor
|
||||||
):
|
):
|
||||||
"""Test exporting including inactive products."""
|
"""Test exporting including inactive products."""
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import MarketplaceProduct
|
||||||
from models.database.marketplace_product_translation import (
|
from app.modules.marketplace.models import MarketplaceProductTranslation
|
||||||
MarketplaceProductTranslation,
|
from app.modules.catalog.models import Product
|
||||||
)
|
|
||||||
from models.database.product import Product
|
|
||||||
|
|
||||||
# Create inactive product
|
# Create inactive product
|
||||||
mp = MarketplaceProduct(
|
mp = MarketplaceProduct(
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ class TestVendorDashboardAPI:
|
|||||||
"""Test that dashboard stats only show data for the authenticated vendor"""
|
"""Test that dashboard stats only show data for the authenticated vendor"""
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import MarketplaceProduct
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
# Create products for the test vendor
|
# Create products for the test vendor
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
@@ -195,8 +195,8 @@ class TestVendorDashboardAPI:
|
|||||||
"""Test dashboard stats accuracy with actual products"""
|
"""Test dashboard stats accuracy with actual products"""
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import MarketplaceProduct
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
# Create 5 different marketplace products
|
# Create 5 different marketplace products
|
||||||
marketplace_products = []
|
marketplace_products = []
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class TestVendorInventoryAPI:
|
|||||||
):
|
):
|
||||||
"""Test setting inventory for a product."""
|
"""Test setting inventory for a product."""
|
||||||
# Ensure test_product belongs to the vendor
|
# Ensure test_product belongs to the vendor
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
product = db.query(Product).filter(Product.id == test_product.id).first()
|
product = db.query(Product).filter(Product.id == test_product.id).first()
|
||||||
product.vendor_id = test_vendor_with_vendor_user.id
|
product.vendor_id = test_vendor_with_vendor_user.id
|
||||||
@@ -56,7 +56,7 @@ class TestVendorInventoryAPI:
|
|||||||
db,
|
db,
|
||||||
):
|
):
|
||||||
"""Test adjusting inventory quantity."""
|
"""Test adjusting inventory quantity."""
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
product = db.query(Product).filter(Product.id == test_product.id).first()
|
product = db.query(Product).filter(Product.id == test_product.id).first()
|
||||||
product.vendor_id = test_vendor_with_vendor_user.id
|
product.vendor_id = test_vendor_with_vendor_user.id
|
||||||
@@ -123,7 +123,7 @@ class TestVendorInventoryAPI:
|
|||||||
db,
|
db,
|
||||||
):
|
):
|
||||||
"""Test getting inventory for a specific product."""
|
"""Test getting inventory for a specific product."""
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
product = db.query(Product).filter(Product.id == test_product.id).first()
|
product = db.query(Product).filter(Product.id == test_product.id).first()
|
||||||
product.vendor_id = test_vendor_with_vendor_user.id
|
product.vendor_id = test_vendor_with_vendor_user.id
|
||||||
@@ -155,7 +155,7 @@ class TestVendorInventoryAPI:
|
|||||||
db,
|
db,
|
||||||
):
|
):
|
||||||
"""Test reserving inventory for an order."""
|
"""Test reserving inventory for an order."""
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
product = db.query(Product).filter(Product.id == test_product.id).first()
|
product = db.query(Product).filter(Product.id == test_product.id).first()
|
||||||
product.vendor_id = test_vendor_with_vendor_user.id
|
product.vendor_id = test_vendor_with_vendor_user.id
|
||||||
@@ -198,7 +198,7 @@ class TestVendorInventoryAPI:
|
|||||||
db,
|
db,
|
||||||
):
|
):
|
||||||
"""Test updating inventory record."""
|
"""Test updating inventory record."""
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
product = db.query(Product).filter(Product.id == test_product.id).first()
|
product = db.query(Product).filter(Product.id == test_product.id).first()
|
||||||
product.vendor_id = test_vendor_with_vendor_user.id
|
product.vendor_id = test_vendor_with_vendor_user.id
|
||||||
@@ -240,7 +240,7 @@ class TestVendorInventoryAPI:
|
|||||||
db,
|
db,
|
||||||
):
|
):
|
||||||
"""Test deleting inventory record."""
|
"""Test deleting inventory record."""
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
product = db.query(Product).filter(Product.id == test_product.id).first()
|
product = db.query(Product).filter(Product.id == test_product.id).first()
|
||||||
product.vendor_id = test_vendor_with_vendor_user.id
|
product.vendor_id = test_vendor_with_vendor_user.id
|
||||||
|
|||||||
32
tests/integration/api/v1/vendor/test_letzshop.py
vendored
32
tests/integration/api/v1/vendor/test_letzshop.py
vendored
@@ -642,11 +642,9 @@ class TestVendorLetzshopExportAPI:
|
|||||||
self, client, db, vendor_user_headers, test_vendor_with_vendor_user
|
self, client, db, vendor_user_headers, test_vendor_with_vendor_user
|
||||||
):
|
):
|
||||||
"""Test exporting products with actual data."""
|
"""Test exporting products with actual data."""
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import MarketplaceProduct
|
||||||
from models.database.marketplace_product_translation import (
|
from app.modules.marketplace.models import MarketplaceProductTranslation
|
||||||
MarketplaceProductTranslation,
|
from app.modules.catalog.models import Product
|
||||||
)
|
|
||||||
from models.database.product import Product
|
|
||||||
|
|
||||||
# Create marketplace product
|
# Create marketplace product
|
||||||
mp = MarketplaceProduct(
|
mp = MarketplaceProduct(
|
||||||
@@ -695,11 +693,9 @@ class TestVendorLetzshopExportAPI:
|
|||||||
self, client, db, vendor_user_headers, test_vendor_with_vendor_user
|
self, client, db, vendor_user_headers, test_vendor_with_vendor_user
|
||||||
):
|
):
|
||||||
"""Test exporting products in French."""
|
"""Test exporting products in French."""
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import MarketplaceProduct
|
||||||
from models.database.marketplace_product_translation import (
|
from app.modules.marketplace.models import MarketplaceProductTranslation
|
||||||
MarketplaceProductTranslation,
|
from app.modules.catalog.models import Product
|
||||||
)
|
|
||||||
from models.database.product import Product
|
|
||||||
|
|
||||||
mp = MarketplaceProduct(
|
mp = MarketplaceProduct(
|
||||||
marketplace_product_id="VENDOR-FR-001",
|
marketplace_product_id="VENDOR-FR-001",
|
||||||
@@ -741,11 +737,9 @@ class TestVendorLetzshopExportAPI:
|
|||||||
self, client, db, vendor_user_headers, test_vendor_with_vendor_user
|
self, client, db, vendor_user_headers, test_vendor_with_vendor_user
|
||||||
):
|
):
|
||||||
"""Test exporting products in German."""
|
"""Test exporting products in German."""
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import MarketplaceProduct
|
||||||
from models.database.marketplace_product_translation import (
|
from app.modules.marketplace.models import MarketplaceProductTranslation
|
||||||
MarketplaceProductTranslation,
|
from app.modules.catalog.models import Product
|
||||||
)
|
|
||||||
from models.database.product import Product
|
|
||||||
|
|
||||||
mp = MarketplaceProduct(
|
mp = MarketplaceProduct(
|
||||||
marketplace_product_id="VENDOR-DE-001",
|
marketplace_product_id="VENDOR-DE-001",
|
||||||
@@ -785,11 +779,9 @@ class TestVendorLetzshopExportAPI:
|
|||||||
self, client, db, vendor_user_headers, test_vendor_with_vendor_user
|
self, client, db, vendor_user_headers, test_vendor_with_vendor_user
|
||||||
):
|
):
|
||||||
"""Test exporting including inactive products."""
|
"""Test exporting including inactive products."""
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import MarketplaceProduct
|
||||||
from models.database.marketplace_product_translation import (
|
from app.modules.marketplace.models import MarketplaceProductTranslation
|
||||||
MarketplaceProductTranslation,
|
from app.modules.catalog.models import Product
|
||||||
)
|
|
||||||
from models.database.product import Product
|
|
||||||
|
|
||||||
mp = MarketplaceProduct(
|
mp = MarketplaceProduct(
|
||||||
marketplace_product_id="VENDOR-INACTIVE-001",
|
marketplace_product_id="VENDOR-INACTIVE-001",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Tests cover:
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from models.database.onboarding import OnboardingStatus, OnboardingStep, VendorOnboarding
|
from app.modules.marketplace.models import OnboardingStatus, OnboardingStep, VendorOnboarding
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.integration
|
@pytest.mark.integration
|
||||||
|
|||||||
12
tests/integration/api/v1/vendor/test_products.py
vendored
12
tests/integration/api/v1/vendor/test_products.py
vendored
@@ -50,7 +50,7 @@ class TestVendorProductsAPI:
|
|||||||
):
|
):
|
||||||
"""Test adding product that already exists returns error."""
|
"""Test adding product that already exists returns error."""
|
||||||
# Ensure test_product belongs to the vendor
|
# Ensure test_product belongs to the vendor
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
product = db.query(Product).filter(Product.id == test_product.id).first()
|
product = db.query(Product).filter(Product.id == test_product.id).first()
|
||||||
product.vendor_id = test_vendor_with_vendor_user.id
|
product.vendor_id = test_vendor_with_vendor_user.id
|
||||||
@@ -140,7 +140,7 @@ class TestVendorProductsAPI:
|
|||||||
):
|
):
|
||||||
"""Test getting product details."""
|
"""Test getting product details."""
|
||||||
# Ensure test_product belongs to the vendor
|
# Ensure test_product belongs to the vendor
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
product = db.query(Product).filter(Product.id == test_product.id).first()
|
product = db.query(Product).filter(Product.id == test_product.id).first()
|
||||||
product.vendor_id = test_vendor_with_vendor_user.id
|
product.vendor_id = test_vendor_with_vendor_user.id
|
||||||
@@ -174,7 +174,7 @@ class TestVendorProductsAPI:
|
|||||||
):
|
):
|
||||||
"""Test updating product details."""
|
"""Test updating product details."""
|
||||||
# Ensure test_product belongs to the vendor
|
# Ensure test_product belongs to the vendor
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
product = db.query(Product).filter(Product.id == test_product.id).first()
|
product = db.query(Product).filter(Product.id == test_product.id).first()
|
||||||
product.vendor_id = test_vendor_with_vendor_user.id
|
product.vendor_id = test_vendor_with_vendor_user.id
|
||||||
@@ -206,7 +206,7 @@ class TestVendorProductsAPI:
|
|||||||
):
|
):
|
||||||
"""Test toggling product active status."""
|
"""Test toggling product active status."""
|
||||||
# Ensure test_product belongs to the vendor
|
# Ensure test_product belongs to the vendor
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
product = db.query(Product).filter(Product.id == test_product.id).first()
|
product = db.query(Product).filter(Product.id == test_product.id).first()
|
||||||
product.vendor_id = test_vendor_with_vendor_user.id
|
product.vendor_id = test_vendor_with_vendor_user.id
|
||||||
@@ -232,7 +232,7 @@ class TestVendorProductsAPI:
|
|||||||
):
|
):
|
||||||
"""Test toggling product featured status."""
|
"""Test toggling product featured status."""
|
||||||
# Ensure test_product belongs to the vendor
|
# Ensure test_product belongs to the vendor
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
product = db.query(Product).filter(Product.id == test_product.id).first()
|
product = db.query(Product).filter(Product.id == test_product.id).first()
|
||||||
product.vendor_id = test_vendor_with_vendor_user.id
|
product.vendor_id = test_vendor_with_vendor_user.id
|
||||||
@@ -258,7 +258,7 @@ class TestVendorProductsAPI:
|
|||||||
):
|
):
|
||||||
"""Test removing product from catalog."""
|
"""Test removing product from catalog."""
|
||||||
# Ensure test_product belongs to the vendor
|
# Ensure test_product belongs to the vendor
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
product = db.query(Product).filter(Product.id == test_product.id).first()
|
product = db.query(Product).filter(Product.id == test_product.id).first()
|
||||||
product.vendor_id = test_vendor_with_vendor_user.id
|
product.vendor_id = test_vendor_with_vendor_user.id
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from app.tasks.background_tasks import process_marketplace_import
|
from app.tasks.background_tasks import process_marketplace_import
|
||||||
from models.database.marketplace_import_job import MarketplaceImportJob
|
from app.modules.marketplace.models import MarketplaceImportJob
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.integration
|
@pytest.mark.integration
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import pytest
|
|||||||
|
|
||||||
from app.services.letzshop import LetzshopClientError
|
from app.services.letzshop import LetzshopClientError
|
||||||
from app.tasks.letzshop_tasks import process_historical_import
|
from app.tasks.letzshop_tasks import process_historical_import
|
||||||
from models.database.letzshop import LetzshopHistoricalImportJob
|
from app.modules.marketplace.models import LetzshopHistoricalImportJob
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import time
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import (
|
||||||
from models.database.marketplace_product_translation import (
|
MarketplaceProduct,
|
||||||
MarketplaceProductTranslation,
|
MarketplaceProductTranslation,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from models.database.marketplace_import_job import MarketplaceImportJob
|
from app.modules.marketplace.models import MarketplaceImportJob
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.unit
|
@pytest.mark.unit
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from sqlalchemy.exc import IntegrityError
|
from sqlalchemy.exc import IntegrityError
|
||||||
|
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import (
|
||||||
from models.database.marketplace_product_translation import (
|
MarketplaceProduct,
|
||||||
MarketplaceProductTranslation,
|
MarketplaceProductTranslation,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from sqlalchemy.exc import IntegrityError
|
from sqlalchemy.exc import IntegrityError
|
||||||
|
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.unit
|
@pytest.mark.unit
|
||||||
|
|||||||
@@ -363,11 +363,9 @@ class TestInventoryService:
|
|||||||
def test_get_product_inventory_no_inventory(self, db, test_product, test_vendor):
|
def test_get_product_inventory_no_inventory(self, db, test_product, test_vendor):
|
||||||
"""Test getting inventory for product with no inventory entries."""
|
"""Test getting inventory for product with no inventory entries."""
|
||||||
# Create a new product without inventory
|
# Create a new product without inventory
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import MarketplaceProduct
|
||||||
from models.database.marketplace_product_translation import (
|
from app.modules.marketplace.models import MarketplaceProductTranslation
|
||||||
MarketplaceProductTranslation,
|
from app.modules.catalog.models import Product
|
||||||
)
|
|
||||||
from models.database.product import Product
|
|
||||||
|
|
||||||
unique_id = str(uuid.uuid4())[:8]
|
unique_id = str(uuid.uuid4())[:8]
|
||||||
mp = MarketplaceProduct(
|
mp = MarketplaceProduct(
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ from app.services.marketplace_product_service import (
|
|||||||
MarketplaceProductService,
|
MarketplaceProductService,
|
||||||
marketplace_product_service,
|
marketplace_product_service,
|
||||||
)
|
)
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import (
|
||||||
from models.database.marketplace_product_translation import (
|
MarketplaceProduct,
|
||||||
MarketplaceProductTranslation,
|
MarketplaceProductTranslation,
|
||||||
)
|
)
|
||||||
from models.schema.marketplace_product import (
|
from models.schema.marketplace_product import (
|
||||||
|
|||||||
@@ -12,7 +12,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 models.database.marketplace_import_job import MarketplaceImportJob
|
from app.modules.marketplace.models import MarketplaceImportJob
|
||||||
from models.schema.marketplace_import_job import MarketplaceImportJobRequest
|
from models.schema.marketplace_import_job import MarketplaceImportJobRequest
|
||||||
|
|
||||||
|
|
||||||
@@ -283,7 +283,7 @@ class TestMarketplaceImportJobService:
|
|||||||
self, db, test_marketplace_import_job, test_vendor
|
self, db, test_marketplace_import_job, test_vendor
|
||||||
):
|
):
|
||||||
"""Test converting database model to response model."""
|
"""Test converting database model to response model."""
|
||||||
from models.database.marketplace_import_job import MarketplaceImportJob as MIJ
|
from app.modules.marketplace.models import MarketplaceImportJob as MIJ
|
||||||
|
|
||||||
# Re-query to get fresh instance with relationships
|
# Re-query to get fresh instance with relationships
|
||||||
job = db.query(MIJ).filter(MIJ.id == test_marketplace_import_job.id).first()
|
job = db.query(MIJ).filter(MIJ.id == test_marketplace_import_job.id).first()
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ from unittest.mock import MagicMock, patch
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from app.services.onboarding_service import OnboardingService
|
from app.services.onboarding_service import OnboardingService
|
||||||
from models.database.onboarding import OnboardingStatus, OnboardingStep, VendorOnboarding
|
from app.modules.marketplace.models import OnboardingStatus, OnboardingStep, VendorOnboarding
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.unit
|
@pytest.mark.unit
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ from sqlalchemy.exc import SQLAlchemyError
|
|||||||
from app.exceptions import AdminOperationException, VendorNotFoundException
|
from app.exceptions import AdminOperationException, VendorNotFoundException
|
||||||
from app.services.stats_service import StatsService
|
from app.services.stats_service import StatsService
|
||||||
from app.modules.inventory.models import Inventory
|
from app.modules.inventory.models import Inventory
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import (
|
||||||
from models.database.marketplace_product_translation import (
|
MarketplaceProduct,
|
||||||
MarketplaceProductTranslation,
|
MarketplaceProductTranslation,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from app.services.usage_service import UsageService, usage_service
|
from app.services.usage_service import UsageService, usage_service
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.database.subscription import SubscriptionTier, VendorSubscription
|
from models.database.subscription import SubscriptionTier, VendorSubscription
|
||||||
from models.database.vendor import VendorUser
|
from models.database.vendor import VendorUser
|
||||||
|
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ class TestVendorService:
|
|||||||
|
|
||||||
def test_add_product_to_vendor_success(self, db, test_vendor, unique_product):
|
def test_add_product_to_vendor_success(self, db, test_vendor, unique_product):
|
||||||
"""Test successfully adding product to vendor."""
|
"""Test successfully adding product to vendor."""
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import MarketplaceProduct
|
||||||
|
|
||||||
# Re-query objects to avoid session issues
|
# Re-query objects to avoid session issues
|
||||||
vendor = db.query(Vendor).filter(Vendor.id == test_vendor.id).first()
|
vendor = db.query(Vendor).filter(Vendor.id == test_vendor.id).first()
|
||||||
@@ -398,7 +398,7 @@ class TestVendorService:
|
|||||||
def test_add_product_to_vendor_already_exists(self, db, test_vendor, test_product):
|
def test_add_product_to_vendor_already_exists(self, db, test_vendor, test_product):
|
||||||
"""Test adding product that's already in vendor fails."""
|
"""Test adding product that's already in vendor fails."""
|
||||||
# Re-query to get fresh instances
|
# Re-query to get fresh instances
|
||||||
from models.database.product import Product
|
from app.modules.catalog.models import Product
|
||||||
|
|
||||||
vendor = db.query(Vendor).filter(Vendor.id == test_vendor.id).first()
|
vendor = db.query(Vendor).filter(Vendor.id == test_vendor.id).first()
|
||||||
product = db.query(Product).filter(Product.id == test_product.id).first()
|
product = db.query(Product).filter(Product.id == test_product.id).first()
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import requests
|
|||||||
import requests.exceptions
|
import requests.exceptions
|
||||||
|
|
||||||
from app.utils.csv_processor import CSVProcessor
|
from app.utils.csv_processor import CSVProcessor
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from app.modules.marketplace.models import MarketplaceProduct
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.unit
|
@pytest.mark.unit
|
||||||
|
|||||||
Reference in New Issue
Block a user