Commit 859267f
committed
refactor(grz-common): extract get_metadata_upload_timestamp helper
Move the "head_object on $submission_id/metadata/metadata.json -> timestamp"
operation into a free function in `grz_common.transfer`, alongside
`init_s3_client`. `Worker.load_metadata_with_submission_date` calls it
and narrows the result to a `date` for storage in the DB.
Documents the inbox-vs-archive caveat: the S3 `LastModified` of the
metadata.json object is the authoritative inbox-receipt timestamp, but
once the submission has moved to the archive bucket the `LastModified`
no longer reflects the time of submission. Callers operating against
the archive (e.g. `grzctl db backfill`) must therefore not use this
helper and must keep deferring to the in-file
`submission.submissionDate` field. The existing `_backfill_submission`
already adds "submission_date" to `ignore_fields`, so this is already
the case in practice.1 parent 7d9e622 commit 859267f
3 files changed
Lines changed: 32 additions & 7 deletions
File tree
- packages
- grz-common/src/grz_common
- workers
- grz-db/src/grz_db/models/submission
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
321 | | - | |
322 | | - | |
323 | | - | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
324 | 328 | | |
325 | 329 | | |
326 | | - | |
327 | | - | |
| 330 | + | |
328 | 331 | | |
329 | 332 | | |
330 | 333 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1310 | 1310 | | |
1311 | 1311 | | |
1312 | 1312 | | |
1313 | | - | |
| 1313 | + | |
1314 | 1314 | | |
1315 | 1315 | | |
1316 | 1316 | | |
| |||
0 commit comments