Skip to content

Commit

Permalink
Merge pull request #603 from davidebriani/fetch-specific-change-inste…
Browse files Browse the repository at this point in the history
…ad-of-applying-all-attributes

BaseImage: prefer Ash.Changeset.fetch_change/2 to apply_attributes/1
  • Loading branch information
rbino committed Sep 25, 2024
2 parents 95e286b + 84f9e6b commit a5c8731
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ defmodule Edgehog.BaseImages.BaseImage.Changes.HandleFileUpload do
defp upload_file(changeset, file) do
tenant_id = changeset.to_tenant

{:ok, base_image} = Ash.Changeset.apply_attributes(changeset)
{:ok, base_image_version} = Ash.Changeset.fetch_change(changeset, :version)

{:ok, base_image_collection_id} =
Ash.Changeset.fetch_argument(changeset, :base_image_collection_id)

case @storage_module.store(tenant_id, base_image_collection_id, base_image.version, file) do
case @storage_module.store(tenant_id, base_image_collection_id, base_image_version, file) do
{:ok, file_url} ->
changeset
|> Ash.Changeset.force_change_attribute(:url, file_url)
Expand Down

0 comments on commit a5c8731

Please sign in to comment.