feat: refactor platforms to support multiple TMDB provider IDs per platform

- Replace `tmdbProviderId` (single int) with a many-to-many `platformTmdbProviders` join table so one platform entry can map to multiple TMDB provider IDs (e.g. a single "Max" platform covers several regional TMDB IDs)
- Add `isSubscription` flag to platforms to distinguish subscription services from transactional ones, replacing the old `displayOrder` field in API responses
- Add `getPlatformTmdbIds` / `getPlatformTmdbIdMap` helpers in `@sofa/core/platforms` and thread them through discover, explore, and platform list procedures
- Replace `providerId: number` with `platformId: string` (UUID) in discover input schema so the client never needs to resolve TMDB IDs
- Add `scripts/sync-tmdb-providers.ts` script to pull live provider data from TMDB and update `platforms.json`
- Split native title detail availability into separate "Stream" and "Buy or Rent" sections matching the web pattern
- Add two new DB migrations for the join table and platform schema changes
This commit is contained in:
2026-03-24 20:54:34 -04:00
parent 7fedccb4fd
commit b0172a2b25
58 changed files with 8291 additions and 907 deletions
+9 -4
View File
@@ -32,8 +32,8 @@
"@vitest/browser-playwright": "4.1.1",
"@vitest/coverage-v8": "4.1.1",
"better-auth": "1.5.6",
"drizzle-kit": "1.0.0-beta.18-7eb39f0",
"drizzle-orm": "1.0.0-beta.18-7eb39f0",
"drizzle-kit": "1.0.0-beta.19",
"drizzle-orm": "1.0.0-beta.19",
"react": "19.2.0",
"react-dom": "19.2.0",
"tailwind-merge": "3.5.0",
@@ -58,7 +58,8 @@
"clean": "rm -rf .turbo \"apps/*/.turbo\" \"apps/*/node_modules\" \"apps/*/*.tsbuildinfo\" \"apps/*/dist\" \"packages/*/.turbo\" \"packages/*/node_modules\" \"packages/*/*.tsbuildinfo\" node_modules bun.lock",
"generate:openapi": "bun scripts/generate-openapi-spec.ts && cd docs && bun run generate:api-docs",
"i18n:extract": "lingui extract",
"i18n:claude": "bun packages/i18n/scripts/claude.ts"
"i18n:claude": "bun packages/i18n/scripts/claude.ts",
"sync:providers": "bun scripts/sync-tmdb-providers.ts"
},
"devDependencies": {
"@e18e/eslint-plugin": "0.3.0",
@@ -82,6 +83,10 @@
},
"packageManager": "bun@1.3.11",
"trustedDependencies": [
"@sentry/cli"
"@sentry/cli",
"better-sqlite3",
"esbuild",
"msw",
"sharp"
]
}