Booking overlap detection
The Problem
Two users booking the same room for overlapping times caused conflicts.
How I Solved It
Service-layer query checking active bookings with overlapping time ranges before insert.
const conflict = await prisma.booking.findFirst({
where: { roomId, status: 'ACTIVE',
startTime: { lt: endTime }, endTime: { gt: startTime } },
});
if (conflict) throw new ConflictException('Room already booked');


