add: update modal for entry seen

This commit is contained in:
X4Lo committed 2024-05-19 06:55:47 +01:00
1 parent d6c3a974a1
commit bffc1227c3
8 files changed
+208 -81

No files matched your search

+7 -2
View File
@@ -65,13 +65,15 @@ entryRouter.get('/:id', async (req, res) => {
attributes: [] // Do not fetch any attributes from the join table
}
}
],
order: [
[{ model: EntrySeen, as: 'entrySeen' }, 'date_seen', 'DESC'] // Order the entry-seen list
]
});
if (!entry) { // ! entry not found
res.status(404).json({ message: 'Entry not found' });
}
const entryData = entry.get({ plain: true });
const genres = entryData.genres.map(genre => genre.name);
@@ -172,7 +174,10 @@ entryRouter.put('/:id', async (req, res) => {
if (oldEntry.is_tvseries) includes.push({ model: Season, as: 'seasons' });
const updatedEntry = await Entry.findByPk(id, {
include: includes
include: includes,
order: [
[{ model: EntrySeen, as: 'entrySeen' }, 'date_seen', 'DESC'] // Order the entry-seen list
]
});
const entryData = updatedEntry.get({ plain: true });