Add paginated test history listing with disable option

Add GET /tests endpoint returning lightweight test summaries (grade,
score, domain, date) with pagination, using database-level JSON
extraction to avoid loading full report blobs. The feature can be
disabled with --disable-test-list flag. Frontend includes a new
/tests/ page with table view and a conditional "History" navbar link.

Fixes: https://github.com/happyDomain/happydeliver/issues/12
This commit is contained in:
nemunaire 2026-04-09 17:46:08 +07:00
commit 7422f6ed0a
12 changed files with 546 additions and 3 deletions

View file

@ -76,6 +76,49 @@ paths:
schema:
$ref: '#/components/schemas/Error'
/tests:
get:
tags:
- tests
summary: List all tests
description: Returns a paginated list of test summaries with scores and grades. Can be disabled via server configuration.
operationId: listTests
parameters:
- name: offset
in: query
schema:
type: integer
minimum: 0
default: 0
description: Number of items to skip
- name: limit
in: query
schema:
type: integer
minimum: 1
maximum: 100
default: 20
description: Maximum number of items to return
responses:
'200':
description: List of test summaries
content:
application/json:
schema:
$ref: '#/components/schemas/TestListResponse'
'403':
description: Test listing is disabled
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/report/{id}:
get:
tags:
@ -1365,3 +1408,53 @@ components:
items:
$ref: '#/components/schemas/BlacklistCheck'
description: List of DNS whitelist check results (informational only)
TestSummary:
type: object
required:
- test_id
- score
- grade
- created_at
properties:
test_id:
type: string
pattern: '^[a-z0-9-]+$'
description: Test identifier (base32-encoded with hyphens)
score:
type: integer
minimum: 0
maximum: 100
description: Overall deliverability score (0-100)
grade:
type: string
enum: [A+, A, B, C, D, E, F]
description: Letter grade
from_domain:
type: string
description: Sender domain extracted from the report
created_at:
type: string
format: date-time
TestListResponse:
type: object
required:
- tests
- total
- offset
- limit
properties:
tests:
type: array
items:
$ref: '#/components/schemas/TestSummary'
total:
type: integer
description: Total number of tests
offset:
type: integer
description: Current offset
limit:
type: integer
description: Current limit