EstateHub

Backend Architecture

The backend uses JWT authentication plus four shared role and verification permission classes: IsCustomer, IsSeller, IsVerifiedSeller, and IsAdmin.

Role Mapping

PermissionAccepted role values
IsCustomerbuyer, renter, or investor
IsSellerseller_owner
IsVerifiedSelleractive seller_owner with an approved KYB verification
IsAdminadmin

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

  1. Simple JWT authenticates the request.
  2. The view applies a role permission class or public access policy.
  3. Selectors scope records to the current owner or participant.
  4. Serializers validate request shape and field rules.
  5. Services validate current state and perform the write transaction.
Role checks are not object checks

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.atomic and 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.