test updates to take into account exception management
This commit is contained in:
@@ -353,45 +353,5 @@ class ShopService:
|
||||
"""Check if user is shop owner."""
|
||||
return shop.owner_id == user.id
|
||||
|
||||
# Legacy methods for backward compatibility (deprecated)
|
||||
def get_shop_by_id(self, db: Session, shop_id: int) -> Optional[Shop]:
|
||||
"""Get shop by ID. DEPRECATED: Use proper exception handling."""
|
||||
logger.warning("get_shop_by_id is deprecated, use proper exception handling")
|
||||
try:
|
||||
return db.query(Shop).filter(Shop.id == shop_id).first()
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting shop by ID: {str(e)}")
|
||||
return None
|
||||
|
||||
def shop_code_exists(self, db: Session, shop_code: str) -> bool:
|
||||
"""Check if shop code exists. DEPRECATED: Use proper exception handling."""
|
||||
logger.warning("shop_code_exists is deprecated, use proper exception handling")
|
||||
return self._shop_code_exists(db, shop_code)
|
||||
|
||||
def get_product_by_id(self, db: Session, product_id: str) -> Optional[Product]:
|
||||
"""Get product by ID. DEPRECATED: Use proper exception handling."""
|
||||
logger.warning("get_product_by_id is deprecated, use proper exception handling")
|
||||
try:
|
||||
return db.query(Product).filter(Product.product_id == product_id).first()
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting product by ID: {str(e)}")
|
||||
return None
|
||||
|
||||
def product_in_shop(self, db: Session, shop_id: int, product_id: int) -> bool:
|
||||
"""Check if product in shop. DEPRECATED: Use proper exception handling."""
|
||||
logger.warning("product_in_shop is deprecated, use proper exception handling")
|
||||
return self._product_in_shop(db, shop_id, product_id)
|
||||
|
||||
def is_shop_owner(self, shop: Shop, user: User) -> bool:
|
||||
"""Check if user is shop owner. DEPRECATED: Use _is_shop_owner."""
|
||||
logger.warning("is_shop_owner is deprecated, use _is_shop_owner")
|
||||
return self._is_shop_owner(shop, user)
|
||||
|
||||
def can_view_shop(self, shop: Shop, user: User) -> bool:
|
||||
"""Check if user can view shop. DEPRECATED: Use _can_access_shop."""
|
||||
logger.warning("can_view_shop is deprecated, use _can_access_shop")
|
||||
return self._can_access_shop(shop, user)
|
||||
|
||||
|
||||
# Create service instance following the same pattern as other services
|
||||
shop_service = ShopService()
|
||||
|
||||
Reference in New Issue
Block a user