Accounts App
Purpose: User management, role assignment, team organization, and geographic zone management.
This app is the foundation — every other app depends on accounts for user identity and role-based access control.
Responsibilities
User registration and profile management
Role assignment (seven system roles)
Team creation and membership management
Geographic zone definition and assignment
JWT-based authentication (access + refresh tokens)
Custom permission classes used by all other apps
Dependencies
None. This is a leaf dependency — other apps import from accounts, but accounts imports from no other ChargeSol app.
Key Models
User — Extends Django’s
AbstractUserwith phone, role, zone, and availability flag.Role — System roles:
oem,customer,central_ops,field_team,procurement,finance,oem_reporting.Team — Groups of field team users, scoped to a zone. Specialization: survey, installation, or both.
TeamMembership — Links users to teams with a role (lead or member).
Zone — Geographic regions (city/district level) that determine team assignment and material stock location.
Business Rules
A user belongs to exactly one role.
A field team user can be a member of multiple teams (e.g., survey team and installation team).
Teams are scoped to a single zone; users can only be assigned work within their team’s zone.
The
is_availableflag on User is checked by the emergency app when searching for backup teams.Central Ops users can manage users and teams across all zones.