
- Implement user authentication with JWT tokens - Add messaging system for sending/receiving messages - Create SQLite database with SQLAlchemy models - Set up Alembic for database migrations - Add health check endpoint - Include comprehensive API documentation - Support user registration, login, and message management - Enable conversation history and user listing
30 lines
578 B
Python
30 lines
578 B
Python
from pydantic import BaseModel, EmailStr
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
class UserBase(BaseModel):
|
|
email: EmailStr
|
|
username: str
|
|
|
|
class UserCreate(UserBase):
|
|
password: str
|
|
|
|
class UserLogin(BaseModel):
|
|
email: EmailStr
|
|
password: str
|
|
|
|
class User(UserBase):
|
|
id: int
|
|
is_active: bool
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
class Token(BaseModel):
|
|
access_token: str
|
|
token_type: str
|
|
|
|
class TokenData(BaseModel):
|
|
email: Optional[str] = None |