Adds GET /admin/sla-runs (filterable by status), GET /admin/escalation- events (capped, most-recent-first), and GET /admin/products (with integration status joined in, never the full ProductIntegration row). None of these existed as a single query before - only per-ticket or per-integration-id lookups did. Discovered while planning supporthub-web's 001-agent-admin-ui User Stories 6-7 (SLA/escalation monitoring, product catalog), the same way 011-agent-ticket-queue was discovered for User Story 1. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
4.5 KiB
4.5 KiB
description
| description |
|---|
| Task list for 012-admin-list-views |
Tasks: Admin List Views
Input: Design documents from specs/012-admin-list-views/
Prerequisites: plan.md, spec.md, research.md, data-model.md, contracts/admin-list-views-contract.md, quickstart.md
Organization: Tasks are grouped by user story (US1 = P1 SLA runs, US2 = P1 escalation events, US3 = P2 product catalog). All three are independent of each other.
Format: [ID] [P?] [Story] Description
All file paths are relative to supporthub-api/ (repo root).
Phase 1: User Story 1 - SLA runs across every ticket (Priority: P1)
Independent Test: Quickstart Scenario 1.
- T001 [P] [US1] Add
SLARunRepository.findAll(status?)insrc/modules/orchestration/sla/repository/sla-run.repository.ts—include: { ticket: { select: { id: true, code: true } } }, optionalwhere: { status } - T002 [US1] Add
SLAService.listAll(status?)(or directly on the controller if no service method is warranted — check existing pattern) validatingstatusagainstSLA_RUN_STATUSES(400 on an invalid value) insrc/modules/orchestration/sla/service/sla.service.ts(depends on T001) - T003 [US1] Add
GET /admin/sla-runs(fastify.authenticateonly) insrc/modules/orchestration/sla/controller/+routes/, projecting each row toSlaRunListItem(data-model.md) (depends on T002) - T004 [US1] Integration test covering Quickstart Scenario 1 (unfiltered returns all;
status=breachedfilters correctly; an invalid status is 400) intests/integration/admin-list-views.test.ts - T005 [US1] Run Quickstart Scenario 1 locally and confirm all 3 steps pass
Phase 2: User Story 2 - Recent escalation events across every ticket (Priority: P1)
Independent Test: Quickstart Scenario 2.
- T006 [P] [US2] Add
EscalationEventRepository.findRecent(limit)insrc/modules/orchestration/escalation/repository/escalation-event.repository.ts—include: { ticket: { select: { id: true, code: true } } },orderBy: { createdAt: 'desc' },take: limit - T007 [US2] Add
GET /admin/escalation-events(fastify.authenticateonly,limitquery paramz.coerce.number().int().positive().max(200).default(50)) insrc/modules/orchestration/escalation/controller/+routes/, projecting toEscalationEventListItem(depends on T006) - T008 [US2] Integration test covering Quickstart Scenario 2 (both events appear, most-
recent-first, automatic vs manual distinguished by
ruleId) intests/integration/admin-list-views.test.ts(same file as T004) - T009 [US2] Run Quickstart Scenario 2 locally and confirm it passes
Phase 3: User Story 3 - Product catalog with integration status (Priority: P2)
Independent Test: Quickstart Scenario 3.
- T010 [P] [US3] Add
ProductsRepository.findAllWithIntegrationStatus()insrc/modules/catalog/products/repository/products.repository.ts—include: { integration: { select: { status: true } } },orderBy: { name: 'asc' } - T011 [US3] Add
GET /admin/products(fastify.authenticate+requireRole('ADMIN')) insrc/modules/catalog/products/controller/+routes/, projecting each row toProductCatalogListItem(integrationStatus: product.integration?.status ?? null— never the fullProductIntegrationrow, research.md) (depends on T010) - T012 [US3] Integration test covering Quickstart Scenario 3 (active + no-integration
products both correct; non-admin gets 403) in
tests/integration/admin-list-views.test.ts(same file as T004/T008) - T013 [US3] Run Quickstart Scenario 3 locally and confirm both steps pass
Phase 4: Polish & Cross-Cutting Concerns
- T014 [P] Update
specs/012-admin-list-views/checklists/requirements.mdNotes with any implementation-time findings - T015 Run
npx tsx scripts/check-architecture.tsandnpm run lint/npm run typecheck - T016 Full regression:
npm run test:unitthen the full integration suite against real Docker-provisioned Postgres/Redis, confirming nothing outside this feature regressed
Dependencies & Execution Order
- User Stories 1-3: Fully independent of each other and of any Foundational phase (no shared prerequisite beyond the existing schema) — parallelizable in any order
- Polish (Phase 4): Depends on all three user stories