diff --git a/app/services/admin_service.py b/app/services/admin_service.py index 32609dba..38560586 100644 --- a/app/services/admin_service.py +++ b/app/services/admin_service.py @@ -845,9 +845,10 @@ class AdminService: job_id=job.id, status=job.status, marketplace=job.marketplace, + source_url=job.source_url, vendor_id=job.vendor.id if job.vendor else None, vendor_code=job.vendor.vendor_code if job.vendor else None, - vendor_name=job.vendor_name, + vendor_name=job.vendor.name if job.vendor else None, imported=job.imported_count or 0, updated=job.updated_count or 0, total_processed=job.total_processed or 0, diff --git a/app/services/marketplace_product_service.py b/app/services/marketplace_product_service.py index 9de1100c..3c96013a 100644 --- a/app/services/marketplace_product_service.py +++ b/app/services/marketplace_product_service.py @@ -344,7 +344,10 @@ class MarketplaceProductService: total_quantity = sum(entry.quantity for entry in inventory_entries) locations = [ InventoryLocationResponse( - location=entry.location, quantity=entry.quantity + location=entry.location, + quantity=entry.quantity, + reserved_quantity=entry.reserved_quantity or 0, + available_quantity=entry.quantity - (entry.reserved_quantity or 0), ) for entry in inventory_entries ] diff --git a/app/services/vendor_service.py b/app/services/vendor_service.py index d8a71cdb..ded91a8b 100644 --- a/app/services/vendor_service.py +++ b/app/services/vendor_service.py @@ -539,16 +539,16 @@ class VendorService: ) def _get_product_by_id_or_raise( - self, db: Session, marketplace_product_id: str + self, db: Session, marketplace_product_id: int ) -> MarketplaceProduct: - """Get product by ID or raise exception.""" + """Get marketplace product by database ID or raise exception.""" product = ( db.query(MarketplaceProduct) - .filter(MarketplaceProduct.marketplace_product_id == marketplace_product_id) + .filter(MarketplaceProduct.id == marketplace_product_id) .first() ) if not product: - raise MarketplaceProductNotFoundException(marketplace_product_id) + raise MarketplaceProductNotFoundException(str(marketplace_product_id)) return product def _product_in_catalog( diff --git a/models/schema/inventory.py b/models/schema/inventory.py index 5bf3245b..1e33efad 100644 --- a/models/schema/inventory.py +++ b/models/schema/inventory.py @@ -88,3 +88,11 @@ class InventoryMessageResponse(BaseModel): """Simple message response for inventory operations.""" message: str + + +class InventorySummaryResponse(BaseModel): + """Inventory summary response for marketplace product service.""" + + gtin: str + total_quantity: int + locations: list[InventoryLocationResponse]