Documentation

Technical documentation for the PestControlOS CRM and Android app.

Architecture, security, Firestore model, and feature details for developers and technical reviewers.

CRM: Job management

Technical specification for job management in the PestControlOS CRM (PWA).

Data model

  • JobWork: Firestore collection for customer-facing service jobs. Fields: customer details, contact, address, issue details, AssignedTech (display), AssignedTechKey (lowercase, for queries), status, payment information, operational notes. Used for assignment, acceptance, completion, follow-up scheduling.
  • ManagmentJobs: Firestore collection for internal tasks. Fields: title, priority, due date, assignment, status. Separate list/detail/edit flows; admin-focused.

Access control

  • Admin/super_admin: Can read/write all JobWork and ManagmentJobs. Can assign any technician; create job from calendar event; link existing job to event.
  • Technician: Can read only JobWork documents where AssignedTechKey == request.auth.token.contractKey. Can create job only with self-assignment; cannot change AssignedTechKey to another tech. Client and Firestore rules must both enforce: tech cannot read another tech’s job; tech cannot write AssignedTechKey to a different value.
  • Verification: In Rules Playground, confirm tech cannot read JobWork where AssignedTechKey is another tech; tech cannot write AssignedTechKey to a different value.

Calendar integration

  • Create New Job from event: Prefill from event (date, time, optional customer/address); assign technician (admin); save. New JobWork document created; event updated with linkedJobId and linkedJobCollection.
  • Link Existing Job: From event, select job from list (admin: all jobs; tech: own); save. Event document updated with linkedJobId/linkedJobCollection. Ensures single source of truth and no duplicate job creation.

Lifecycle

  • Status transitions (e.g. accepted, in progress, completed); payment capture; follow-up scheduling. Notifications to assigned technician on assignment or status change (write to notifications/{user}/items).