fixing DQ issues
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
# app/api/v1/product.py
|
||||
"""Summary description ....
|
||||
|
||||
This module provides classes and functions for:
|
||||
- ....
|
||||
- ....
|
||||
- ....
|
||||
"""
|
||||
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
@@ -8,9 +17,13 @@ from sqlalchemy.orm import Session
|
||||
from app.api.deps import get_current_user
|
||||
from app.core.database import get_db
|
||||
from app.services.product_service import product_service
|
||||
from models.api_models import (ProductCreate, ProductDetailResponse,
|
||||
ProductListResponse, ProductResponse,
|
||||
ProductUpdate)
|
||||
from models.api_models import (
|
||||
ProductCreate,
|
||||
ProductDetailResponse,
|
||||
ProductListResponse,
|
||||
ProductResponse,
|
||||
ProductUpdate,
|
||||
)
|
||||
from models.database_models import User
|
||||
|
||||
router = APIRouter()
|
||||
@@ -31,8 +44,7 @@ def get_products(
|
||||
db: Session = Depends(get_db),
|
||||
current_user: User = Depends(get_current_user),
|
||||
):
|
||||
"""Get products with advanced filtering including marketplace and shop (Protected)"""
|
||||
|
||||
"""Get products with advanced filtering including marketplace and shop (Protected)."""
|
||||
try:
|
||||
products, total = product_service.get_products_with_filters(
|
||||
db=db,
|
||||
@@ -60,8 +72,7 @@ def create_product(
|
||||
db: Session = Depends(get_db),
|
||||
current_user: User = Depends(get_current_user),
|
||||
):
|
||||
"""Create a new product with validation and marketplace support (Protected)"""
|
||||
|
||||
"""Create a new product with validation and marketplace support (Protected)."""
|
||||
try:
|
||||
logger.info(f"Starting product creation for ID: {product.product_id}")
|
||||
|
||||
@@ -99,8 +110,7 @@ def get_product(
|
||||
db: Session = Depends(get_db),
|
||||
current_user: User = Depends(get_current_user),
|
||||
):
|
||||
"""Get product with stock information (Protected)"""
|
||||
|
||||
"""Get product with stock information (Protected)."""
|
||||
try:
|
||||
product = product_service.get_product_by_id(db, product_id)
|
||||
if not product:
|
||||
@@ -127,8 +137,7 @@ def update_product(
|
||||
db: Session = Depends(get_db),
|
||||
current_user: User = Depends(get_current_user),
|
||||
):
|
||||
"""Update product with validation and marketplace support (Protected)"""
|
||||
|
||||
"""Update product with validation and marketplace support (Protected)."""
|
||||
try:
|
||||
product = product_service.get_product_by_id(db, product_id)
|
||||
if not product:
|
||||
@@ -152,8 +161,7 @@ def delete_product(
|
||||
db: Session = Depends(get_db),
|
||||
current_user: User = Depends(get_current_user),
|
||||
):
|
||||
"""Delete product and associated stock (Protected)"""
|
||||
|
||||
"""Delete product and associated stock (Protected)."""
|
||||
try:
|
||||
product = product_service.get_product_by_id(db, product_id)
|
||||
if not product:
|
||||
@@ -178,8 +186,7 @@ async def export_csv(
|
||||
db: Session = Depends(get_db),
|
||||
current_user: User = Depends(get_current_user),
|
||||
):
|
||||
"""Export products as CSV with streaming and marketplace filtering (Protected)"""
|
||||
|
||||
"""Export products as CSV with streaming and marketplace filtering (Protected)."""
|
||||
try:
|
||||
|
||||
def generate_csv():
|
||||
|
||||
Reference in New Issue
Block a user