Scheduled reports: Download, a report for a period as a ZIP
ci / fork-checks (pull_request) Skipped
ci / build (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Canceled after 1m19s

inbuxa:ReportExport/set creates {reportId, from?, to?}: the report built
for that period (its last full one by default, at most 90 days back, as
far as metrics are kept) as a ZIP of summary.txt and the section CSVs,
stored as an upload, mailing nobody. Reading needs sysScheduledReportGet,
as seeing the report does; a tenant administrator downloads only their
own; every download is in the audit log. A download doesn't move the
deliverability baseline the next mail compares with.
This commit is contained in:
jcoffey-dev committed 2026-10-06 15:24:34 -07:00
1 parent ff5480cb55
commit 09ccad4b4b
16 files changed
+494 -3

No files matched your search

+35
View File
@@ -325,6 +325,41 @@ pub async fn test(test: &mut TestServer) {
.await;
assert_eq!(name, "error", "a tenant changed the sender: {response}");
// --- Download (RP-19) ----------------------------------------------------
let (_, response) = call(
admin,
"inbuxa:ReportExport/set",
json!({"create": {
"last": {"reportId": &id},
"old": {"reportId": &id, "from": "2020-01-01T00:00:00Z", "to": "2020-01-02T00:00:00Z"}
}}),
)
.await;
let export = &response["created"]["last"];
assert!(export["blobId"].is_string(), "{response}");
assert!(
export["size"].as_u64().unwrap_or_default() > 0,
"{response}"
);
assert_eq!(
export["sha256"].as_str().map(|s| s.len()),
Some(64),
"{response}"
);
assert_eq!(export["files"][0], "summary.txt", "{response}");
assert!(
response["notCreated"]["old"].is_object(),
"a 2020 period was exported: {response}"
);
// A tenant administrator can't download a report that isn't theirs
let (_, response) = call(
&t_admin,
"inbuxa:ReportExport/set",
json!({"create": {"theirs": {"reportId": &id}}}),
)
.await;
assert!(response["notCreated"]["theirs"].is_object(), "{response}");
// --- Deleting ------------------------------------------------------------
let (_, response) = call(
admin,