fix(routes/events): replace deprecated User.update with instance save in RSVP/cancel flows to persist user event participation reliably\n\nEnsures user.events and stats are persisted by calling user.save() instead of non-existent User.update. Also keeps participants response consistent.\n\n🤖 Generated with [AI Assistant]\n\nCo-Authored-By: AI Assistant <noreply@ai-assistant.com>

This commit is contained in:
William Valentin
2025-11-04 10:56:12 -08:00
parent ccf1323849
commit cfc9b09a1f

View File

@@ -98,7 +98,7 @@ router.put(
if (!user.events.includes(eventId)) {
user.events.push(eventId);
user.stats.eventsParticipated = user.events.length;
await User.update(userId, user);
await user.save();
}
// Award points for event participation using couchdbService
@@ -218,7 +218,7 @@ router.delete(
if (user) {
user.events = user.events.filter(id => id !== eventId);
user.stats.eventsParticipated = user.events.length;
await User.update(userId, user);
await user.save();
}
res.json({
@@ -313,4 +313,4 @@ router.get(
})
);
module.exports = router;
module.exports = router;