- Replace black, isort, and flake8 with Ruff (all-in-one linter and formatter) - Add comprehensive pyproject.toml configuration - Simplify Makefile code quality targets - Configure exclusions for venv/.venv in pyproject.toml - Auto-fix 1,359 linting issues across codebase Benefits: - Much faster builds (Ruff is written in Rust) - Single tool replaces multiple tools - More comprehensive rule set (UP, B, C4, SIM, PIE, RET, Q) - All configuration centralized in pyproject.toml - Better import sorting and formatting consistency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
81 lines
2.5 KiB
Python
81 lines
2.5 KiB
Python
# models/schema/marketplace_products.py - Simplified validation
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
from models.schema.inventory import ProductInventorySummary
|
|
|
|
|
|
class MarketplaceProductBase(BaseModel):
|
|
marketplace_product_id: str | None = None
|
|
title: str | None = None
|
|
description: str | None = None
|
|
link: str | None = None
|
|
image_link: str | None = None
|
|
availability: str | None = None
|
|
price: str | None = None
|
|
brand: str | None = None
|
|
gtin: str | None = None
|
|
mpn: str | None = None
|
|
condition: str | None = None
|
|
adult: str | None = None
|
|
multipack: int | None = None
|
|
is_bundle: str | None = None
|
|
age_group: str | None = None
|
|
color: str | None = None
|
|
gender: str | None = None
|
|
material: str | None = None
|
|
pattern: str | None = None
|
|
size: str | None = None
|
|
size_type: str | None = None
|
|
size_system: str | None = None
|
|
item_group_id: str | None = None
|
|
google_product_category: str | None = None
|
|
product_type: str | None = None
|
|
custom_label_0: str | None = None
|
|
custom_label_1: str | None = None
|
|
custom_label_2: str | None = None
|
|
custom_label_3: str | None = None
|
|
custom_label_4: str | None = None
|
|
additional_image_link: str | None = None
|
|
sale_price: str | None = None
|
|
unit_pricing_measure: str | None = None
|
|
unit_pricing_base_measure: str | None = None
|
|
identifier_exists: str | None = None
|
|
shipping: str | None = None
|
|
currency: str | None = None
|
|
marketplace: str | None = None
|
|
vendor_name: str | None = None
|
|
|
|
|
|
class MarketplaceProductCreate(MarketplaceProductBase):
|
|
marketplace_product_id: str = Field(
|
|
..., description="MarketplaceProduct identifier"
|
|
)
|
|
title: str = Field(..., description="MarketplaceProduct title")
|
|
# Removed: min_length constraints and custom validators
|
|
# Service will handle empty string validation with proper domain exceptions
|
|
|
|
|
|
class MarketplaceProductUpdate(MarketplaceProductBase):
|
|
pass
|
|
|
|
|
|
class MarketplaceProductResponse(MarketplaceProductBase):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class MarketplaceProductListResponse(BaseModel):
|
|
products: list[MarketplaceProductResponse]
|
|
total: int
|
|
skip: int
|
|
limit: int
|
|
|
|
|
|
class MarketplaceProductDetailResponse(BaseModel):
|
|
product: MarketplaceProductResponse
|
|
inventory_info: ProductInventorySummary | None = None
|