Add naming scheme selection to run configuration
Add a nullable naming_scheme column to NuzlockeRun so users can pick a themed word category for nickname suggestions. Includes Alembic migration, updated Pydantic schemas, a GET /runs/naming-categories endpoint backed by a cached dictionary loader, and frontend dropdowns in both the NewRun creation flow and the RunDashboard for mid-run changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
18
backend/src/app/services/naming.py
Normal file
18
backend/src/app/services/naming.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import json
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
|
||||
DICTIONARY_PATH = Path(__file__).resolve().parents[1] / "seeds" / "data" / "name_dictionary.json"
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def _load_dictionary() -> dict[str, list[str]]:
|
||||
if not DICTIONARY_PATH.exists():
|
||||
return {}
|
||||
with open(DICTIONARY_PATH) as f:
|
||||
return json.load(f)
|
||||
|
||||
|
||||
def get_naming_categories() -> list[str]:
|
||||
"""Return sorted list of available naming category names."""
|
||||
return sorted(_load_dictionary().keys())
|
||||
Reference in New Issue
Block a user