Skip to content

Commit

Permalink
Fixes Sony Ci Webhook endpoint
Browse files Browse the repository at this point in the history
Uses AssetResource model instead of Asset model to lookup the Asset.
Saves updated Asset in the new Valkyrie way.
  • Loading branch information
afred committed Feb 6, 2024
1 parent 64e7139 commit 34e2fd2
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions app/controllers/sony_ci/webhooks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ class WebhooksController < ::APIController

def save_sony_ci_id
asset.admin_data.update!( sonyci_id: [ sony_ci_id ] )
# Re-save the Asset to re-index it.
# TODO: Is there a faster way to save the Sony Ci ID to the AdminData and
# re-index the Asset?
asset.save!
Hyrax.index_adapter.save(resource: asset)
render status: 200,
json: {
message: "success",
Expand All @@ -32,7 +29,7 @@ def save_sony_ci_id
private

def asset
@asset ||= Asset.find(guid_from_sony_ci_filename)
@asset ||= AssetResource.find(guid_from_sony_ci_filename)
end

# Returns the assumed GUID from the Sony Ci Filename.
Expand Down

0 comments on commit 34e2fd2

Please sign in to comment.