
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
38 lines
761 B
Python
38 lines
761 B
Python
from typing import Optional
|
|
from pydantic import BaseModel, EmailStr
|
|
|
|
|
|
# Shared properties
|
|
class UserBase(BaseModel):
|
|
email: Optional[EmailStr] = None
|
|
is_active: Optional[bool] = True
|
|
is_superuser: bool = False
|
|
full_name: Optional[str] = None
|
|
|
|
|
|
# Properties to receive via API on creation
|
|
class UserCreate(UserBase):
|
|
email: EmailStr
|
|
password: str
|
|
|
|
|
|
# Properties to receive via API on update
|
|
class UserUpdate(UserBase):
|
|
password: Optional[str] = None
|
|
|
|
|
|
class UserInDBBase(UserBase):
|
|
id: Optional[int] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Additional properties to return via API
|
|
class User(UserInDBBase):
|
|
pass
|
|
|
|
|
|
# Additional properties stored in DB
|
|
class UserInDB(UserInDBBase):
|
|
hashed_password: str |