
- Fix unused imports in API endpoints - Add proper __all__ exports in model and schema modules - Add proper TYPE_CHECKING imports in models to prevent circular imports - Fix import order in migrations - Fix long lines in migration scripts - All ruff checks passing
53 lines
1.0 KiB
Python
53 lines
1.0 KiB
Python
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel, EmailStr
|
|
|
|
|
|
# Shared properties
|
|
class SupplierBase(BaseModel):
|
|
"""
|
|
Base schema for supplier data.
|
|
"""
|
|
name: Optional[str] = None
|
|
contact_name: Optional[str] = None
|
|
email: Optional[EmailStr] = None
|
|
phone: Optional[str] = None
|
|
address: Optional[str] = None
|
|
notes: Optional[str] = None
|
|
|
|
|
|
# Properties to receive via API on creation
|
|
class SupplierCreate(SupplierBase):
|
|
"""
|
|
Schema for creating new suppliers.
|
|
"""
|
|
name: str
|
|
|
|
|
|
# Properties to receive via API on update
|
|
class SupplierUpdate(SupplierBase):
|
|
"""
|
|
Schema for updating supplier data.
|
|
"""
|
|
pass
|
|
|
|
|
|
class SupplierInDBBase(SupplierBase):
|
|
"""
|
|
Base schema for supplier data from the database.
|
|
"""
|
|
id: str
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Additional properties to return via API
|
|
class Supplier(SupplierInDBBase):
|
|
"""
|
|
Schema for supplier data to return via API.
|
|
"""
|
|
pass |