diff --git a/backend/src/routes/events.js b/backend/src/routes/events.js index c326fcb..33099fb 100644 --- a/backend/src/routes/events.js +++ b/backend/src/routes/events.js @@ -253,6 +253,24 @@ router.post('/checkin/:token', authenticate, async (req, res, next) => { }); } + // Ensure event chat room exists (create if missing) + const existingChatRoom = await prisma.chatRoom.findFirst({ + where: { + eventId: event.id, + type: 'event', + }, + }); + + if (!existingChatRoom) { + await prisma.chatRoom.create({ + data: { + eventId: event.id, + type: 'event', + }, + }); + console.log(`✅ Created missing chat room for event: ${event.slug}`); + } + // Add user to event participants const participant = await prisma.eventParticipant.create({ data: {