The Documents tool provides secure storage for employee paperwork. Files are stored in Cloudflare R2 with metadata tracked in D1. Documents are associated with a person record and grouped by category.
- Category-based organisation — Documents grouped by type (Employment Agreement, Superannuation, Visa, Certificate, Policy, Other)
- File uploads — PDF, Word, Excel, and image files up to 10 MB
- Expiry tracking — Optional expiry dates for visas and certificates with visual warnings
- Hierarchical access — Executives see all, heads see subtree, managers see direct reports, leads/employees see own
- Person selector — Executives, heads, and managers can switch between viewing their own and other people’s documents
- Person detail sheet — Documents tab integrated into the People tool drawer
- Download — Direct file download with correct content type
| Category | Description |
|---|
| Employment Agreement | Employment contracts and variations |
| Superannuation | Super choice forms and fund details |
| Visa | Work visa documents with expiry tracking |
| Certificate | Certifications (first aid, WWC, etc.) with expiry tracking |
| Policy | Signed company policies |
| Other | Any other employment-related documents |
| Access Level | View | Upload/Delete | Scope |
|---|
| Executive | Yes | Yes | All people |
| Head | Yes | Yes | Reporting subtree |
| Manager | Yes | Yes | Direct reports |
| Lead | Yes | No | Own only |
| Employee | Yes | No | Own only |
| Parameter | Type | Description |
|---|
person_id | string | Person to view documents for (exec/head/manager only) |
| Column | Type | Description |
|---|
| id | TEXT PK | UUID |
| person_id | TEXT FK | References people(id), cascade delete |
| category | TEXT | Document category |
| name | TEXT | Human-readable document name |
| file_key | TEXT | R2 object key |
| file_name | TEXT | Original filename |
| file_size | INTEGER | File size in bytes |
| content_type | TEXT | MIME type |
| expiry_date | TEXT | Optional expiry date (YYYY-MM-DD) |
| uploaded_by | TEXT FK | References users(id) |
| created_at | TEXT | Upload timestamp |
| File | Purpose |
|---|
src/routes/documents.tsx | Route definition with person_id search param |
src/components/documents/documents-page.tsx | Main page with person selector, grouped document list |
src/components/documents/document-upload-dialog.tsx | Upload dialog with category, name, expiry, file fields |
src/hooks/use-documents.ts | TanStack Query hooks for CRUD operations |
worker/routes/documents.ts | API endpoints with hierarchical permission scoping |
- E-signatures and document signing workflows
- Compliance monitoring and automated expiry alerts
- Recruitment and onboarding triggers that generate paperwork