feat(04-02): command pattern + CommandHistory + block CRUD backend

- CommandHistory class with execute/undo/redo, 50-step max, redo-clear on new action
- PlaceBlockCommand, MoveBlockCommand, ResizeBlockCommand, DeleteBlockCommand
- setCurrentShowId() module-level function for backend sync routing
- syncBlock() fire-and-forget fetch helper for backend sync
- POST/PATCH/DELETE /api/shows/{show_id}/tracks/{device_id}/blocks endpoints
- timeline router registered in main.py with prefix=/api
This commit is contained in:
Claude
2026-04-06 23:37:29 +00:00
parent 96d7825c34
commit 658c92f94d
4 changed files with 234 additions and 1 deletions

View File

@@ -42,11 +42,12 @@ def create_app() -> FastAPI:
app = FastAPI(title="LightSync", lifespan=lifespan, redirect_slashes=False)
# API routes (registered before static mount — see Pattern 7)
from lightsync.api import shows, devices, ws, audio
from lightsync.api import shows, devices, ws, audio, timeline
app.include_router(shows.router, prefix="/api/shows")
app.include_router(devices.router, prefix="/api/devices")
app.include_router(ws.router)
app.include_router(audio.router, prefix="/api/audio")
app.include_router(timeline.router, prefix="/api")
# Serve uploaded audio files so <audio src=...> can load them
shows_dir = Path("/app/shows")