Files
support_backend/specs/012-admin-list-views/tasks.md
T
saqib mirandClaude Sonnet 5 3bd068b031 feat(012-admin-list-views): SLA-run, escalation-event, and product-catalog list endpoints
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>
2026-09-07 16:31:20 +05:30

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?) in src/modules/orchestration/sla/repository/sla-run.repository.tsinclude: { ticket: { select: { id: true, code: true } } }, optional where: { status }
  • T002 [US1] Add SLAService.listAll(status?) (or directly on the controller if no service method is warranted — check existing pattern) validating status against SLA_RUN_STATUSES (400 on an invalid value) in src/modules/orchestration/sla/service/sla.service.ts (depends on T001)
  • T003 [US1] Add GET /admin/sla-runs (fastify.authenticate only) in src/modules/orchestration/sla/controller/ + routes/, projecting each row to SlaRunListItem (data-model.md) (depends on T002)
  • T004 [US1] Integration test covering Quickstart Scenario 1 (unfiltered returns all; status=breached filters correctly; an invalid status is 400) in tests/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) in src/modules/orchestration/escalation/repository/escalation-event.repository.tsinclude: { ticket: { select: { id: true, code: true } } }, orderBy: { createdAt: 'desc' }, take: limit
  • T007 [US2] Add GET /admin/escalation-events (fastify.authenticate only, limit query param z.coerce.number().int().positive().max(200).default(50)) in src/modules/orchestration/escalation/controller/ + routes/, projecting to EscalationEventListItem (depends on T006)
  • T008 [US2] Integration test covering Quickstart Scenario 2 (both events appear, most- recent-first, automatic vs manual distinguished by ruleId) in tests/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() in src/modules/catalog/products/repository/products.repository.tsinclude: { integration: { select: { status: true } } }, orderBy: { name: 'asc' }
  • T011 [US3] Add GET /admin/products (fastify.authenticate + requireRole('ADMIN')) in src/modules/catalog/products/controller/ + routes/, projecting each row to ProductCatalogListItem (integrationStatus: product.integration?.status ?? null — never the full ProductIntegration row, 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.md Notes with any implementation-time findings
  • T015 Run npx tsx scripts/check-architecture.ts and npm run lint/npm run typecheck
  • T016 Full regression: npm run test:unit then 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