fix: correct inventory service and test for product model changes
- Fix inventory_service.py: use product.vendor_sku instead of non-existent product.product_id - Fix test: create MarketplaceProductTranslation for title (now in translations table) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -425,7 +425,7 @@ class InventoryService:
|
|||||||
return ProductInventorySummary(
|
return ProductInventorySummary(
|
||||||
product_id=product_id,
|
product_id=product_id,
|
||||||
vendor_id=vendor_id,
|
vendor_id=vendor_id,
|
||||||
product_sku=product.product_id,
|
product_sku=product.vendor_sku,
|
||||||
product_title=product.marketplace_product.get_title() or "",
|
product_title=product.marketplace_product.get_title() or "",
|
||||||
total_quantity=total_qty,
|
total_quantity=total_qty,
|
||||||
total_reserved=total_reserved,
|
total_reserved=total_reserved,
|
||||||
|
|||||||
@@ -368,15 +368,24 @@ class TestInventoryService:
|
|||||||
# Create a new product without inventory
|
# Create a new product without inventory
|
||||||
from models.database.product import Product
|
from models.database.product import Product
|
||||||
from models.database.marketplace_product import MarketplaceProduct
|
from models.database.marketplace_product import MarketplaceProduct
|
||||||
|
from models.database.marketplace_product_translation import MarketplaceProductTranslation
|
||||||
|
|
||||||
unique_id = str(uuid.uuid4())[:8]
|
unique_id = str(uuid.uuid4())[:8]
|
||||||
mp = MarketplaceProduct(
|
mp = MarketplaceProduct(
|
||||||
marketplace_product_id=f"MP_EMPTY_{unique_id}",
|
marketplace_product_id=f"MP_EMPTY_{unique_id}",
|
||||||
title="Product Without Inventory",
|
|
||||||
price="29.99",
|
price="29.99",
|
||||||
marketplace="Letzshop",
|
marketplace="Letzshop",
|
||||||
)
|
)
|
||||||
db.add(mp)
|
db.add(mp)
|
||||||
|
db.flush()
|
||||||
|
|
||||||
|
# Create translation for the product (title is now in translations table)
|
||||||
|
translation = MarketplaceProductTranslation(
|
||||||
|
marketplace_product_id=mp.id,
|
||||||
|
language="en",
|
||||||
|
title="Product Without Inventory",
|
||||||
|
)
|
||||||
|
db.add(translation)
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
product = Product(
|
product = Product(
|
||||||
|
|||||||
Reference in New Issue
Block a user