Bug: Appointment conflict detection race condition #18
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The
hasConflict()check inapps/api/src/routes/appointments.tsand the subsequent INSERT/UPDATE are not wrapped in a database transaction. Two concurrent requests for the same groomer/timeslot can both pass the conflict check and create double-bookings.Context
Flagged in CEO review on PR #15. PR was merged without addressing this.
Fix
Wrap the conflict check + insert/update in
db.transaction():Impact
Double-bookings are possible under concurrent load. This is a correctness bug, not just a performance issue.