
- Created user model with SQLAlchemy ORM - Implemented authentication with JWT tokens (access and refresh tokens) - Added password hashing with bcrypt - Created API endpoints for registration, login, and user management - Set up Alembic for database migrations - Added health check endpoint - Created role-based access control (standard users and superusers) - Added comprehensive documentation
19 lines
414 B
Python
19 lines
414 B
Python
from typing import Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class Token(BaseModel):
|
|
access_token: str
|
|
token_type: str
|
|
refresh_token: str
|
|
|
|
|
|
class TokenPayload(BaseModel):
|
|
sub: Optional[str] = None # subject (typically user ID)
|
|
exp: Optional[int] = None # expiration time
|
|
type: Optional[str] = None # token type (access or refresh)
|
|
|
|
|
|
class RefreshToken(BaseModel):
|
|
refresh_token: str |