Closed Conalb97 closed 3 months ago
We were about to merge this, but we were unable to run the UpdateMapping script in both out TEST and PROD environments owing to previous mapping changes (e.g. https://github.com/guardian/grid/pull/3445, https://github.com/guardian/grid/pull/4056, https://github.com/guardian/grid/pull/4104, )https://github.com/guardian/grid/pull/4112) which hadn't been applied (but passed the healthcheck, unlike the mapping change in this PR). As such, we've commenced a migration in both our environments - we hope they will be complete by Monday - after which we can run the UpdateMapping script and merge this PR.
Seen on cropper (created by @Conalb97 and merged by @twrichards 7 minutes and 38 seconds ago) Please check your changes!
Seen on kahuna (created by @Conalb97 and merged by @twrichards 7 minutes and 42 seconds ago) Please check your changes!
Seen on usage, auth, metadata-editor (created by @Conalb97 and merged by @twrichards 7 minutes and 49 seconds ago) Please check your changes!
Seen on leases (created by @Conalb97 and merged by @twrichards 7 minutes and 56 seconds ago) Please check your changes!
Seen on leases (created by @Conalb97 and merged by @twrichards 7 minutes and 57 seconds ago) Please check your changes!
Seen on collections (created by @Conalb97 and merged by @twrichards 8 minutes ago) Please check your changes!
Seen on image-loader (created by @Conalb97 and merged by @twrichards 8 minutes and 49 seconds ago) Please check your changes!
What does this change?
This PR introduces changes that are required as part of the BBC's integration with Capture, specifically the ability to send images to Capture. These changes have been developed on top of the existing syndication usage functionality, but have been designed to ensure backwards compatibility so that other users of the Grid are unaffected.
The syndication usage has been updated to be able to track the user that has requested an image be syndicated, via an optional 'syndicatedBy' field. Additionally, logic has been added such that if the syndication partner is "Capture", the usage status will be set as 'Pending' - otherwise the behavious remains the same.
The usage status is set to 'Pending' as the BBC are pre-empting potential failures in the delivery of images to Capture. If an image fails to be delivered to Capture then the usage status will be updated to 'Failed', if an image is successfully delivered the usage status will be updated to 'Syndicated'. Therefore, in this context, the 'Pending' usage status is being used by the BBC as an intermediate status.
In order to achieve the above workflow, a new usage status, 'Failed', has been added to 'UsageStatus' and the 'updateUsageStatus' endpoint has been added to the usages API, to provide the functionality to update the usage status for an individual usage.
These changes required an update of mappings.scala, so to deploy them an update to the Elasticsearch mapping is neccessary.
How should a reviewer test this change?
To test the changes to the syndication usage:
Make GET requests to :
/usages/syndication
With the following request bodies:
To test the updateUsageStatus endpoint
Make GET requests to :
/usages/status/update/<meidaId>/<usageId>
With the following request bodies:
How can success be measured?
Success for the syndication usage:
Success for the updateUsageStatus endpoint:
Who should look at this?
@guardian/digital-cms
Tested? Documented?