Initial commit: Tasteby - YouTube restaurant map service

Backend (FastAPI + Oracle ADB), Frontend (Next.js), daemon worker.
Features: channel/video/restaurant management, semantic search,
Google OAuth, user reviews.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
joungmin
2026-03-06 13:47:19 +09:00
commit 36bec10bd0
54 changed files with 9727 additions and 0 deletions

32
backend/api/deps.py Normal file
View File

@@ -0,0 +1,32 @@
"""FastAPI dependencies for authentication."""
from __future__ import annotations
from fastapi import Header, HTTPException
from core.auth import verify_jwt
def get_current_user(authorization: str = Header(None)) -> dict:
"""Extract and verify Bearer token, return user payload.
Raises 401 if token is missing or invalid.
"""
if not authorization or not authorization.startswith("Bearer "):
raise HTTPException(401, "Missing or invalid Authorization header")
token = authorization.removeprefix("Bearer ").strip()
try:
return verify_jwt(token)
except Exception:
raise HTTPException(401, "Invalid or expired token")
def get_optional_user(authorization: str = Header(None)) -> dict | None:
"""Same as get_current_user but returns None if no token."""
if not authorization or not authorization.startswith("Bearer "):
return None
token = authorization.removeprefix("Bearer ").strip()
try:
return verify_jwt(token)
except Exception:
return None