Front/Back: add tv-series auto sync when vising the calendar

This commit is contained in:
X4Lo committed 2024-10-21 15:59:04 +01:00
1 parent 9530b52830
commit 7160669468
2 files changed
+34 -16

No files matched your search

@@ -8,26 +8,30 @@ const Media = require("../../models/Media");
async function getEpisodesBetweenDates(startDate, endDate) {
// Get the first and last day of the month based on the provided date
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
const episodes = await Episode.findAll({
where: {
air_date: {
[Op.between]: [formatedStartDate, formatedEndDate]
}
},
},
include: [
{
model: Season,
as: 'season',
include: {
model: Entry, as: 'entry', include: [
model: Entry,
as: 'entry',
include: [
{ model: EntryId, as: 'entryId' },
{ model: Media, as: 'medias' },
]
{
model: Media,
as: 'medias',
},
],
}
}
]