Extends the existing PATCH /admin/agents/:agentId with an optional userId to finish wiring 010's Agent.userId link, and adds GET /agents/me/tickets + GET /admin/agents/:agentId/tickets sharing one ticketing/tickets service method, backed by a new Assignment @@index([agentId, isCurrent]). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
36 lines
1.8 KiB
Markdown
36 lines
1.8 KiB
Markdown
# Quickstart: Validating Agent Ticket Queue
|
|
|
|
Prerequisites: 010-identity-auth's login working; an existing `Team`/`Agent`/`User` (role
|
|
`AGENT`) to link.
|
|
|
|
## Scenario 1 — linking (User Story 1)
|
|
|
|
1. `PATCH /admin/agents/:agentId` with `{ "userId": "<agent's User.id>" }` as an admin.
|
|
**Expected**: `200`, response's `userId` matches.
|
|
2. Repeat with a `userId` belonging to a `User` whose role is `ADMIN`. **Expected**: `400`.
|
|
3. Repeat step 1's `userId` against a *different* `agentId`. **Expected**: `409`.
|
|
|
|
## Scenario 2 — an agent lists their own tickets (User Story 2)
|
|
|
|
1. With two tickets currently assigned to the linked agent (via the existing orchestration
|
|
assignment flow) and one assigned to a different agent, log in as that agent and call
|
|
`GET /agents/me/tickets`. **Expected**: `200`, exactly the two tickets, each with `product`/
|
|
`customer`/`priority`/`severity`/`status`/`assignedAt`/`sla` populated.
|
|
2. Reassign one of those two tickets away (to a different agent or node). **Expected**: calling
|
|
`GET /agents/me/tickets` again returns only the one remaining ticket.
|
|
3. Log in as a `User` (role `AGENT`) with no linked `Agent` row and call the same endpoint.
|
|
**Expected**: `404` with the specific "no agent profile linked" message, not `[]`.
|
|
|
|
## Scenario 3 — an admin lists a specific agent's tickets
|
|
|
|
1. Log in as admin; call `GET /admin/agents/:agentId/tickets` for the agent from Scenario 2.
|
|
**Expected**: `200`, same ticket set and shape as that agent's own `GET /agents/me/tickets`
|
|
call.
|
|
2. Log in as a non-admin agent; call the same admin route for another agent's `agentId`.
|
|
**Expected**: `403`.
|
|
|
|
## What "done" looks like
|
|
|
|
All three scenarios pass, and Scenario 2 step 2 specifically confirms the list reflects live
|
|
assignment state rather than a snapshot from when the agent first logged in.
|