Conversation
- Create Room Bookings table in Airtable via API - Add room-bookings.ts library with booking/conflict logic - Add API routes for rooms and bookings (GET, POST, DELETE) - Add /portal/book-room UI with hourly time slots - Add link to book rooms from portal main page Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Shows hourly time slots for the selected room and date: - Green highlight for user's current selection - Red highlight for already booked slots - Updates in real-time when booking is created Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Airtable's ARRAYJOIN function doesn't work on linked record fields in formulas. Changed to fetch all matching bookings and filter by room/user ID client-side instead. Also updated day calendar to show all rooms side-by-side. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Move date field before room selector - Prefill start/end times to nearest hour - Switch table orientation: rooms as rows, times as columns - Group rooms by floor in calendar view Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code ReviewFound 1 issue during review: Race Condition: Time-Of-Check to Time-Of-Use (TOCTOU) in Booking CreationLocation: Issue: This endpoint has a race condition that could allow double-bookings for the same room and time slot. The code checks for conflicts with Why This Is Significant:
This creates a realistic window for race conditions, especially when multiple users are booking popular rooms simultaneously (e.g., at the start of a workday). Code Reference: mox-sf/app/portal/api/room-bookings/route.ts Lines 89 to 136 in e87d8a5 Suggested Fixes:
The first option (optimistic concurrency) is likely the most practical for Airtable-based systems. |
- Sort floors in descending order (higher floors on top) - If after 9pm, default to next day at 8am instead of empty times - Before 8am, default to today at 8am Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Use local time formatting instead of toISOString() which converts to UTC. At 11pm PST, toISOString() returns the next day in UTC, causing the wrong date to be displayed. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
After creating a booking, re-check for conflicts (excluding the new booking). If another booking was created concurrently for the same slot, cancel our booking and return an error asking user to retry. This prevents double-bookings that could occur when two users try to book the same slot simultaneously. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
Changes
RoomsandRoomBookingsto Tables constantTest plan
🤖 Generated with Claude Code