diff options
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() |
