diff options
| author | Tyler Hoang <tyler@tylerhoang.xyz> | 2026-05-12 03:15:17 -0700 |
|---|---|---|
| committer | Tyler Hoang <tyler@tylerhoang.xyz> | 2026-05-12 03:15:17 -0700 |
| commit | 4279408876268f4960c98492d3814f5475e36e38 (patch) | |
| tree | 9fc4828768534368a575c2e60d39d02de0973b79 /routers/films.py | |
| parent | 61d68b339fee628c258e15c8664b6bcad2e70ab1 (diff) | |
Add stats totals, runtime summary, and duplicate detection on add form
- Stats page now shows total films watched and total runtime (formatted
as Xd Yh) in an overview panel above the world map
- /stats/data endpoint includes total_runtime_minutes in payload
- New GET /films/find endpoint returns all shelf matches for a tmdb_id
- Add film form shows an inline notice when the selected TMDB film is
already logged, with shelf name, date, and a link to the entry
- Update CLAUDE.md and README to reflect current auth, OMDb, and
router/service structure
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'routers/films.py')
| -rw-r--r-- | routers/films.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/routers/films.py b/routers/films.py index 449fd44..56f50c5 100644 --- a/routers/films.py +++ b/routers/films.py @@ -335,6 +335,22 @@ def abandoned_feed( ) +@router.get("/films/find") +def find_films_by_tmdb_id(tmdb_id: int, db: Session = Depends(get_db)): + films = db.query(Film).filter(Film.tmdb_id == tmdb_id).all() + return { + "matches": [ + { + "id": f.id, + "shelf": f.shelf, + "title": f.title, + "date_watched": f.date_watched.isoformat() if f.date_watched else None, + } + for f in films + ] + } + + @router.get("/films/check-rewatch") def check_rewatch(tmdb_id: int, db: Session = Depends(get_db)): count = db.query(Film).filter(Film.tmdb_id == tmdb_id, Film.shelf == "diary").count() |
