GithubHelp home page GithubHelp logo

ash-project / ash_archival Goto Github PK

View Code? Open in Web Editor NEW
16.0 6.0 8.0 187 KB

An Ash extension to implement archival (soft deletion) for resources.

Home Page: https://hexdocs.pm/ash_archival

License: MIT License

Elixir 100.00%
archival ash soft-delete

ash_archival's Introduction

ash_archival's People

Contributors

dependabot[bot] avatar emtudo avatar jechol avatar jimsynz avatar michaelst avatar zachdaniel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ash_archival's Issues

Depedency elixir_sense compile failed for VSCode ElixirLS

Describe the bug
VSCode ElixirLS crashed with following message,

[Warn  - 10:21:40 AM]      error: undefined function remove_module_from_namespace/2 (expected ElixirSense.Core.MetadataBuilder to define such a function or for it to be imported, but none are available)
     │
 118 │     |> remove_module_from_namespace(module)
     │        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     │
     └─ (elixir_sense 2.0.0) lib/elixir_sense/core/metadata_builder.ex:118:8: ElixirSense.Core.MetadataBuilder.post_module/3

To Reproduce

git clone
mix deps.get
code .

Expected behavior
ElixirLS not crash.

** Runtime

  • Elixir version : 1.16.0
  • Erlang version : 26
  • OS : macOS Sonoma 14.3
  • Ash version : 2.14.21
  • any related extension versions

Additional context
Add any other context about the problem here.

Upsert doesn't work with ash_archival v1

Describe the bug

ash_archival v1 don't use base_filter anymore, but ash_postgres depends on it.

https://github.com/ash-project/ash_postgres/blob/49548bb964fe60364de0f2dcbe60d4b65286e66e/lib/data_layer.ex#L2370C1-L2387C6

So, it misses WHERE archived_at IS NULL from ON CONFLICT condition.

To Reproduce

Expected behavior

Upsert works with ash_archival

** Runtime

  • Elixir version: 16.1
  • Erlang version: 26
  • OS: Mac
  • Ash version: 3.0.0-rc31
  • any related extension versions
    • Ash Archival: 1.0.0-rc.0
    • Ash Postgres: 2.0.0-rc.11

Additional context

[ash] Actor is missing on cascading archive.

Describe the bug
When the has_many relationship is set up as Author -> Post -> Comment and the destroy action can only be executed when the actor is an admin for all, an error occurs when archiving the Author because the actor is not set when archiving the Post. While I addressed this issue in my #6, the actor still remains unset when attempting to delete a Comment. This seems more likely to be a bug in ash rather than ash_archival.

To Reproduce
See #6

Expected behavior
A clear and concise description of what you expected to happen.

** Runtime

  • Elixir version : 1.16.0
  • Erlang version : 26
  • OS : macOS Sonoma 14.3
  • Ash version : 2.14.21
  • any related extension versions

Additional context

On/Off feature for admin

Is your feature request related to a problem? Please describe.
After deleting the resource, I still need to see the resource in admin app.

Describe the solution you'd like
On/Off feature for admin.
In admin app, I want to turn off the archived_at != nil and show all resource, even if deleted.

Describe alternatives you've considered
Is this out of ash_archival's context?

Allow configuring atomic upgrade behavior

Describe the bug
I tried everything I understood in the documentation, but I was unable to unarchive the document.
Module: https://gist.github.com/emtudo/e8040203e1070e92476dbd899c40a88d
Test: https://gist.github.com/emtudo/75c75c6abdcb1601f326b542949694fd

To Reproduce
Added the action:


    update :unarchive do
      accept [:name, :domain]
      change set_attribute(:archived_at, nil)
    end
    
    ```
    and test:
    
    ```
    test "unarchives an organization" do
      organization = Organization
        |> Ash.Changeset.for_create(:create, @valid_attrs)
        |> Ash.create!()

      organization
        |> Ash.Changeset.for_destroy(:destroy)
        |> Ash.destroy!()

      archived_organization = Organization
        |> Ash.Query.for_read(:by_id, %{id: organization.id})
        |> Ash.read_one!()

      IO.inspect(archived_organization, label: "organization xx")

      unarchived_organization =  archived_organization
        |> Ash.Changeset.for_update(:unarchive, @update_attrs)
        # |> Ash.update!()

      IO.inspect(unarchived_organization, label: "unarchived_organization")
      # assert unarchived_organization.id == organization.id

      fetched_organization = Organization
        |> Ash.Query.for_read(:archived_by_id, %{id: organization.id})
        |> Ash.read_one!()
      IO.inspect(fetched_organization, label: "fetched XX")
    end

and fetched_organization it is returns nil, but it should returns a data

Expected behavior
A clear and concise description of what you expected to happen.

** Runtime

  • Elixir 1.16.2
  • Erlang 26
  • OS Linux Ubuntu 22.04
  • Ash 3.0
  • ash_archival 1.0

Additional context
A clear and concise description of what you expected to happen.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.