feat: Show last updated movies per year

Add API and UI to display the last updated movies for the active year.

Co-authored-by: mathieumoran1 <[email protected]>
This commit is contained in:
Cursor Agent
2025-12-20 23:01:24 +00:00
co-authored by mathieumoran1
parent 03a4b4e5dc
commit 6cb503fe35
2 changed files with 31 additions and 1 deletions
+4 -1
View File
@@ -73,7 +73,10 @@ router.get("/last-update", async (req, res) => {
try {
jwt.verify(token, process.env.JWT_SECRET);
const latestMovie = await Movie.findOne().sort({ updatedAt: -1, createdAt: -1, _id: -1 });
const year = parseOscarYear(req.query.year);
const filter = year ? { year } : {};
const latestMovie = await Movie.findOne(filter).sort({ updatedAt: -1, createdAt: -1, _id: -1 });
if (!latestMovie) {
return res.status(200).json({ lastUpdated: null });
}