guardian / grid

The Guardian’s image management system
https://www.theguardian.com/info/developer-blog/2015/aug/12/open-sourcing-grid-image-service
Apache License 2.0
1.44k stars 119 forks source link

imageLoader API endpoint for uploads by user #4231

Closed dblatcher closed 6 months ago

dblatcher commented 6 months ago

What does this change?

Adds a new API endpoint to the ImageLoader to return the UploadStatus of all images by a given user (the current user if no userId is specified on the path). Adds a methods to the loader api service in Kahuna to fetch the uploads data for the current user

How should a reviewer test this change?

run locally:

How can success be measured?

The new endpoint isn't in use yet - this is preparatory work for making improvements to the user experience for image uploads.

Currently, Kahuna polls the image API for each image uploaded (in the present browser session) to update the UI when the ingest is completed. This endpoint could be used instead to poll the loader API to see the progress of all the user's uploads - even if the page was refreshed after the image was uploaded to the queue bucket.

the endpoint could also act as a quick diagnostic tool - if a particular user reports issues uploading images, we can use it to see the status of their uploads, including any failures.

Who should look at this?

Tested? Documented?

github-actions[bot] commented 6 months ago

Deploy build 12251 to TEST

All deployment options - [Deploy build 12251 to TEST](https://riffraff.gutools.co.uk/deployment/deployAgain?project=media-service%3A%3Agrid%3A%3Aall&build=12251&stage=TEST&updateStrategy=MostlyHarmless&action=deploy) - [Deploy parts of build 12251 to TEST by previewing it first](https://riffraff.gutools.co.uk/preview/yaml?project=media-service%3A%3Agrid%3A%3Aall&build=12251&stage=TEST&updateStrategy=MostlyHarmless)

From guardian/actions-riff-raff.

dblatcher commented 6 months ago

example of the data from the new endpoint:


{
data: [
{
id: "9fb70952d7b3293aed428a9b6545f588e5306ebf",
fileName: "bird.jpeg",
uploadedBy: "david.blatcher@guardian.co.uk",
uploadTime: "2023-12-19T10:50:04.658821Z",
status: "COMPLETED",
expires: 1702986604
},
{
id: "acabe8b5bd37859e8111f1c73d551b368fcd1fe6",
fileName: "OBS_6_9_4_1_15_1 15_1 MEN PAINT 00131 (acabe8b5bd37859e8111f1c73d551b368fcd1fe6).jpg",
uploadedBy: "david.blatcher@guardian.co.uk",
uploadTime: "2023-12-19T10:50:04.656846Z",
status: "COMPLETED",
expires: 1702986604
},
{
id: "3c93d9ef443a2859dd5760982b596ce65ff22777",
fileName: "OBS_6_9_4_1_15_1 15_1 MEN PAINT 00141 (3c93d9ef443a2859dd5760982b596ce65ff22777).jpg",
uploadedBy: "david.blatcher@guardian.co.uk",
uploadTime: "2023-12-19T10:50:04.665172Z",
status: "COMPLETED",
expires: 1702986604
},
{
id: "011896ac28ac533082d0df0626e812711e443f03",
fileName: "011896ac28ac533082d0df0626e812711e443f03.jpeg",
uploadedBy: "david.blatcher@guardian.co.uk",
uploadTime: "2023-12-19T10:50:04.655069Z",
status: "COMPLETED",
expires: 1702986604
},
{
id: "d02035837f03a0f9c3959c4ecbb9c51d01fc0e22",
fileName: "GettyImages-146784693 (d02035837f03a0f9c3959c4ecbb9c51d01fc0e22).jpg",
uploadedBy: "david.blatcher@guardian.co.uk",
uploadTime: "2023-12-19T10:50:04.663983Z",
status: "COMPLETED",
expires: 1702986604
},
{
id: "e1bdc4fc148e012a55c33ac709d8bb6c35c424ad",
fileName: "GettyImages-471205281 (e1bdc4fc148e012a55c33ac709d8bb6c35c424ad).jpg",
uploadedBy: "david.blatcher@guardian.co.uk",
uploadTime: "2023-12-19T10:50:04.655972Z",
status: "COMPLETED",
expires: 1702986604
},
{
id: "06de28f7a623f98fb300e81597fceedbc63db78e",
fileName: "W856X0 (06de28f7a623f98fb300e81597fceedbc63db78e).jpg",
uploadedBy: "david.blatcher@guardian.co.uk",
uploadTime: "2023-12-19T10:50:04.660948Z",
status: "COMPLETED",
expires: 1702986604
},
{
id: "19e3801686bdebc6de5b05ea4e95fe2d1eec52a8",
fileName: "1811964910 (19e3801686bdebc6de5b05ea4e95fe2d1eec52a8).jpg",
uploadedBy: "david.blatcher@guardian.co.uk",
uploadTime: "2023-12-19T10:50:04.654262Z",
status: "COMPLETED",
expires: 1702986604
},
{
id: "21c1b50cd14a7e5a8aa361d3126ff00fb0980392",
fileName: "castle.jpg",
uploadedBy: "david.blatcher@guardian.co.uk",
uploadTime: "2023-12-19T10:54:09.958Z",
status: "COMPLETED",
expires: 1702986849
},
{
id: "898bea58e055b53bce67c4cbf48fee85bdde8c61",
fileName: "kangeroo.jpeg",
uploadedBy: "david.blatcher@guardian.co.uk",
uploadTime: "2023-12-19T10:50:04.645367Z",
status: "COMPLETED",
expires: 1702986604
},
{
id: "675ff3fefd8ee94e679eb0b0fe24586eb348f95d",
fileName: "1806322178 (675ff3fefd8ee94e679eb0b0fe24586eb348f95d).jpg",
uploadedBy: "david.blatcher@guardian.co.uk",
uploadTime: "2023-12-19T10:50:04.662909Z",
status: "COMPLETED",
expires: 1702986604
}
]
}
prout-bot commented 6 months ago

Seen on auth, usage, image-loader, metadata-editor, thrall, leases, cropper, collections, media-api, kahuna (merged by @dblatcher 8 minutes and 46 seconds ago) Please check your changes!