Automated Action f8bb3dd21d Implement Task Management Tool with FastAPI and SQLite
- Set up FastAPI project structure with API versioning
- Create database models for users and tasks
- Implement SQLAlchemy ORM with SQLite database
- Initialize Alembic for database migrations
- Create API endpoints for task management (CRUD)
- Create API endpoints for user management
- Add JWT authentication and authorization
- Add health check endpoint
- Add comprehensive README.md with API documentation
2025-06-02 20:40:57 +00:00

54 lines
1.2 KiB
Python

from datetime import datetime
from typing import Optional
from pydantic import BaseModel, ConfigDict, EmailStr, Field
class UserBase(BaseModel):
"""
Base user schema with shared attributes
"""
email: EmailStr
username: str
full_name: Optional[str] = None
is_active: bool = True
class UserCreate(UserBase):
"""
Schema for user creation with password
"""
password: str = Field(..., min_length=8)
class UserUpdate(BaseModel):
"""
Schema for user updates
"""
email: Optional[EmailStr] = None
username: Optional[str] = None
full_name: Optional[str] = None
password: Optional[str] = Field(None, min_length=8)
is_active: Optional[bool] = None
class UserInDBBase(UserBase):
"""
Base schema for users in DB with id and timestamps
"""
id: int
created_at: datetime
updated_at: datetime
is_superuser: bool = False
model_config = ConfigDict(from_attributes=True)
class User(UserInDBBase):
"""
Schema for returning user information
"""
pass
class UserInDB(UserInDBBase):
"""
Schema with hashed password for internal use
"""
hashed_password: str