fix(backend): check local DB before returning TMDB person preview
- Return local_id in GET /people/tmdb/preview/:tmdbId if person exists in DB - Prevents duplicate "Add to Library" prompts for already-saved people
This commit is contained in:
1 parent
db6da6782f
commit
507cdbcff7
2 files changed
+8
-1
No files matched your search
@@ -122,8 +122,16 @@ class PeopleController {
|
||||
|
||||
const filmography = await tmdbService.fetchPersonCombinedCredits(tmdbId);
|
||||
|
||||
// Check if person already exists in local DB
|
||||
let localId = null;
|
||||
try {
|
||||
const localPerson = await _peopleService.getPersonByTmdbId(parseInt(tmdbId));
|
||||
if (localPerson) localId = localPerson.id;
|
||||
} catch (_) { /* not found */ }
|
||||
|
||||
const preview = {
|
||||
tmdb_id: personData.id,
|
||||
local_id: localId,
|
||||
name: personData.name,
|
||||
biography: personData.biography || null,
|
||||
birthday: personData.birthday || null,
|
||||
|
||||
Reference in new issue
Block a user