test updates to take into account exception management

This commit is contained in:
2025-09-27 13:47:36 +02:00
parent 3e720212d9
commit 6b9817f179
38 changed files with 2951 additions and 871 deletions

View File

@@ -337,27 +337,6 @@ class AdminService:
completed_at=job.completed_at,
)
# Legacy methods for backward compatibility (mark as deprecated)
def get_user_by_id(self, db: Session, user_id: int) -> Optional[User]:
"""Get user by ID. DEPRECATED: Use _get_user_by_id_or_raise instead."""
logger.warning("get_user_by_id is deprecated, use proper exception handling")
return db.query(User).filter(User.id == user_id).first()
def get_shop_by_id(self, db: Session, shop_id: int) -> Optional[Shop]:
"""Get shop by ID. DEPRECATED: Use _get_shop_by_id_or_raise instead."""
logger.warning("get_shop_by_id is deprecated, use proper exception handling")
return db.query(Shop).filter(Shop.id == shop_id).first()
def user_exists(self, db: Session, user_id: int) -> bool:
"""Check if user exists by ID. DEPRECATED: Use proper exception handling."""
logger.warning("user_exists is deprecated, use proper exception handling")
return db.query(User).filter(User.id == user_id).first() is not None
def shop_exists(self, db: Session, shop_id: int) -> bool:
"""Check if shop exists by ID. DEPRECATED: Use proper exception handling."""
logger.warning("shop_exists is deprecated, use proper exception handling")
return db.query(Shop).filter(Shop.id == shop_id).first() is not None
# Create service instance following the same pattern as product_service
admin_service = AdminService()