Let users upload videos, tag them with one or more entries, and watch them from a new Discovery Videos page. Backend: - Add Video and VideoEntry models and relations - Add video controller and /video routes - Add video thumbnail generation service (ffmpeg-static) - Add video upload storage location and config Frontend: - Add DiscoveryVideosPage with sidebar link and route - Add AddVideoDialog, VideoDropzone, EntryMultiSelect, VideoCard and VideoPlayerDialog components - Add discoveryVideos API client and useDiscoveryVideos hook - Add format helpers, video types and normalizers - Add skeleton for the page Docs: - Document the feature in docs-vault
4.7 KiB
title, tags
| title | tags | |||
|---|---|---|---|---|
| Hooks |
|
Hooks
Custom hooks in react_frontend/src/hooks/. All query hooks wrap TanStack Query. All mutation hooks invalidate relevant caches and update Stores when applicable.
useEntries
[!info] File:
hooks/useEntries.ts
The main library hooks. Mutations update Stores optimistically.
| Hook | Type | Description |
|---|---|---|
useLibrary() |
Query | Fetch all entries → loads into Zustand store. Runs once on mount. |
useEntry(id) |
Query | Single entry by ID (triggers lazy refresh on backend) |
useEntrySeasons(id) |
Query | Seasons for an entry |
useCreateEntry() |
Mutation | POST /entries → adds to Zustand store |
useUpdateEntry() |
Mutation | PUT /entries/:id → updates Zustand store |
useDeleteEntry() |
Mutation | DELETE /entries/:id → removes from Zustand store |
useRefreshEntry() |
Mutation | PUT /entries/:id/refresh |
useUpdateEntryRatings() |
Mutation | PUT /entries/:id/ratings |
useUploadMedia() |
Mutation | POST /entries/:id/media |
useCollections
[!info] File:
hooks/useCollections.ts
| Hook | Type | Description |
|---|---|---|
useCollections() |
Query | All collections |
useCollection(id) |
Query | Single collection with entries |
useCreateCollection() |
Mutation | Create user collection |
useUpdateCollection() |
Mutation | Update collection (with media) |
useDeleteCollection() |
Mutation | Delete collection |
useAddEntryToCollection() |
Mutation | Add entry to collection |
useRemoveEntryFromCollection() |
Mutation | Remove entry from collection |
useSeasons
[!info] File:
hooks/useSeasons.ts
| Hook | Type | Description |
|---|---|---|
useSeason(id) |
Query | Season by ID (includes episodes) |
useSeasonEpisodes(id) |
Query | Episodes for a season |
useEntrySeen
[!info] File:
hooks/useEntrySeen.ts
See Watch Tracking.
| Hook | Type | Description |
|---|---|---|
useEntrySeenByEntry(entryId) |
Query | Watch records for an entry |
useCreateEntrySeen() |
Mutation | Create watch record |
useUpdateEntrySeen() |
Mutation | Update watch record |
useDeleteEntrySeen() |
Mutation | Delete watch record |
useEpisodeSeen
[!info] File:
hooks/useEpisodeSeen.ts
See Watch Tracking.
| Hook | Type | Description |
|---|---|---|
useEpisodeSeenByEpisode(episodeId) |
Query | Watch records for an episode |
useCreateEpisodeSeen() |
Mutation | Create episode watch record |
useUpdateEpisodeSeen() |
Mutation | Update episode watch record |
useDeleteEpisodeSeen() |
Mutation | Delete episode watch record |
usePeople
[!info] File:
hooks/usePeople.ts
| Hook | Type | Description |
|---|---|---|
usePerson(id) |
Query | Person by ID (lazy-fetch from TMDB) |
usePersonCredits(id) |
Query | Person's credits |
usePopularPeople(limit) |
Query | Popular people (local) |
useSearchPeople(query) |
Query | Search people (local) |
useTmdb
[!info] File:
hooks/useTmdb.ts
Infinite queries for TMDB browse/search pages. All return paginated results.
| Hook | Type | Description |
|---|---|---|
useTmdbTrending(type) |
Infinite Query | Trending movies/tv |
useTmdbPopular(type) |
Infinite Query | Popular movies/tv |
useTmdbTopRated(type) |
Infinite Query | Top-rated movies/tv |
useTmdbUpcoming() |
Infinite Query | Upcoming movies |
useTmdbSearch(query) |
Infinite Query | Multi-search |
useTmdbPopularPeople() |
Infinite Query | Popular people |
useTmdbSearchPeople(query) |
Infinite Query | People search |
useStatistics
[!info] File:
hooks/useStatistics.ts
See Statistics.
| Hook | Type | Description |
|---|---|---|
useAllTimeWatchTime() |
Query | Total watch time (all time) |
useYearlyWatchTime(year) |
Query | Watch time by month |
useYearlyWatchCount(year) |
Query | Watch count by month |
useWatchdayDistribution() |
Query | Day-of-week distribution |
useEpisodes
[!info] File:
hooks/useEpisodes.ts
| Hook | Type | Description |
|---|---|---|
useEpisodesByMonth(start, end) |
Query | Episodes airing in date range (for Calendar) |
useDiscoveryVideos
[!info] File:
hooks/useDiscoveryVideos.ts
See Discovery Videos.
| Hook | Type | Description |
|---|---|---|
useDiscoveryVideos() |
Infinite Query | Paginated video list (24/page) |
useUploadVideos() |
Mutation | POST /discovery-videos (multipart, upload progress) |
useUpdateVideo() |
Mutation | PUT /discovery-videos/:id |
useDeleteVideo() |
Mutation | DELETE /discovery-videos/:id |
useDebounce
[!info] File:
hooks/useDebounce.ts
Utility hook: useDebounce(value, delay) — returns debounced value. Used by search inputs.