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,21 +1,29 @@
import logging
from datetime import datetime
from typing import List, Optional
# app/api/v1/shop.py
"""Summary description ....
from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException, Query
This module provides classes and functions for:
- ....
- ....
- ....
"""
import logging
from fastapi import APIRouter, Depends, HTTPException, Query
from sqlalchemy.orm import Session
from app.api.deps import get_current_user, get_user_shop
from app.core.database import get_db
from app.services.shop_service import shop_service
from app.tasks.background_tasks import process_marketplace_import
from middleware.decorators import rate_limit
from models.api_models import (MarketplaceImportJobResponse,
MarketplaceImportRequest, ShopCreate,
ShopListResponse, ShopProductCreate,
ShopProductResponse, ShopResponse)
from models.database_models import (MarketplaceImportJob, Product, Shop,
ShopProduct, User)
from models.api_models import (
ShopCreate,
ShopListResponse,
ShopProductCreate,
ShopProductResponse,
ShopResponse,
)
from models.database_models import User
router = APIRouter()
logger = logging.getLogger(__name__)
@@ -28,7 +36,7 @@ def create_shop(
db: Session = Depends(get_db),
current_user: User = Depends(get_current_user),
):
"""Create a new shop (Protected)"""
"""Create a new shop (Protected)."""
try:
shop = shop_service.create_shop(
db=db, shop_data=shop_data, current_user=current_user
@@ -50,7 +58,7 @@ def get_shops(
db: Session = Depends(get_db),
current_user: User = Depends(get_current_user),
):
"""Get shops with filtering (Protected)"""
"""Get shops with filtering (Protected)."""
try:
shops, total = shop_service.get_shops(
db=db,
@@ -75,7 +83,7 @@ def get_shop(
db: Session = Depends(get_db),
current_user: User = Depends(get_current_user),
):
"""Get shop details (Protected)"""
"""Get shop details (Protected)."""
try:
shop = shop_service.get_shop_by_code(
db=db, shop_code=shop_code, current_user=current_user
@@ -96,7 +104,7 @@ def add_product_to_shop(
db: Session = Depends(get_db),
current_user: User = Depends(get_current_user),
):
"""Add existing product to shop catalog with shop-specific settings (Protected)"""
"""Add existing product to shop catalog with shop-specific settings (Protected)."""
try:
# Get and verify shop (using existing dependency)
shop = get_user_shop(shop_code, current_user, db)
@@ -127,7 +135,7 @@ def get_shop_products(
db: Session = Depends(get_db),
current_user: User = Depends(get_current_user),
):
"""Get products in shop catalog (Protected)"""
"""Get products in shop catalog (Protected)."""
try:
# Get shop
shop = shop_service.get_shop_by_code(