Backend Architecture
The backend uses JWT authentication plus four shared role and verification permission classes: IsCustomer, IsSeller, IsVerifiedSeller, and IsAdmin.
Role Mapping
| Permission | Accepted role values |
|---|---|
| IsCustomer | buyer, renter, or investor |
| IsSeller | seller_owner |
| IsVerifiedSeller | active seller_owner with an approved KYB verification |
| IsAdmin | admin |
IsSeller requires an authenticated, active account with active user status. IsVerifiedSeller adds an approved KYB requirement and protects seller property, appointment, dashboard, notification, and finance routes. IsCustomer and IsAdmin also require an authenticated, active account with active user status through their shared helpers.
The user model also defines agent, but the shared permission module does not define an agent permission class. investor currently passes the customer permission even though no Investment workflow is installed.
Authorization Layers
- Simple JWT authenticates the request.
- The view applies a role permission class or public access policy.
- Selectors scope records to the current owner or participant.
- Serializers validate request shape and field rules.
- Services validate current state and perform the write transaction.
A valid role does not automatically authorize access to every record. Preserve owner-, participant-, and state-scoped selector checks when adding endpoints.
Service Conventions
- Use
transaction.atomicand row locks for competing reservations and financial writes. - Keep list/detail queries in selectors and mutation logic in services.
- Send notifications only after the related business decision is known.
- Record sensitive administrator financial actions in
AuditLog. - Never hard-delete payment, payout, or audit records.
Supporting References
Data Model, Accounts and Verification, and Status Lifecycles.