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 soft-deletion ? #6

Open
Weakky opened this issue Aug 27, 2018 · 1 comment
Open

Allow soft-deletion ? #6

Weakky opened this issue Aug 27, 2018 · 1 comment

Comments

@Weakky
Copy link
Owner

Weakky commented Aug 27, 2018

In prisma-ecommerce, I have several models that I need to be soft-deleted only, such as Products so that Orders remains intact.

I see two ways of achieving this:

  • Either we add another mutation type PRISMA_SOFT_DELETE (along with the present PRISMA_CONNECT, PRISMA_CREATE etc..), and behave accordingly

  • Or we look for a special field in models (eg: deletedAt), and always soft-delete those fields.

Note: we will have to filter all subsequent queries to remove soft-deleted nodes.
(where: { deletedAt: null }

Any feedback would be much appreciated.

@m14t
Copy link

m14t commented Dec 19, 2018

I came across this issue while searching for soft-delete for ra-data-graphql. I don't want to hijack this issue, but think there might be some overlap here.

On the ra-data-graphql side of things causing the soft-delete to happen is easy since we are in control of the Mutation being called, but I suspect there may be a change needed in the core to support this.

Currently when I delete a single item from an Edit page, or bulk delete multiple items from the List page, those items are optimistically removed from the List page, and a new query is made to refresh the results.

In the normal case this would usually pull in X items from the next page, but in the soft-delete case the recently deleted items reappear.

Would it make sense to add a flag to the list view to not optimistically remove deleted items? I think this would be needed by any DataProvider wishing to support soft-delete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants