Skip to content

feat(aspnetcore): HTTP endpoints to trigger and manage reports (PR 7)#32

Open
thiagoluga wants to merge 4 commits into
masterfrom
feat/aspnetcore
Open

feat(aspnetcore): HTTP endpoints to trigger and manage reports (PR 7)#32
thiagoluga wants to merge 4 commits into
masterfrom
feat/aspnetcore

Conversation

@thiagoluga

Copy link
Copy Markdown
Owner

PR 7 — Integrations.AspNetCore · CA-9, CA-10 · MVP demonstrável

MapNeoReports("/api") (Minimal API):

Método Rota Descrição
POST /reports/{name}/run async → 202 + { jobId } (CA-9)
POST /reports/{name}/run?mode=sync stream do único output com Content-Disposition (CA-10)
GET /reports lista reports registrados
GET /jobs/{id} status + stats
POST /jobs/{id}/cancel cancelamento cooperativo
GET /jobs/{id}/download resultado final (multi-output → zip)
  • Sync rejeita multi-output com 400 (CA-10). Auth herda do host (RequireAuthorization opcional; sem auth chain).
  • Core: IReportArtifactStore + FileSystemArtifactStore retêm os arquivos finais além do temp do pipeline; ReportRunner salva neles quando registrado (opt-in via DI). Fica no Core, não em Abstractions (concern de engine, não contrato de plugin) — ADR D20.
  • Sample 03-async-job-hangfire: HTTP + Hangfire single-server (storage in-memory; trocar por SQL no real).

Testes — 8 via TestServer

lista · async run → completed → download · sync stream · sync multi-output → 400 · report/job desconhecido → 404 · cancel desconhecido → 404.

58 testes verdes na solução inteira. CPM: Microsoft.AspNetCore.TestHost, Hangfire.AspNetCore. ADR D20; plan.md PR 7 marcado.

NeoReports.AspNetCore — MapNeoReports("/api") (Minimal API):
- POST /reports/{name}/run        async → 202 + { jobId }
- POST /reports/{name}/run?mode=sync  streams a single output (Content-Disposition)
- GET  /reports                    list registered reports
- GET  /jobs/{id}                  status + stats
- POST /jobs/{id}/cancel           cooperative cancel
- GET  /jobs/{id}/download         finished result (multi-output → zip)
Sync rejects multi-output with 400 (CA-10). Authorization inherited from host
(optional RequireAuthorization; no auth chain in v1).

Core: IReportArtifactStore + FileSystemArtifactStore retain finished files beyond
the pipeline's temp dir so download/sync can serve them; ReportRunner saves to it
when registered (opt-in via DI). Kept in Core, not Abstractions (engine concern,
not a plugin contract) — ADR D20.

Sample 03-async-job-hangfire: HTTP + Hangfire single-server (in-memory storage).

Tests (8) via TestServer: list, async run → completed → download, sync stream,
sync multi-output → 400, unknown report/job 404s, cancel unknown 404. All 58
solution tests green. CPM: add Microsoft.AspNetCore.TestHost, Hangfire.AspNetCore.
ADR D20; plan.md PR 7 done.
The /jobs/{id} status field serialized as the enum's numeric value, so clients
(and the async lifecycle test) couldn't read it as a name. Annotate the Status
DTO properties with JsonStringEnumConverter so the API emits "Queued"/"Running"/
"Completed" etc. — without touching the frozen ReportJobStatus enum in Abstractions.

Also folds in the docs that failed to land in the previous commit: ADR D20
(endpoints + artifact store + string status) and PR 7 checkmarks in plan.md.

All 58 solution tests green (8 API tests included).
CI clean build failed because ReportRunner (namespace NeoReports.Core.Pipeline)
referenced sibling 'Artifacts.IReportArtifactStore' without a using; a stale local
obj masked it. Use the fully-qualified NeoReports.Core.Artifacts.* name. Verified
with obj/bin wiped: clean full build + all 58 tests green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant