
- Set up project structure with FastAPI - Implement SQLAlchemy models for User and Task - Create Alembic migrations - Implement authentication with JWT - Add CRUD operations for tasks - Add task filtering and prioritization - Configure health check endpoint - Update README with project documentation
35 lines
871 B
Python
35 lines
871 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
from pydantic import BaseModel, EmailStr, Field, ConfigDict
|
|
|
|
# Shared properties
|
|
class UserBase(BaseModel):
|
|
email: EmailStr
|
|
is_active: bool = True
|
|
|
|
# Properties to receive on user creation
|
|
class UserCreate(UserBase):
|
|
password: str = Field(..., min_length=8)
|
|
|
|
# Properties to receive on user update
|
|
class UserUpdate(BaseModel):
|
|
email: Optional[EmailStr] = None
|
|
password: Optional[str] = Field(None, min_length=8)
|
|
is_active: Optional[bool] = None
|
|
|
|
# Properties shared by models stored in DB
|
|
class UserInDBBase(UserBase):
|
|
id: str
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
# Properties to return to client
|
|
class User(UserInDBBase):
|
|
pass
|
|
|
|
# Properties stored in DB
|
|
class UserInDB(UserInDBBase):
|
|
hashed_password: str
|