Normalize to double quotes across all files with Prettier
This commit is contained in:
1 parent
73bff72cec
commit
a5659cf4c8
190 files changed
+9523
-8859
No files matched your search
@@ -1,6 +1,6 @@
|
||||
const peopleService = require("../services/peopleService");
|
||||
const peopleManager = require("../services/peopleManager");
|
||||
const tmdbService = require('../services/tmdbService');
|
||||
const tmdbService = require("../services/tmdbService");
|
||||
|
||||
const _peopleService = peopleService;
|
||||
const _peopleManager = peopleManager;
|
||||
@@ -60,7 +60,9 @@ class PeopleController {
|
||||
|
||||
async fetchAndSavePersonByTmdbId(req, res) {
|
||||
const { tmdb_id, pinned } = req.body;
|
||||
const person = await _peopleService.fetchAndSavePersonByTmdbId(tmdb_id, { pinned: !!pinned });
|
||||
const person = await _peopleService.fetchAndSavePersonByTmdbId(tmdb_id, {
|
||||
pinned: !!pinned,
|
||||
});
|
||||
res.status(201).json(person);
|
||||
}
|
||||
|
||||
@@ -73,7 +75,7 @@ class PeopleController {
|
||||
async getPersonCredits(req, res) {
|
||||
const { id } = req.params;
|
||||
const person = await _peopleService.getPersonById(id);
|
||||
if (!person) return res.status(404).json({ message: 'Person not found' });
|
||||
if (!person) return res.status(404).json({ message: "Person not found" });
|
||||
res.status(200).json(person.roles ?? []);
|
||||
}
|
||||
|
||||
@@ -81,10 +83,15 @@ class PeopleController {
|
||||
const { id } = req.params;
|
||||
const person = await _peopleService.getPersonById(id);
|
||||
if (!person || !person.tmdb_id) {
|
||||
return res.status(404).json({ message: 'Person not found or missing TMDB ID' });
|
||||
return res
|
||||
.status(404)
|
||||
.json({ message: "Person not found or missing TMDB ID" });
|
||||
}
|
||||
const data = await tmdbService.fetchPersonCombinedCredits(person.tmdb_id);
|
||||
if (!data) return res.status(500).json({ message: 'Failed to fetch filmography from TMDB' });
|
||||
if (!data)
|
||||
return res
|
||||
.status(500)
|
||||
.json({ message: "Failed to fetch filmography from TMDB" });
|
||||
res.status(200).json(data);
|
||||
}
|
||||
|
||||
@@ -93,7 +100,9 @@ class PeopleController {
|
||||
const person = await _peopleService.getPersonById(id);
|
||||
|
||||
if (person && person.tmdb_id) {
|
||||
const updatedPerson = await _peopleService.fetchAndSavePersonByTmdbId(person.tmdb_id);
|
||||
const updatedPerson = await _peopleService.fetchAndSavePersonByTmdbId(
|
||||
person.tmdb_id,
|
||||
);
|
||||
res.status(200).json(updatedPerson);
|
||||
} else {
|
||||
res.status(404).json({ message: "Person not found or missing TMDB ID" });
|
||||
@@ -103,31 +112,41 @@ class PeopleController {
|
||||
async getTmdbPopularPeople(req, res) {
|
||||
const { page } = req.query;
|
||||
const data = await tmdbService.fetchPopularPeople(page || 1);
|
||||
if (!data) return res.status(500).json({ message: 'Failed to fetch popular people' });
|
||||
if (!data)
|
||||
return res
|
||||
.status(500)
|
||||
.json({ message: "Failed to fetch popular people" });
|
||||
res.status(200).json(data);
|
||||
}
|
||||
|
||||
async searchTmdbPeople(req, res) {
|
||||
const { query, page } = req.query;
|
||||
if (!query) return res.status(400).json({ message: 'Query parameter is required' });
|
||||
if (!query)
|
||||
return res.status(400).json({ message: "Query parameter is required" });
|
||||
const data = await tmdbService.searchPeople(query, page || 1);
|
||||
if (!data) return res.status(500).json({ message: 'Failed to search TMDB people' });
|
||||
if (!data)
|
||||
return res.status(500).json({ message: "Failed to search TMDB people" });
|
||||
res.status(200).json(data);
|
||||
}
|
||||
|
||||
async getTmdbPersonPreview(req, res) {
|
||||
const { tmdbId } = req.params;
|
||||
const personData = await tmdbService.fetchPersonDetails(tmdbId);
|
||||
if (!personData) return res.status(404).json({ message: 'Person not found on TMDB' });
|
||||
if (!personData)
|
||||
return res.status(404).json({ message: "Person not found on TMDB" });
|
||||
|
||||
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));
|
||||
const localPerson = await _peopleService.getPersonByTmdbId(
|
||||
parseInt(tmdbId),
|
||||
);
|
||||
if (localPerson) localId = localPerson.id;
|
||||
} catch (_) { /* not found */ }
|
||||
} catch (_) {
|
||||
/* not found */
|
||||
}
|
||||
|
||||
const preview = {
|
||||
tmdb_id: personData.id,
|
||||
|
||||
Reference in new issue
Block a user