Get Work Queue

Retrieves the work queue overview with all active steps grouped by assigned operator. This is the primary data source for the Work Queue page (/queue), providing a supervisor-level view of workload distribution across the shop floor.

The endpoint scans all jobs, paths, and steps, counts the in-progress serials at each step, and groups the results by the step's assignedTo user ID. Steps with zero serials are excluded. Each group includes the operator's name (resolved from the user service), their assigned work items, and a total part count.

Unassigned steps (where assignedTo is null or undefined) are grouped under a special entry with operatorId: null and operatorName: "Unassigned".

Request

No request body or query parameters.

Response

200 OK

Returns a WorkQueueGroupedResponse object.

FieldTypeDescription
groupsOperatorGroup[]Array of operator groups, each containing their assigned work
totalPartsnumberTotal count of in-progress parts across all groups

OperatorGroup Fields

FieldTypeDescription
operatorIdstring | nullUser ID of the operator, or null for unassigned work
operatorNamestringDisplay name of the operator, or "Unassigned"
jobsWorkQueueJob[]Array of work items assigned to this operator
totalPartsnumberTotal part count for this operator

WorkQueueJob Fields

FieldTypeDescription
jobIdstringJob ID
jobNamestringJob name
pathIdstringPath ID
pathNamestringPath name
stepIdstringStep ID
stepNamestringStep name
stepOrdernumberZero-based step index
stepLocationstring | undefinedPhysical location
totalStepsnumberTotal steps in the path
serialIdsstring[]Serial IDs at this step
partCountnumberCount of serials at this step
nextStepNamestring | undefinedName of the next step
nextStepLocationstring | undefinedLocation of the next step
isFinalStepbooleanWhether this is the last step

500 Internal Server Error

ConditionMessage
Unexpected runtime error"Internal server error"

Examples

Request

curl http://localhost:3000/api/operator/work-queue

Response — Multiple operators with work

{
  "groups": [
    {
      "operatorId": "user_a1b2c3",
      "operatorName": "Jane Smith",
      "jobs": [
        {
          "jobId": "job_abc123",
          "jobName": "JOB-2024-001",
          "pathId": "path_xyz789",
          "pathName": "Main Route",
          "stepId": "step_001",
          "stepName": "CNC Machining",
          "stepOrder": 0,
          "stepLocation": "Bay 1",
          "totalSteps": 4,
          "serialIds": ["sn_00001", "sn_00002", "sn_00003"],
          "partCount": 3,
          "nextStepName": "Deburring",
          "nextStepLocation": "Bay 2",
          "isFinalStep": false
        }
      ],
      "totalParts": 3
    },
    {
      "operatorId": null,
      "operatorName": "Unassigned",
      "jobs": [
        {
          "jobId": "job_abc123",
          "jobName": "JOB-2024-001",
          "pathId": "path_xyz789",
          "pathName": "Main Route",
          "stepId": "step_003",
          "stepName": "Inspection",
          "stepOrder": 2,
          "stepLocation": "QC Lab",
          "totalSteps": 4,
          "serialIds": ["sn_00010", "sn_00011"],
          "partCount": 2,
          "nextStepName": "Packaging",
          "isFinalStep": false
        }
      ],
      "totalParts": 2
    }
  ],
  "totalParts": 5
}

Response — No active work

{
  "groups": [],
  "totalParts": 0
}

Notes

  • Only steps with at least one in-progress serial are included. Empty steps are excluded from the work queue.
  • The operatorName is resolved from the user service. If a step is assigned to a user ID that no longer exists in the user table, the raw user ID is used as the name.
  • The grouping key is the step's assignedTo field. If multiple steps across different jobs are assigned to the same operator, they all appear in that operator's group.
  • The totalParts at the response level is the sum of all partCount values across all groups.
  • This endpoint does not include previousStepId/previousStepName fields in the WorkQueueJob objects (unlike the step view endpoint).