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);
|
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 = {
|
const preview = {
|
||||||
tmdb_id: personData.id,
|
tmdb_id: personData.id,
|
||||||
|
local_id: localId,
|
||||||
name: personData.name,
|
name: personData.name,
|
||||||
biography: personData.biography || null,
|
biography: personData.biography || null,
|
||||||
birthday: personData.birthday || null,
|
birthday: personData.birthday || null,
|
||||||
|
|||||||
@@ -64,5 +64,4 @@ aliases:
|
|||||||
|
|
||||||
## Project Management
|
## Project Management
|
||||||
|
|
||||||
- [[Changelog]] — Milestone history
|
|
||||||
- [[Known Issues]] — Tracked bugs and technical debt
|
- [[Known Issues]] — Tracked bugs and technical debt
|
||||||
Reference in new issue
Block a user