Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/app/api/rooms/route.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { randomBytes } from 'crypto';
import { NextResponse } from 'next/server';
import { db } from '@/configs/db';
import { classroomsTable, membershipsTable, usersTable, organizationsTable, organizationMembershipsTable } from '@/configs/schema';
Expand Down Expand Up @@ -130,7 +131,7 @@ export async function POST(req: Request) {
}
}

const inviteCode = Math.random().toString(36).substring(2, 8).toUpperCase();
const inviteCode = randomBytes(4).toString('hex').toUpperCase();

// Transactional insert: create room and then add teacher as member atomically
const newRoom = await db.transaction(async (tx) => {
Expand Down
Loading