feat(aspnetcore): HTTP endpoints to trigger and manage reports (PR 7)#32
Open
thiagoluga wants to merge 4 commits into
Open
feat(aspnetcore): HTTP endpoints to trigger and manage reports (PR 7)#32thiagoluga wants to merge 4 commits into
thiagoluga wants to merge 4 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 7 — Integrations.AspNetCore · CA-9, CA-10 · MVP demonstrável
MapNeoReports("/api")(Minimal API):/reports/{name}/run/reports/{name}/run?mode=syncContent-Disposition(CA-10)/reports/jobs/{id}/jobs/{id}/cancel/jobs/{id}/downloadRequireAuthorizationopcional; sem auth chain).IReportArtifactStore+FileSystemArtifactStoreretêm os arquivos finais além do temp do pipeline;ReportRunnersalva neles quando registrado (opt-in via DI). Fica no Core, não em Abstractions (concern de engine, não contrato de plugin) — ADR D20.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.