# Get list of workers Retrieves a paginated list of workers for the authenticated user's company. Features: - Requires JWT token authentication in the Authorization header - Company context is inferred from the authenticated user - Supports search by name or worker_id using the 'q' parameter - Filter by status, position, or employment_type - Pagination with customizable page size (default 25, max 100) - Results sorted by creation date (newest first) Endpoint: GET /api/control/workers Version: 2.0.0 Security: bearerAuth ## Query parameters: - `auth0Id` (string, required) User identifier (internal use, can be derived from JWT token) Example: "user_123456789" - `companyId` (string) Company identifier (must match user's company, otherwise forbidden) Example: "comp_12345" - `q` (string) Search query (searches in first_name, last_name, and worker_id) Example: "John" - `status` (string) Filter by worker status Example: "active" - `position` (string) Filter by worker position Example: "field_worker" - `employment_type` (string) Filter by employment type Example: "full_time" - `page` (integer) Page number (default 1) Example: 1 - `limit` (integer) Number of items per page (default 25, max 100) Example: 25 ## Response 200 fields (application/json): - `status` (string) Example: "success" - `data` (object) - `data.total` (integer) Total number of workers matching the query Example: 42 - `data.page` (integer) Current page number Example: 1 - `data.pageSize` (integer) Number of items per page Example: 25 - `data.items` (array) - `data.items.workerId` (string) Worker unique identifier Example: "6507f1e3c9d8e2a4b1f9c3d5" - `data.items.worker_id` (string) Worker business ID (INITIALS + MMDD of hire date) Example: "JS0315" - `data.items.first_name` (string) Worker first name Example: "John" - `data.items.last_name` (string) Worker last name Example: "Smith" - `data.items.phone` (string) Worker phone number Example: "+1234567890" - `data.items.email` (string) Worker email address Example: "john.smith@example.com" - `data.items.position` (string) Worker position Example: "field_worker" - `data.items.employment_type` (string) Employment type Example: "full_time" - `data.items.hire_date` (string) Hire date in YYYY-MM-DD format Example: "2025-03-15" - `data.items.termination_date` (string,null) Termination date in YYYY-MM-DD format (null if still employed) - `data.items.status` (string) Worker status Example: "active" - `data.items.hourly_rate` (number) Hourly rate (if applicable) Example: 18.5 - `data.items.emergency_contact_name` (string) Emergency contact name Example: "Jane Smith" - `data.items.emergency_contact_phone` (string) Emergency contact phone number Example: "+1234567891" - `data.items.skills` (array) Worker skills Example: ["irrigation","pruning"] - `data.items.notes` (string) Additional notes about the worker Example: "Experienced in avocado cultivation" - `data.items.photo` (string,null) URL of worker photo Example: "https://storage.example.com/photos/worker-photo.jpg" - `data.items._id` (string) unique identifier Example: "6507f1e3c9d8e2a4b1f9c3d5" - `data.items.name` (string) Full name (first + last) Example: "John Smith" - `data.items.companyId` (string) Example: "comp_12345" - `data.items.companyName` (string) Example: "Hydrobit Client SA" - `data.items.createdAt` (string) Example: "2025-03-15T10:30:00.000Z" - `data.items.updatedAt` (string) Example: "2025-03-15T10:30:00.000Z" ## Response 400 fields (application/json): - `status` (string) Example: "error" - `message` (string) Example: "Error message description" - `error` (string) Example: "Detailed error information" ## Response 401 fields (application/json): - `status` (string) Example: "error" - `message` (string) Example: "Error message description" - `error` (string) Example: "Detailed error information" ## Response 403 fields (application/json): - `status` (string) Example: "error" - `message` (string) Example: "Error message description" - `error` (string) Example: "Detailed error information" ## Response 500 fields (application/json): - `status` (string) Example: "error" - `message` (string) Example: "Error message description" - `error` (string) Example: "Detailed error information"