Skip to content

Commit

Permalink
append tuid to metadata (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
cfarmer-fearless authored Aug 19, 2024
1 parent a3a18f9 commit 5ce6a95
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 7 additions & 3 deletions upload-server/internal/metadata/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ func WithPreCreateManifestTransforms(event handler.HookEvent, resp hooks.HookRes
logger.Info("adding global timestamp", "timestamp", timestamp)

manifest := event.Upload.MetaData
fieldname := "dex_ingest_datetime"
manifest[fieldname] = timestamp
manifest["dex_ingest_datetime"] = timestamp
manifest["upload_id"] = tuid
resp.ChangeFileInfo.MetaData = manifest

report := reports.NewBuilderWithManifest[reports.BulkMetadataTransformReportContent](
Expand All @@ -399,8 +399,12 @@ func WithPreCreateManifestTransforms(event handler.HookEvent, resp hooks.HookRes
Field: "ID",
Value: tuid}, {
Action: "append",
Field: fieldname,
Field: "dex_ingest_datetime",
Value: timestamp,
}, {
Action: "append",
Field: "upload_id",
Value: tuid,
}},
}).Build()

Expand Down
7 changes: 7 additions & 0 deletions upload-server/testing/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ func TestTus(t *testing.T) {
}
}
}

appendedUid, ok := processedMeta["upload_id"]
if !ok {
t.Error("upload ID not appended to file metadata")
} else if appendedUid != tuid {
t.Error("appended upload ID did not match upload ID", appendedUid, tuid)
}
}

t.Log("test case", name, "passed", tuid)
Expand Down

0 comments on commit 5ce6a95

Please sign in to comment.