Android: Jobs
Technical specification for job management in the PestControlOS Android app.
Data model
- JobWork: Firestore collection for service jobs. Fields: customer, contact, address, issue,
AssignedTech,AssignedTechKey(lowercase), status, payment, notes. Used for acceptance, completion, follow-up. - ManagmentJobs: Firestore collection for internal tasks. Fields: title, priority, due date, assignment, status. Separate view/edit flows.
Lifecycle
- Create/assign: Admin can assign any technician; tech can only assign self. Document must have both
AssignedTech(display) andAssignedTechKey(query). - Visibility: Admin sees all JobWork; tech sees only where
AssignedTechKey == contractKey(e.g.james). Firestore rules enforce: tech cannot read another tech’s job; tech cannot writeAssignedTechKeyto a different value. - Calendar: Event "Create New Job" prefills from event, assigns, saves; new job created, event gets
linkedJobId/linkedJobCollection. "Link Existing Job" updates event with existing job reference.
Work View integration
- Jobs from calendar added to assigned technician’s workview collection. Event–job link kept in sync.
Firestore rules
- JobWork: admin/super_admin read/write all; tech read where
AssignedTechKey == request.auth.token.contractKey, create with self-assignment only, no writing AssignedTechKey to another tech.