
This commit includes: - Project structure setup with FastAPI and SQLite - Database models and schemas for inventory management - CRUD operations for all entities - API endpoints for product, category, supplier, and inventory management - User authentication with JWT tokens - Initial database migration - Comprehensive README with setup instructions
42 lines
863 B
Python
42 lines
863 B
Python
from typing import Optional
|
|
from pydantic import BaseModel, EmailStr
|
|
|
|
|
|
# Shared properties
|
|
class SupplierBase(BaseModel):
|
|
name: Optional[str] = None
|
|
contact_name: Optional[str] = None
|
|
email: Optional[EmailStr] = None
|
|
phone: Optional[str] = None
|
|
address: Optional[str] = None
|
|
website: Optional[str] = None
|
|
notes: Optional[str] = None
|
|
|
|
|
|
# Properties to receive on supplier creation
|
|
class SupplierCreate(SupplierBase):
|
|
name: str
|
|
|
|
|
|
# Properties to receive on supplier update
|
|
class SupplierUpdate(SupplierBase):
|
|
pass
|
|
|
|
|
|
# Properties shared by models in DB
|
|
class SupplierInDBBase(SupplierBase):
|
|
id: int
|
|
name: str
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Properties to return to client
|
|
class Supplier(SupplierInDBBase):
|
|
pass
|
|
|
|
|
|
# Properties properties stored in DB
|
|
class SupplierInDB(SupplierInDBBase):
|
|
pass |