
- Set up FastAPI application with CORS and authentication - Implement user registration and login with JWT tokens - Create SQLAlchemy models for users and items - Add CRUD endpoints for item management - Configure Alembic for database migrations - Add health check endpoint - Include comprehensive API documentation - Set up proper project structure with routers and schemas
28 lines
522 B
Python
28 lines
522 B
Python
from pydantic import BaseModel, EmailStr
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
class UserBase(BaseModel):
|
|
email: EmailStr
|
|
|
|
class UserCreate(UserBase):
|
|
password: str
|
|
|
|
class UserLogin(BaseModel):
|
|
email: EmailStr
|
|
password: str
|
|
|
|
class User(UserBase):
|
|
id: int
|
|
is_active: bool
|
|
created_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
class Token(BaseModel):
|
|
access_token: str
|
|
token_type: str
|
|
|
|
class TokenData(BaseModel):
|
|
email: Optional[str] = None |