Files
bdinvite/backend/app/routes/config.py
T
kiskaadee a7567aa69b feat(backend): implement FastAPI core service, SQLite WAL and admin
endpoints

- add SQLAlchemy models for RSVPS and singleton invitation configuration
- implement phone number normalization (10d Colombia standard) and
  duplicate detection
- add Authelia Remote-User security guard on all admin endpoints
- use typing.Annotated for FastAPI dependencies and date.fromisoformat
- add CSV export for RSVP responses
- add SPA catch-all mount under /birthday/
- add linting and static check configuration
2026-09-30 20:47:08 -05:00

28 lines
740 B
Python

from typing import Annotated
from fastapi import APIRouter, Depends, status
from fastapi.responses import JSONResponse
from sqlalchemy.orm import Session
from ..database import get_db
from ..schemas import InvitationConfigResponse
from ..services.config import get_config, seed_default_config
router = APIRouter(tags=["Config"])
DbDep = Annotated[Session, Depends(get_db)]
@router.get("/config", response_model=InvitationConfigResponse)
def read_config(db: DbDep):
config = get_config(db)
if not config:
config = seed_default_config(db)
if not config:
return JSONResponse(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
content={"result": "ERROR"},
)
return config