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

arc_ecto: Create changeset step to auto-delete images #166

Closed
eteubert opened this issue Jul 18, 2019 · 0 comments
Closed

arc_ecto: Create changeset step to auto-delete images #166

eteubert opened this issue Jul 18, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@eteubert
Copy link
Member

When an entity with an ecto attribute is updated or deleted, the attached image must be deleted as well. There must be no images stored that are not referenced by any entity.

It should be implemented as a generic changeset function that can be reused by all entities. Pseudo code:

  def changeset(entity, attrs) do
    entity
    |> cast(attrs, [...])
    |> maybe_delete_existing_attachments(attrs, [:image])
    |> cast_attachments(attrs, [:image], allow_paths: true, allow_urls: true)
  end

Requirements:

  • remove image when deleting entity
  • remove previous image when updating entity with new image
  • do not remove image if changeset is invalid

See also:

@eteubert eteubert added the enhancement New feature or request label Jul 18, 2019
@sorax sorax closed this as not planned Won't fix, can't repro, duplicate, stale Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants