MutterCorp
MutterCorpNotice · Notícias
Programação·

How I made double booking impossible in a Next.js + Postgres booking app

When I built an online booking flow for a dental clinic site (Next.js 15, Drizzle ORM, PostgreSQL), the scariest bug wasn't a UI glitch. It was this one: two patients look at the same free 9:00 slot, both click "Book" within the same second, and both get a confirmation email. The usual first attempt looks fine and is still broken: // ❌ check, then insert const clash = await db.select().from(appointments).where(overlaps(doctorId, start, end)); if (clash.length) throw new Error("slot_taken"); awa…

Publicado no Notice. Categoria: Programação.

Notícias sobre o mesmo assunto em outras fontes