fixing DQ issues

This commit is contained in:
2025-09-14 15:47:38 +02:00
parent 3eb18ef91e
commit 0ce708cf09
27 changed files with 430 additions and 214 deletions

View File

@@ -1,3 +1,12 @@
# app/api/v1/admin.py
"""Summary description ....
This module provides classes and functions for:
- ....
- ....
- ....
"""
import logging
from typing import List, Optional
@@ -7,8 +16,11 @@ from sqlalchemy.orm import Session
from app.api.deps import get_current_admin_user
from app.core.database import get_db
from app.services.admin_service import admin_service
from models.api_models import (MarketplaceImportJobResponse, ShopListResponse,
UserResponse)
from models.api_models import (
MarketplaceImportJobResponse,
ShopListResponse,
UserResponse,
)
from models.database_models import User
router = APIRouter()
@@ -23,7 +35,7 @@ def get_all_users(
db: Session = Depends(get_db),
current_admin: User = Depends(get_current_admin_user),
):
"""Get all users (Admin only)"""
"""Get all users (Admin only)."""
try:
users = admin_service.get_all_users(db=db, skip=skip, limit=limit)
return [UserResponse.model_validate(user) for user in users]
@@ -38,7 +50,7 @@ def toggle_user_status(
db: Session = Depends(get_db),
current_admin: User = Depends(get_current_admin_user),
):
"""Toggle user active status (Admin only)"""
"""Toggle user active status (Admin only)."""
try:
user, message = admin_service.toggle_user_status(db, user_id, current_admin.id)
return {"message": message}
@@ -56,7 +68,7 @@ def get_all_shops_admin(
db: Session = Depends(get_db),
current_admin: User = Depends(get_current_admin_user),
):
"""Get all shops with admin view (Admin only)"""
"""Get all shops with admin view (Admin only)."""
try:
shops, total = admin_service.get_all_shops(db=db, skip=skip, limit=limit)
@@ -72,7 +84,7 @@ def verify_shop(
db: Session = Depends(get_db),
current_admin: User = Depends(get_current_admin_user),
):
"""Verify/unverify shop (Admin only)"""
"""Verify/unverify shop (Admin only)."""
try:
shop, message = admin_service.verify_shop(db, shop_id)
return {"message": message}
@@ -89,7 +101,7 @@ def toggle_shop_status(
db: Session = Depends(get_db),
current_admin: User = Depends(get_current_admin_user),
):
"""Toggle shop active status (Admin only)"""
"""Toggle shop active status (Admin only)."""
try:
shop, message = admin_service.toggle_shop_status(db, shop_id)
return {"message": message}
@@ -112,7 +124,7 @@ def get_all_marketplace_import_jobs(
db: Session = Depends(get_db),
current_admin: User = Depends(get_current_admin_user),
):
"""Get all marketplace import jobs (Admin only)"""
"""Get all marketplace import jobs (Admin only)."""
try:
return admin_service.get_marketplace_import_jobs(
db=db,