Updated API docs

This commit is contained in:
X4Lo committed 2026-06-25 03:11:32 +01:00
1 parent e82b905886
commit 3df2e2ce3e
2 files changed
+141 -15

No files matched your search

+63 -6
View File
@@ -14,6 +14,31 @@ Base Axios instance in `lib/api.ts` — configured with base URL and interceptor
---
## auth.ts
Authentication.
| Method | HTTP | Endpoint |
|---|---|---|
| `login(password, remember)` | POST | `/auth/login` |
| `verify(token)` | GET | `/auth/verify` |
---
## watchBuddy.ts
Watch buddy management.
| Method | HTTP | Endpoint |
|---|---|---|
| `search(q?)` | GET | `/watch-buddies/search` |
| `create(data)` | POST | `/watch-buddies` |
| `update(id, data)` | PUT | `/watch-buddies/:id` |
| `remove(id)` | DELETE | `/watch-buddies/:id` |
| `migrateSeenWith()` | POST | `/watch-buddies/migrate-seen-with` |
---
## entries.ts
Entry CRUD and management.
@@ -35,6 +60,7 @@ Entry CRUD and management.
| `uploadMedia(id, formData)` | POST | `/entries/:id/media` |
| `setMediaSelected(entryId, mediaId)` | PUT | `/entries/:entryId/media/:mediaId` |
| `deleteMedia(entryId, mediaId)` | DELETE | `/entries/:entryId/media/:mediaId` |
| `previewTmdb(tmdbId, type)` | GET | `/entries/tmdb/preview/:type/:tmdbId` |
## tmdb.ts
@@ -50,11 +76,15 @@ TMDB proxy endpoints (via backend).
| `getTopRatedTv(page)` | GET | `/entries/tmdb/top-rated/tv` |
| `getUpcomingMovies(page)` | GET | `/entries/tmdb/upcoming/movie` |
| `search(query, page)` | GET | `/entries/tmdb/search` |
| `getPopularPeople()` | GET | `/people/tmdb/popular` |
| `searchPeople(query)` | GET | `/people/tmdb/search` |
| `getPopularPeople(page)` | GET | `/people/tmdb/popular` |
| `searchPeople(query, page)` | GET | `/people/tmdb/search` |
---
## collections.ts
Collection CRUD and entry management.
| Method | HTTP | Endpoint |
|---|---|---|
| `getAll()` | GET | `/collections` |
@@ -64,8 +94,8 @@ TMDB proxy endpoints (via backend).
| `updateWithMedia(id, formData)` | PUT | `/collections/:id` (multipart) |
| `delete(id)` | DELETE | `/collections/:id` |
| `getCollectionParts(id)` | PUT | `/collections/:id/parts` |
| `addEntry(collectionId, entryId)` | POST | `/collections/:id/entries/:entryId` |
| `removeEntry(collectionId, entryId)` | DELETE | `/collections/:id/entries/:entryId` |
| `addEntry(collectionId, entryId)` | POST | `/collections/:collectionId/entries/:entryId` |
| `removeEntry(collectionId, entryId)` | DELETE | `/collections/:collectionId/entries/:entryId` |
## seasons.ts
@@ -86,6 +116,8 @@ TMDB proxy endpoints (via backend).
## entry-seen.ts
Movie watch records.
| Method | HTTP | Endpoint |
|---|---|---|
| `getAll()` | GET | `/entry-seen` |
@@ -97,24 +129,33 @@ TMDB proxy endpoints (via backend).
## episode-seen.ts
Episode watch records.
| Method | HTTP | Endpoint |
|---|---|---|
| `getAll()` | GET | `/episode-seen` |
| `getById(id)` | GET | `/episode-seen/:id` |
| `getByEpisode(episodeId)` | GET | `/episode-seen/by-episode/:episodeId` |
| `getByEntry(entryId)` | GET | `/episode-seen/by-entry/:entryId` |
| `create(data)` | POST | `/episode-seen` |
| `update(id, data)` | PUT | `/episode-seen/:id` |
| `delete(id)` | DELETE | `/episode-seen/:id` |
## people.ts
People CRUD and TMDB integration.
| Method | HTTP | Endpoint |
|---|---|---|
| `getAll()` | GET | `/people` |
| `getAllPaginated(page, limit, search?)` | GET | `/people` |
| `getById(id)` | GET | `/people/:id` |
| `getCredits(id)` | GET | `/people/:id/credits` |
| `getTmdbFilmography(id)` | GET | `/people/:id/tmdb-filmography` |
| `fetchByTmdbId(tmdbId)` | POST | `/people/fetch` |
| `previewTmdb(tmdbId)` | GET | `/people/tmdb/preview/:tmdbId` |
| `fetchByTmdbId(tmdbId, pinned?)` | POST | `/people/fetch` |
| `update(id, data)` | PUT | `/people/:id` |
| `search(query)` | GET | `/people/search` |
## statistics.ts
@@ -134,11 +175,27 @@ TMDB proxy endpoints (via backend).
## maintenance.ts
Maintenance and cleanup utilities.
| Method | HTTP | Endpoint |
|---|---|---|
| `scanOrphanFiles()` | GET | `/maintenance/orphan-files` |
| `deleteOrphanFiles()` | DELETE | `/maintenance/orphan-files` |
| `scanOrphanMediaRecords()` | GET | `/maintenance/orphan-media-records` |
| `deleteOrphanMediaRecords()` | DELETE | `/maintenance/orphan-media-records` |
| `scanOrphanPeople()` | GET | `/maintenance/orphan-people` |
| `deleteOrphanPeople()` | DELETE | `/maintenance/orphan-people` |
| `scanMissingDirectors()` | GET | `/maintenance/missing-directors` |
| `fixMissingDirectors()` | POST | `/maintenance/missing-directors` |
| `scanDuplicateCredits()` | GET | `/maintenance/duplicate-credits` |
| `cleanDuplicateCredits()` | DELETE | `/maintenance/duplicate-credits` |
| `autoFixWatchStatuses()` | POST | `/maintenance/auto-fix-watch-statuses` |
| `migrateSeenWith()` | POST | `/watch-buddies/migrate-seen-with` |
Response type: `{ posters: number, logos: number, backdrops: number, stills: number }`
Response types:
- **Orphan files/media:** `{ posters: number, logos: number, backdrops: number, stills: number }`
- **Orphan people:** `{ count: number }`
- **Missing directors:** `{ count: number, fixed: number }`
- **Duplicate credits:** `{ groups: number, duplicates: number, deleted: number }`
- **Auto-fix watch statuses:** `{ completed: number, watching: number, planToWatch: number }`
- **Migrate seen-with:** `{ created: number, linked: number, processed: number }`
+78 -9
View File
@@ -13,6 +13,34 @@ aliases:
All endpoints are prefixed with `/api/v1`. See [[Backend]] for server setup.
> [!note] The `/killer` endpoint is mounted at the root (outside `/api/v1`). `/auth/*` and `/media/*` paths bypass JWT auth.
---
## Auth
> [!info] File: `routes/auth.routes.js` → `controllers/authController.js`
| Method | Path | Description |
|---|---|---|
| `POST` | `/auth/login` | Login with password → returns `{ token, expiresIn }` |
| `GET` | `/auth/verify` | Verify JWT token (Bearer auth header) → `{ valid: boolean }` |
---
## Watch Buddies
> [!info] File: `routes/watch-buddy.routes.js` → `controllers/watchBuddyController.js`
| Method | Path | Description |
|---|---|---|
| `GET` | `/watch-buddies/search?q=` | Search watch buddies by name |
| `GET` | `/watch-buddies/:id` | Get watch buddy by ID |
| `POST` | `/watch-buddies` | Create watch buddy |
| `PUT` | `/watch-buddies/:id` | Update watch buddy |
| `DELETE` | `/watch-buddies/:id` | Delete watch buddy |
| `POST` | `/watch-buddies/migrate-seen-with` | Migrate `seen_with` string field to watch buddy references |
---
## Entries
@@ -35,6 +63,7 @@ All endpoints are prefixed with `/api/v1`. See [[Backend]] for server setup.
| `GET` | `/entries/sync-series` | Batch refresh all non-ended TV series |
| `POST` | `/entries/:id/media` | Upload media (multipart — poster/backdrop/logo) |
| `PUT` | `/entries/:entryId/media/:mediaId` | Set media as selected |
| `DELETE` | `/entries/:entryId/media/:mediaId` | Delete entry media (auto-selects next available media of same type if deleted media was selected) |
### TMDB Proxy
@@ -45,6 +74,7 @@ All endpoints are prefixed with `/api/v1`. See [[Backend]] for server setup.
| `GET` | `/entries/tmdb/top-rated/:type` | Top-rated movies/tv |
| `GET` | `/entries/tmdb/upcoming/movie` | Upcoming movies |
| `GET` | `/entries/tmdb/search?query=&page=` | Multi-search |
| `GET` | `/entries/tmdb/preview/:type/:tmdbId` | Preview TMDB entry (movie/tv) before adding — returns local + TMDB data |
---
@@ -77,10 +107,10 @@ See [[Watch Tracking]] for the accuracy system.
| Method | Path | Description |
|---|---|---|
| `GET` | `/entry-seen` | All entry seens |
| `GET` | `/entry-seen/by-entry/:entryId` | Watch records for an entry |
| `GET` | `/entry-seen/by-entry/:entryId` | Watch records for an entry (includes `buddies` association) |
| `GET` | `/entry-seen/:id` | Single record by ID |
| `POST` | `/entry-seen` | Create: `{ entry_id, date_seen, seen_with, accuracy }` |
| `PUT` | `/entry-seen/:id` | Update record |
| `POST` | `/entry-seen` | Create: `{ entry_id, date_seen, seen_with, accuracy, buddy_ids? }` — `buddy_ids` links watch buddies |
| `PUT` | `/entry-seen/:id` | Update record — accepts `{ date_seen, seen_with, buddy_ids? }` |
| `DELETE` | `/entry-seen/:id` | Delete record |
---
@@ -92,11 +122,11 @@ See [[Watch Tracking]] for the accuracy system.
| Method | Path | Description |
|---|---|---|
| `GET` | `/episode-seen` | All episode seens |
| `GET` | `/episode-seen/by-episode/:episodeId` | Watch records for an episode |
| `GET` | `/episode-seen/by-entry/:entryId` | All episode seens for an entry |
| `GET` | `/episode-seen/by-episode/:episodeId` | Watch records for an episode (includes `buddies` association) |
| `GET` | `/episode-seen/by-entry/:entryId` | All episode seens for an entry (includes `buddies` + episode/season info) |
| `GET` | `/episode-seen/:id` | Single record by ID |
| `POST` | `/episode-seen` | Create: `{ entry_id, episode_id, date_seen, seen_with, accuracy }` |
| `PUT` | `/episode-seen/:id` | Update record |
| `POST` | `/episode-seen` | Create: `{ entry_id, episode_id, date_seen, seen_with, accuracy, buddy_ids? }` |
| `PUT` | `/episode-seen/:id` | Update record — accepts `{ date_seen, seen_with, episode_id?, buddy_ids? }` |
| `DELETE` | `/episode-seen/:id` | Delete record |
---
@@ -137,7 +167,7 @@ See [[Media System]] for details.
| `GET` | `/media` | All custom media records |
| `GET` | `/media/:category/:type/:size/:fileName` | Serve media file |
**URL pattern:** `/media/{entries|collections|seasons|episodes|peoples}/{posters|backdrops|logos|stills|profiles}/{preview|full}/{filename}`
**URL pattern:** `/media/{entries|collections|seasons|episodes|peoples|watch-buddies}/{posters|backdrops|logos|stills|profiles}/{preview|full}/{filename}`
---
@@ -163,6 +193,7 @@ See [[People]] for the lazy-fetch pattern.
| `POST` | `/people/:id/media` | Upload profile picture |
| `GET` | `/people/tmdb/popular` | TMDB popular people |
| `GET` | `/people/tmdb/search?query=` | TMDB people search |
| `GET` | `/people/tmdb/preview/:tmdbId` | Preview TMDB person before adding — returns local + TMDB data with filmography |
---
@@ -198,6 +229,8 @@ See [[Statistics]] for chart details.
See [[Settings Page#Cleanup]] for the UI.
### Orphan Files & Media Records
| Method | Path | Description |
|---|---|---|
| `GET` | `/maintenance/orphan-files` | Dry scan — files on disk without DB records |
@@ -207,6 +240,41 @@ See [[Settings Page#Cleanup]] for the UI.
**Response:** `{ posters: number, logos: number, backdrops: number, stills: number }`
### Orphan People
| Method | Path | Description |
|---|---|---|
| `GET` | `/maintenance/orphan-people` | Dry scan — people without any credits |
| `DELETE` | `/maintenance/orphan-people` | Delete orphan people |
**Response:** `{ count: number }`
### Missing Directors
| Method | Path | Description |
|---|---|---|
| `GET` | `/maintenance/missing-directors` | Scan for entries missing director credits |
| `POST` | `/maintenance/missing-directors` | Fix — fetch missing directors from TMDB |
**Response:** `{ count: number, fixed: number }`
### Duplicate Credits
| Method | Path | Description |
|---|---|---|
| `GET` | `/maintenance/duplicate-credits` | Scan for duplicate (person, entry, role) credits |
| `DELETE` | `/maintenance/duplicate-credits` | Clean duplicate credits (keeps one per group) |
**Response:** `{ groups: number, duplicates: number, deleted: number }`
### Watch Status Auto-Fix
| Method | Path | Description |
|---|---|---|
| `POST` | `/maintenance/auto-fix-watch-statuses` | Auto-correct entry watch statuses based on watched episodes (e.g., mark series as completed/watching/plan-to-watch) |
**Response:** `{ completed: number, watching: number, planToWatch: number }`
---
## Import
@@ -228,4 +296,5 @@ See [[Import System]] for details.
| Method | Path | Description |
|---|---|---|
| `GET` | `/ping` | Health check → `{ message: 'pong' }` |
| `GET/POST` | `/killer` | Debug: crash backend (outside `/api/v1`) |
| `GET` | `/killer` | Debug: crash backend (outside `/api/v1`) |
| `POST` | `/killer` | Debug: crash backend (outside `/api/v1`) |