
- Created complete RESTful API for inventory management - Set up database models for items, categories, suppliers, and transactions - Implemented user authentication with JWT tokens - Added transaction tracking for inventory movements - Created comprehensive API endpoints for all CRUD operations - Set up Alembic for database migrations - Added input validation and error handling - Created detailed documentation in README
42 lines
835 B
Python
42 lines
835 B
Python
from datetime import datetime
|
|
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: str
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
# Additional properties to return via API
|
|
class User(UserInDBBase):
|
|
pass
|
|
|
|
|
|
# Additional properties stored in DB
|
|
class UserInDB(UserInDBBase):
|
|
hashed_password: str |