Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow DeliveryChannels to be modified #778

Merged
merged 14 commits into from
Mar 28, 2024
Merged

Conversation

donaldgray
Copy link
Member

@donaldgray donaldgray commented Mar 27, 2024

Fixes #764 / WDC-60

Main Change

As detailed in related ticket, the main change here is to support updating DeliveryChannels (via PUT, PATCH or batch operation).

Refactored AssetProcessor, previously this handled creation of DeliveryChannels - either setting from default or finding full policies from DB. This logic was moved to a new class, DeliveryChannelProcessor, which will:

  • Add default DeliveryChannels as specified in DB - only if creation and no "deliveryChannels" specified.
  • Add new DeliveryChannels specified in payload if not present in DB.
  • Remove existing DeliveryChannels if ommitted from payload and present in DB.
  • Update deliveryChannelPolicyId for existing ImageDeliveryChannel if policy changed for same channel (e.g. "iiif-img" from "default" -> "iiif-img")

Related Refactoring

Refactored ApiAssetRepository. Previously this was a decorator around basic AssetRepository which shared the AssetRepositoryCachingBase abstract base class with DapperAssetRepository. This setup no longer made sense and by refactoring it allowed the save and delete functionality in ApiAssetRepository to be simplified. Get operations are now specific for API usage and can be controlled by 2 bool params (bool forUpdate = false, bool noCache = false)

Updated DeliveryChannelPolicyRepository and DefaultDeliveryChannelRepository to use async operations when interacting with database. Also moved these and AvChannelPolicyOptionsRepository to a .DataAccess namespace to ease groking in solution explorer.

Extracted hardcoded known DeliveryChannelPolicyIds to KnownDeliveryChannelPolicies to make referencing in tests etc easier.

griffri and others added 11 commits March 27, 2024 16:27
Create an imageStorage with a size of 0 for assets using `"channel":"none"`

Add test for IngestExecutor skipping the processing of assets using the `none` delivery channel
Use fluent validation for images via PATCH, include new PATCH and PUT
 specific rules

Change ModifyAssetTests that involve updating existing assets to include
 delivery channels

use PUT HydraImageValidator rules in PutImage

Make `AssetBeforeProcessing.DeliveryChannelsBeforeProcessing` nullable

Include PUT rules in validator for queued images

Add DeliveryChannel_ValidationError_WhenEmpty_OnPatch test to
HydraImageValidatorTests

Add ModifyAssetTests tests ensuring that null or empty delivery channels
cannot be specified via PUT on existing assets, and empty channels cannot
be specified via PATCH

Add ImageBatchPatchValidator test that ensures that delivery channels cannot be specified
Use has sufficiently diverged that refactoring to remove base caching
class in favour of helper makes sense. Simplifies use of asset repo in
api
Introduced new class to manage reconciliation of changes submitted
when updating. Update Delivery channel repos to be async
Removed 'virtual' keyword from DeliveryChannelPolicy as not using
lazyLoading or change-tracking proxy
@donaldgray donaldgray changed the title Feature/none channel func Allow DeliveryChannels to be modified Mar 27, 2024
@donaldgray donaldgray marked this pull request as ready for review March 27, 2024 17:19
@donaldgray donaldgray requested a review from a team as a code owner March 27, 2024 17:19
@donaldgray donaldgray merged commit 4ad3034 into develop Mar 28, 2024
9 checks passed
@donaldgray donaldgray deleted the feature/none_channel_func branch March 28, 2024 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for changing an existing asset's deliveryChannels + implement "channel":"none" functionality
3 participants