Replace tmdb-* URL routing with resolveTitle/resolvePerson server actions

- Add `resolveTitle` and `resolvePerson` server actions that import
  from TMDB and return the internal DB id
- Remove `tmdb-{id}-{type}` URL pattern and server-side redirect logic
  from TitleDetailPage and PersonDetailPage
- Rename `importTitle` → `getOrFetchTitleByTmdbId`; add `getOrFetchTitle`
  combining fetch + children lookup
- Update HeroBanner, TitleCard, and CommandPalette to call resolve
  actions client-side before pushing to router
- Batch availability offer inserts into a single transaction
This commit is contained in:
2026-03-07 14:27:03 -05:00
parent ccd482db4e
commit 8a45aa1c36
17 changed files with 552 additions and 419 deletions
+3 -3
View File
@@ -40,7 +40,7 @@ import {
userTitleStatus,
} from "@/lib/db/schema";
import { createLogger } from "@/lib/logger";
import { importTitle } from "@/lib/services/metadata";
import { getOrFetchTitleByTmdbId } from "@/lib/services/metadata";
import { setSetting } from "@/lib/services/settings";
const log = createLogger("seed");
@@ -164,7 +164,7 @@ async function seedForUser(userId: string) {
for (const movie of MOVIES) {
try {
log.info(` Importing movie: ${movie.name} (TMDB ${movie.tmdbId})`);
const title = await importTitle(movie.tmdbId, "movie");
const title = await getOrFetchTitleByTmdbId(movie.tmdbId, "movie");
if (title) {
movieTitles.push({
id: title.id,
@@ -184,7 +184,7 @@ async function seedForUser(userId: string) {
for (const show of TV_SHOWS) {
try {
log.info(` Importing TV show: ${show.name} (TMDB ${show.tmdbId})`);
const title = await importTitle(show.tmdbId, "tv");
const title = await getOrFetchTitleByTmdbId(show.tmdbId, "tv");
if (title) {
tvTitles.push({ id: title.id, tmdbId: show.tmdbId, name: show.name });
}