Refactor tmdbImageUrl to accept semantic category instead of size string

- Change primary argument from TMDB size string (`w500`, `w1280`, etc.)
  to category name (`posters`, `backdrops`, `stills`, `logos`,
  `profiles`); optional size override remains as third argument
- Update all call sites across services, actions, pages, and route
  handlers to use the new category-based API
- Update image.test.ts to match the new signature and replace
  size-mapping test descriptions with category-name descriptions
This commit is contained in:
2026-03-08 12:33:07 -04:00
parent a7b3600d15
commit ad8ec62317
14 changed files with 77 additions and 68 deletions
+3 -3
View File
@@ -55,7 +55,7 @@ export async function GET(req: NextRequest) {
tmdbId: r.id,
type: "person" as const,
title: r.name,
profilePath: tmdbImageUrl(r.profile_path, "w185"),
profilePath: tmdbImageUrl(r.profile_path, "profiles"),
knownForDepartment: r.known_for_department,
knownFor: r.known_for
?.slice(0, 3)
@@ -83,7 +83,7 @@ export async function GET(req: NextRequest) {
type: "person" as const,
title: r.name ?? "Unknown",
posterPath: null,
profilePath: tmdbImageUrl(r.profile_path ?? null, "w185"),
profilePath: tmdbImageUrl(r.profile_path ?? null, "profiles"),
overview: "",
releaseDate: null,
popularity: r.popularity,
@@ -103,7 +103,7 @@ export async function GET(req: NextRequest) {
title: r.title ?? r.name,
overview: r.overview,
releaseDate: r.release_date ?? r.first_air_date,
posterPath: tmdbImageUrl(r.poster_path, "w500"),
posterPath: tmdbImageUrl(r.poster_path, "posters"),
popularity: r.popularity,
voteAverage: r.vote_average,
};