fixing DQ issues
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
# app/services/admin_service.py
|
||||
"""Summary description ....
|
||||
|
||||
This module provides classes and functions for:
|
||||
- ....
|
||||
- ....
|
||||
- ....
|
||||
"""
|
||||
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from typing import List, Optional, Tuple
|
||||
@@ -12,17 +21,17 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AdminService:
|
||||
"""Service class for admin operations following the application's service pattern"""
|
||||
"""Service class for admin operations following the application's service pattern."""
|
||||
|
||||
def get_all_users(self, db: Session, skip: int = 0, limit: int = 100) -> List[User]:
|
||||
"""Get paginated list of all users"""
|
||||
"""Get paginated list of all users."""
|
||||
return db.query(User).offset(skip).limit(limit).all()
|
||||
|
||||
def toggle_user_status(
|
||||
self, db: Session, user_id: int, current_admin_id: int
|
||||
) -> Tuple[User, str]:
|
||||
"""
|
||||
Toggle user active status
|
||||
Toggle user active status.
|
||||
|
||||
Args:
|
||||
db: Database session
|
||||
@@ -59,7 +68,7 @@ class AdminService:
|
||||
self, db: Session, skip: int = 0, limit: int = 100
|
||||
) -> Tuple[List[Shop], int]:
|
||||
"""
|
||||
Get paginated list of all shops with total count
|
||||
Get paginated list of all shops with total count.
|
||||
|
||||
Args:
|
||||
db: Database session
|
||||
@@ -75,7 +84,7 @@ class AdminService:
|
||||
|
||||
def verify_shop(self, db: Session, shop_id: int) -> Tuple[Shop, str]:
|
||||
"""
|
||||
Toggle shop verification status
|
||||
Toggle shop verification status.
|
||||
|
||||
Args:
|
||||
db: Database session
|
||||
@@ -102,7 +111,7 @@ class AdminService:
|
||||
|
||||
def toggle_shop_status(self, db: Session, shop_id: int) -> Tuple[Shop, str]:
|
||||
"""
|
||||
Toggle shop active status
|
||||
Toggle shop active status.
|
||||
|
||||
Args:
|
||||
db: Database session
|
||||
@@ -137,7 +146,7 @@ class AdminService:
|
||||
limit: int = 100,
|
||||
) -> List[MarketplaceImportJobResponse]:
|
||||
"""
|
||||
Get filtered and paginated marketplace import jobs
|
||||
Get filtered and paginated marketplace import jobs.
|
||||
|
||||
Args:
|
||||
db: Database session
|
||||
@@ -190,19 +199,19 @@ class AdminService:
|
||||
]
|
||||
|
||||
def get_user_by_id(self, db: Session, user_id: int) -> Optional[User]:
|
||||
"""Get user by ID"""
|
||||
"""Get user by ID."""
|
||||
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"""
|
||||
"""Get shop by ID."""
|
||||
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"""
|
||||
"""Check if user exists by ID."""
|
||||
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"""
|
||||
"""Check if shop exists by ID."""
|
||||
return db.query(Shop).filter(Shop.id == shop_id).first() is not None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user