22 lines
535 B
Python
22 lines
535 B
Python
from typing import Any, Dict
|
|
|
|
from fastapi import APIRouter, Depends
|
|
|
|
from app.models.user import User
|
|
from app.services.auth import get_current_active_user
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/", response_model=Dict[str, Any])
|
|
def get_protected_data(
|
|
current_user: User = Depends(get_current_active_user),
|
|
) -> Any:
|
|
"""
|
|
Protected endpoint example that requires authentication.
|
|
"""
|
|
return {
|
|
"message": "This is protected data",
|
|
"user_id": current_user.id,
|
|
"email": current_user.email,
|
|
} |