Support optional page, limit, and search query params.
Returns { data, total, page, totalPages } when paginated,
plain array for backward compatibility.
Co-authored-by: Copilot <copilot@github.com>
83 lines
2.6 KiB
Markdown
83 lines
2.6 KiB
Markdown
---
|
|
title: People
|
|
tags:
|
|
- feature
|
|
- people
|
|
- cast
|
|
- crew
|
|
---
|
|
|
|
# People
|
|
|
|
## Overview
|
|
|
|
Showy tracks actors, directors, and other crew members. People are linked to entries via [[Models#Credit|Credit]] records.
|
|
|
|
## Lazy-Fetch Pattern
|
|
|
|
People profiles are **lazily fetched** from TMDB:
|
|
|
|
1. When credits are fetched for an entry, basic `People` records are created with `fully_fetched = false`
|
|
2. When a user views a person's detail page, `GET /people/:id` triggers [[Services#PeopleManager|PeopleManager.getUpdatedPerson]]
|
|
3. If `fully_fetched = false`, full profile is fetched from TMDB:
|
|
- Biography, birthday, place of birth, etc.
|
|
- Profile picture downloaded and previewed
|
|
- `fully_fetched` set to `true`
|
|
4. Subsequent views skip the TMDB call
|
|
|
|
## Data Model
|
|
|
|
See [[Models#People]] and [[Models#Credit]].
|
|
|
|
### Credit Types
|
|
|
|
| `cast_type` | Fields Used |
|
|
|---|---|
|
|
| `cast` | `character`, `order`, `episode_count` |
|
|
| `crew` | `department`, `job`, `episode_count` |
|
|
|
|
> [!info] Multiple Roles
|
|
> For TV series (using TMDB `aggregate_credits`), a person may have multiple roles or jobs. These are stored joined by `"; "` in the `character` (cast) or `job` (crew) fields. The `episode_count` field tracks total episodes across all roles/jobs.
|
|
|
|
## Pages
|
|
|
|
- [[Pages#PeoplePage|PeoplePage]] — Browse and search people (server-side paginated, 48 per page)
|
|
- [[Pages#PersonDetailsPage|PersonDetailsPage]] — Unified person page handling both local DB IDs (`/people/:id`) and TMDB IDs (`/people/tmdb/:tmdbId`)
|
|
|
|
### PersonDetailsPage Modes
|
|
|
|
| Route | Mode | Data Source | Actions |
|
|
|---|---|---|---|
|
|
| `/people/:id` | Local DB | `GET /people/:id` + TMDB filmography | Favorite toggle |
|
|
| `/people/tmdb/:tmdbId` | TMDB Preview | `GET /people/tmdb/preview/:tmdbId` | Add to Library (saves with `pinned: true`) |
|
|
|
|
Both modes share the same `PersonMeta` component (shows department, birthday, place of birth, TMDB external link) and `FilmographySection` (splits credits into "In Library" / "Not in Library" with pagination).
|
|
|
|
## API Endpoints
|
|
|
|
### Pagination
|
|
|
|
`GET /people` now supports optional query params:
|
|
- `page` (number) — Page number (1-based)
|
|
- `limit` (number) — Items per page
|
|
- `search` (string) — Filter by name (LIKE match)
|
|
|
|
When `page` and `limit` are provided, returns `{ data, total, page, totalPages }`. Without them, returns a plain array for backward compatibility.
|
|
|
|
See [[API Reference#People]].
|
|
|
|
## Hooks
|
|
|
|
See [[Hooks#usePeople]].
|
|
|
|
## TMDB Data
|
|
|
|
People data from TMDB includes:
|
|
|
|
- Full biography
|
|
- Birth/death dates and location
|
|
- Profile images
|
|
- Combined credits (all movies + TV shows)
|
|
|
|
See [[TMDB Integration]] for API details.
|