mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-07-14 18:15:56 -04:00
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:
+3
-3
@@ -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 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user