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>
34 lines
858 B
Python
34 lines
858 B
Python
"""Restaurant API routes."""
|
|
|
|
from fastapi import APIRouter, HTTPException, Query
|
|
|
|
from core import restaurant
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("")
|
|
def list_restaurants(
|
|
limit: int = Query(100, le=500),
|
|
offset: int = Query(0, ge=0),
|
|
cuisine: str | None = None,
|
|
region: str | None = None,
|
|
):
|
|
return restaurant.get_all(limit=limit, offset=offset, cuisine=cuisine, region=region)
|
|
|
|
|
|
@router.get("/{restaurant_id}")
|
|
def get_restaurant(restaurant_id: str):
|
|
r = restaurant.get_by_id(restaurant_id)
|
|
if not r:
|
|
raise HTTPException(404, "Restaurant not found")
|
|
return r
|
|
|
|
|
|
@router.get("/{restaurant_id}/videos")
|
|
def get_restaurant_videos(restaurant_id: str):
|
|
r = restaurant.get_by_id(restaurant_id)
|
|
if not r:
|
|
raise HTTPException(404, "Restaurant not found")
|
|
return restaurant.get_video_links(restaurant_id)
|