22 lines
1.1 KiB
Python
22 lines
1.1 KiB
Python
from fastapi import APIRouter, Depends, Query
|
|
from typing import List, Optional
|
|
from ..schemas.events import ConcertEventResponse
|
|
|
|
router = APIRouter(prefix="/api/events", tags=["events"])
|
|
|
|
PLACEHOLDER_EVENTS = [
|
|
{"id": "1", "name": "Summer Music Festival", "venue": "Central Park", "location_lat": 40.7829, "location_lon": -73.9654, "date": "2025-07-15", "description": "A day of live music", "image_url": None},
|
|
{"id": "2", "name": "Jazz Night", "venue": "Blue Note", "location_lat": 40.7310, "location_lon": -74.0020, "date": "2025-06-20", "description": "Live jazz performance", "image_url": None},
|
|
{"id": "3", "name": "Electronic Beats", "venue": "Warehouse District", "location_lat": 40.7580, "location_lon": -73.9855, "date": "2025-08-10", "description": "Electronic music showcase", "image_url": None},
|
|
]
|
|
|
|
|
|
@router.get("", response_model=List[ConcertEventResponse])
|
|
def list_events(lat: Optional[float] = None, lon: Optional[float] = None):
|
|
return PLACEHOLDER_EVENTS
|
|
|
|
|
|
@router.post("", response_model=ConcertEventResponse)
|
|
def add_event(event: ConcertEventResponse):
|
|
PLACEHOLDER_EVENTS.append(event.model_dump())
|
|
return event |