Backend:
- Enhance PeopleController with person credits and TMDB filmography endpoints; - update episodeService to filter entries by showInCalendar; - add fetchPersonCombinedCredits function in tmdbService
This commit is contained in:
1 parent
ffe7e52527
commit
11eab03987
5 files changed
+36
-7
No files matched your search
@@ -30,7 +30,7 @@ class EpisodeService {
|
||||
const formatedStartDate = moment(startDate).format('YYYY-MM-DD');
|
||||
const formatedEndDate = moment(endDate).format('YYYY-MM-DD');
|
||||
|
||||
// fetch episodes that aired within the current month
|
||||
// fetch episodes that aired within the current month, only from entries with showInCalendar enabled
|
||||
const episodes = await Episode.findAll({
|
||||
where: {
|
||||
air_date: {
|
||||
@@ -44,6 +44,7 @@ class EpisodeService {
|
||||
include: {
|
||||
model: Entry,
|
||||
as: 'entry',
|
||||
where: { showInCalendar: true },
|
||||
include: [
|
||||
{ model: EntryId, as: 'entryId' },
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@ const People = require("../models/People");
|
||||
const Credit = require("../models/Credit");
|
||||
const Entry = require("../models/Entry");
|
||||
const Media = require("../models/Media");
|
||||
const { fetchPersonData } = require("./tmdbService");
|
||||
const { fetchPersonDetails: fetchPersonData } = require("./tmdbService");
|
||||
const mediaDownloaderService = require("./mediaDownloaderService");
|
||||
const { logToFile } = require("./logService");
|
||||
const BadRequestError = require("../errors/BadRequestError");
|
||||
|
||||
@@ -209,6 +209,18 @@ async function fetchPopularPeople(page = 1) {
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchPersonCombinedCredits(tmdb_id) {
|
||||
try {
|
||||
const url = `${TMDB_APIURL}person/${tmdb_id}/combined_credits?api_key=${TMDB_APIKEY}&language=en-US`;
|
||||
logToFile(`Fetching Person Combined Credits From: ${url}`);
|
||||
const response = await axios.get(url);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.log('Error fetching person combined credits.', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
fetchEntryData,
|
||||
fetchSeasonData,
|
||||
@@ -216,6 +228,7 @@ module.exports = {
|
||||
fetchCollectionData,
|
||||
fetchEntryCredits,
|
||||
fetchPersonDetails,
|
||||
fetchPersonCombinedCredits,
|
||||
fetchTrending,
|
||||
fetchPopular,
|
||||
searchMulti,
|
||||
|
||||
Reference in new issue
Block a user