mohd ef60218c4c fix: make booking overlap check atomic with select_for_update
Wrap the overlap query and Booking.objects.create() in a single
transaction.atomic() block inside BookingCreateSerializer.create().
Lock the StaffProfile row with select_for_update() so concurrent
requests for the same staff slot are serialized at the DB level;
only one writer can hold the lock at a time, eliminating the race
window between validate() and save().

The early check in validate() is kept for fast user feedback in
the common non-concurrent case. The locked re-check in create()
is the correctness guarantee.

On SQLite (dev/tests) FOR UPDATE is silently ignored but writes
are still serialized. PostgreSQL (production) gets row-level locking.

Update docs/risks.md to mark the race condition as fixed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 00:27:04 +03:00
2026-02-28 17:31:03 +03:00
2026-02-28 15:33:18 +03:00
2026-02-28 17:41:00 +03:00

Salon Booking Platform

Scaffolded Django + React starter for a salon booking platform.

Backend

Location: backend/

Setup

  1. Create a virtualenv and install dependencies.
    • python3 -m venv venv && source venv/bin/activate (or venv\Scripts\activate on Windows)
    • pip install -r backend/requirements.txt -r backend/requirements-dev.txt
  2. Copy backend/.env.example to backend/.env and adjust values.
  3. Run migrations and start the server.

Demo data

After migrations, you can seed demo data:

  • python manage.py seed_demo

Tests

  • From project root with venv active: venv/bin/python3 -m pytest (run from backend/ so pytest.ini is picked up)
  • External provider tests are skipped by default; run explicitly when needed: PYTEST_ADDOPTS='' venv/bin/python3 -m pytest -m external

Core API endpoints (current scaffold)

  • POST /api/auth/register/
  • POST /api/auth/token/
  • POST /api/auth/token/refresh/
  • GET/PATCH /api/auth/me/
  • POST /api/auth/otp/request/
  • POST /api/auth/otp/verify/
  • POST /api/auth/phone/request/
  • POST /api/auth/phone/verify/
  • POST /api/auth/social/<provider>/ (placeholder)
  • GET /api/salons/
  • GET /api/salons/<id>/
  • GET /api/salons/<id>/services/
  • GET /api/salons/<id>/staff/
  • GET /api/salons/<id>/reviews/
  • GET/POST /api/bookings/
  • GET /api/bookings/<id>/
  • GET/POST /api/payments/

Frontend

Location: frontend/

Setup

  1. Install dependencies via npm install.
  2. Run npm run dev.

Tests

  • npm run test

The dev server proxies /api to http://localhost:8000.

Project Notes

  • Known gaps and risks: docs/risks.md
  • Architecture and async/observability decisions: docs/architecture.md
  • Documentation index and standards: docs/README.md and docs/documentation.md
S
Description
No description provided
Readme 548 KiB
Languages
Python 74.5%
JavaScript 21.8%
CSS 3.5%
HTML 0.2%