style: apply black and isort formatting across entire codebase
- Standardize quote style (single to double quotes) - Reorder and group imports alphabetically - Fix line breaks and indentation for consistency - Apply PEP 8 formatting standards Also updated Makefile to exclude both venv and .venv from code quality checks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,8 @@ Schemas include:
|
||||
|
||||
import re
|
||||
from datetime import datetime
|
||||
from typing import Dict, List, Optional, Any
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
||||
|
||||
|
||||
@@ -27,32 +28,26 @@ class VendorCreate(BaseModel):
|
||||
...,
|
||||
description="Unique vendor identifier (e.g., TECHSTORE)",
|
||||
min_length=2,
|
||||
max_length=50
|
||||
max_length=50,
|
||||
)
|
||||
subdomain: str = Field(
|
||||
...,
|
||||
description="Unique subdomain for the vendor",
|
||||
min_length=2,
|
||||
max_length=100
|
||||
..., description="Unique subdomain for the vendor", min_length=2, max_length=100
|
||||
)
|
||||
name: str = Field(
|
||||
...,
|
||||
description="Display name of the vendor",
|
||||
min_length=2,
|
||||
max_length=255
|
||||
..., description="Display name of the vendor", min_length=2, max_length=255
|
||||
)
|
||||
description: Optional[str] = Field(None, description="Vendor description")
|
||||
|
||||
# Owner Information (Creates User Account)
|
||||
owner_email: str = Field(
|
||||
...,
|
||||
description="Email for the vendor owner (used for login and authentication)"
|
||||
description="Email for the vendor owner (used for login and authentication)",
|
||||
)
|
||||
|
||||
# Business Contact Information (Vendor Fields)
|
||||
contact_email: Optional[str] = Field(
|
||||
None,
|
||||
description="Public business contact email (defaults to owner_email if not provided)"
|
||||
description="Public business contact email (defaults to owner_email if not provided)",
|
||||
)
|
||||
contact_phone: Optional[str] = Field(None, description="Contact phone number")
|
||||
website: Optional[str] = Field(None, description="Website URL")
|
||||
@@ -78,8 +73,10 @@ class VendorCreate(BaseModel):
|
||||
@classmethod
|
||||
def validate_subdomain(cls, v):
|
||||
"""Validate subdomain format: lowercase alphanumeric with hyphens."""
|
||||
if v and not re.match(r'^[a-z0-9][a-z0-9-]*[a-z0-9]$', v):
|
||||
raise ValueError("Subdomain must contain only lowercase letters, numbers, and hyphens")
|
||||
if v and not re.match(r"^[a-z0-9][a-z0-9-]*[a-z0-9]$", v):
|
||||
raise ValueError(
|
||||
"Subdomain must contain only lowercase letters, numbers, and hyphens"
|
||||
)
|
||||
return v.lower() if v else v
|
||||
|
||||
@field_validator("vendor_code")
|
||||
@@ -104,8 +101,7 @@ class VendorUpdate(BaseModel):
|
||||
|
||||
# Business Contact Information (Vendor Fields)
|
||||
contact_email: Optional[str] = Field(
|
||||
None,
|
||||
description="Public business contact email"
|
||||
None, description="Public business contact email"
|
||||
)
|
||||
contact_phone: Optional[str] = None
|
||||
website: Optional[str] = None
|
||||
@@ -142,6 +138,7 @@ class VendorUpdate(BaseModel):
|
||||
|
||||
class VendorResponse(BaseModel):
|
||||
"""Standard schema for vendor response data."""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
@@ -184,13 +181,9 @@ class VendorDetailResponse(VendorResponse):
|
||||
"""
|
||||
|
||||
owner_email: str = Field(
|
||||
...,
|
||||
description="Email of the vendor owner (for login/authentication)"
|
||||
)
|
||||
owner_username: str = Field(
|
||||
...,
|
||||
description="Username of the vendor owner"
|
||||
..., description="Email of the vendor owner (for login/authentication)"
|
||||
)
|
||||
owner_username: str = Field(..., description="Username of the vendor owner")
|
||||
|
||||
|
||||
class VendorCreateResponse(VendorDetailResponse):
|
||||
@@ -201,17 +194,14 @@ class VendorCreateResponse(VendorDetailResponse):
|
||||
"""
|
||||
|
||||
temporary_password: str = Field(
|
||||
...,
|
||||
description="Temporary password for owner (SHOWN ONLY ONCE)"
|
||||
)
|
||||
login_url: Optional[str] = Field(
|
||||
None,
|
||||
description="URL for vendor owner to login"
|
||||
..., description="Temporary password for owner (SHOWN ONLY ONCE)"
|
||||
)
|
||||
login_url: Optional[str] = Field(None, description="URL for vendor owner to login")
|
||||
|
||||
|
||||
class VendorListResponse(BaseModel):
|
||||
"""Schema for paginated vendor list."""
|
||||
|
||||
vendors: List[VendorResponse]
|
||||
total: int
|
||||
skip: int
|
||||
@@ -220,6 +210,7 @@ class VendorListResponse(BaseModel):
|
||||
|
||||
class VendorSummary(BaseModel):
|
||||
"""Lightweight vendor summary for dropdowns and quick references."""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
@@ -239,20 +230,17 @@ class VendorTransferOwnership(BaseModel):
|
||||
"""
|
||||
|
||||
new_owner_user_id: int = Field(
|
||||
...,
|
||||
description="ID of the user who will become the new owner",
|
||||
gt=0
|
||||
..., description="ID of the user who will become the new owner", gt=0
|
||||
)
|
||||
|
||||
confirm_transfer: bool = Field(
|
||||
...,
|
||||
description="Must be true to confirm ownership transfer"
|
||||
..., description="Must be true to confirm ownership transfer"
|
||||
)
|
||||
|
||||
transfer_reason: Optional[str] = Field(
|
||||
None,
|
||||
max_length=500,
|
||||
description="Reason for ownership transfer (for audit logs)"
|
||||
description="Reason for ownership transfer (for audit logs)",
|
||||
)
|
||||
|
||||
@field_validator("confirm_transfer")
|
||||
@@ -273,12 +261,10 @@ class VendorTransferOwnershipResponse(BaseModel):
|
||||
vendor_name: str
|
||||
|
||||
old_owner: Dict[str, Any] = Field(
|
||||
...,
|
||||
description="Information about the previous owner"
|
||||
..., description="Information about the previous owner"
|
||||
)
|
||||
new_owner: Dict[str, Any] = Field(
|
||||
...,
|
||||
description="Information about the new owner"
|
||||
..., description="Information about the new owner"
|
||||
)
|
||||
|
||||
transferred_at: datetime
|
||||
|
||||
Reference in New Issue
Block a user