docs: revise ADR 0001, risks, and architecture for accuracy
- ADR 0001: distinguish payment/OTP (sync by design) from notifications (fire-and-forget); correct misleading claim that notification failures surface to clients — they are silently absorbed as FAILED status - risks.md: upgrade USERNAME_FIELD entry with concrete breakage (admin, create_superuser, JWT lookup); add booking overlap race condition with root cause and fix (select_for_update) - architecture.md: document notification/OTP provider coupling as an MVP shortcut and note the Phase 2 fix (dedicated NotificationProvider) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+11
-1
@@ -12,7 +12,7 @@ The Salon platform is a Django REST API backend with a React/Vite frontend, opti
|
||||
| **salons** | Salon catalog, services, staff, availability windows, reviews. Read-only public APIs. |
|
||||
| **bookings** | Booking model, validation (availability, overlap prevention), status transitions. Triggers notifications on create and status change. |
|
||||
| **payments** | Payment model, Moyasar integration (create, capture, refund), webhook reconciliation, idempotency. |
|
||||
| **notifications** | Booking lifecycle notifications (SMS/WhatsApp). Reuses OTP providers; sends on booking created/confirmed/cancelled. |
|
||||
| **notifications** | Booking lifecycle notifications (SMS/WhatsApp). Reuses OTP provider classes as an MVP shortcut; sends on booking created/confirmed/cancelled. See note below. |
|
||||
|
||||
## Data Model Overview
|
||||
|
||||
@@ -35,6 +35,16 @@ User → React Frontend → Django API
|
||||
payments ──→ Moyasar gateway
|
||||
```
|
||||
|
||||
## Notification / OTP Provider Coupling (MVP Shortcut)
|
||||
|
||||
`notifications/services.py` imports `PROVIDERS` from `apps.accounts.services.otp` and uses OTP provider instances (e.g. `AuthenticaOtpProvider`) to send booking SMSes. This works today because Authentica handles both authentication OTPs and general SMS delivery.
|
||||
|
||||
Consequences of this coupling:
|
||||
- Notifications and OTP delivery cannot independently use different providers (e.g. Twilio for OTP, Unifonic for notifications).
|
||||
- The `notifications` app is conceptually coupled to the `accounts` app's auth infrastructure.
|
||||
|
||||
This is an acceptable MVP shortcut. Before Phase 2, introduce a dedicated `NotificationProvider` abstraction in `notifications/` (mirroring `OtpProvider`) so the two systems can be configured and tested independently.
|
||||
|
||||
## Async and Observability (MVP Decision)
|
||||
|
||||
**Decision (MVP):** All OTP sends, booking notifications, and payment gateway calls run **synchronously** in the request/response path. No Celery, RQ, or other task queue for the initial launch.
|
||||
|
||||
Reference in New Issue
Block a user