shop product refactoring

This commit is contained in:
2025-10-04 23:38:53 +02:00
parent 4d2866af5e
commit 0114b6c46e
68 changed files with 2234 additions and 2236 deletions

View File

@@ -1,6 +1,6 @@
# app/exceptions/shop.py
# app/exceptions/vendor.py
"""
Shop management specific exceptions.
Vendor management specific exceptions.
"""
from .base import (
@@ -9,26 +9,26 @@ from .base import (
)
class ProductAlreadyExistsException(ConflictException):
"""Raised when trying to add a product that already exists in shop."""
"""Raised when trying to add a product that already exists in vendor."""
def __init__(self, shop_code: str, marketplace_product_id: str):
def __init__(self, vendor_code: str, marketplace_product_id: str):
super().__init__(
message=f"MarketplaceProduct '{marketplace_product_id}' already exists in shop '{shop_code}'",
message=f"MarketplaceProduct '{marketplace_product_id}' already exists in vendor '{vendor_code}'",
error_code="PRODUCT_ALREADY_EXISTS",
details={
"shop_code": shop_code,
"vendor_code": vendor_code,
"marketplace_product_id": marketplace_product_id,
},
)
class ProductNotFoundException(ResourceNotFoundException):
"""Raised when a shop product relationship is not found."""
"""Raised when a vendor product relationship is not found."""
def __init__(self, shop_code: str, marketplace_product_id: str):
def __init__(self, vendor_code: str, marketplace_product_id: str):
super().__init__(
resource_type="ShopProduct",
identifier=f"{shop_code}/{marketplace_product_id}",
message=f"MarketplaceProduct '{marketplace_product_id}' not found in shop '{shop_code}'",
resource_type="Product",
identifier=f"{vendor_code}/{marketplace_product_id}",
message=f"MarketplaceProduct '{marketplace_product_id}' not found in vendor '{vendor_code}'",
error_code="PRODUCT_NOT_FOUND",
)