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:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user