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

Feature request: Soft delete #2944

Closed
gfpacheco opened this issue Oct 26, 2016 · 6 comments
Closed

Feature request: Soft delete #2944

gfpacheco opened this issue Oct 26, 2016 · 6 comments

Comments

@gfpacheco
Copy link

(I did a little research but found nothing regarding this topic)

Would be awesome if parse-server comes with a bundled solution for soft-delete implementation.

Something like a column name config, and then all entities would use it by default to implement the soft-delete mechanism. Where all find queries would automatically add this clause and all destroy requests would set this "flag", except when explicitly told not to do so.

Have you guys thought about it? What do you think?

In an ideal project it wouldn't be hard to implement. But I'm not intimate with parse-server's source code to see what could prevent an easy solution.

@flovilmart
Copy link
Contributor

Just put a fully closed ACL.

@gfpacheco
Copy link
Author

I can see that could work, but I can also see cases where it doesn't help:

Imagine an Address entity, attached to a user by a pointer.

Now imagine an Order entity, attached to two users (the buyer and the seller) and also attached to an Address (from the buyer).

After sending the order, the buyer resolves to delete the address he used. He shouldn't see that address never again.

But the seller needs to be able to see the address where he's supposed to ship the order.

I can imagine a solution where I add a new ACL so every seller can read every Address he's ever shipped to. But I think it wouldn't work for long, right?

@flovilmart
Copy link
Contributor

So that's not a soft delete problem, If you need to detach the address state from the owner you should do embedding instead of pointers. You seem to have a very particular use case where you want an object not to be seen by a part but available to another part. Which is not something that make sense to bake into the server itself.

We try to not build features on special use cases but general ones.

@flovilmart
Copy link
Contributor

And how you described it, :

Address is

  • read / Write for the buyer,
  • read for the seller (the seller should not update that address)

When the buyer 'deletes' the address, it marks is as non-readable for himself. Which leave the seller able to read it.

Then if there is an Order, the address should be frozen into the order, not pointed to.

@gfpacheco
Copy link
Author

Ok, maybe my case is too specific, and it's not a soft delete problem. And you're right, the shipping address should be frozen (I'll solve it by cloning the address).

But I still think that soft delete isn't just a case-specific need. It is a common pattern for not losing historical data and should help many developers.

Feel free to close this issue since it's not exactly my problem, but I think may be someone else's.

@flovilmart
Copy link
Contributor

Again, the best solution for now to hide some data from the users would be to mark the ACL as completely closed, that's what's as closed a possible from the soft delete. I'm not sure adding an additional flag would help.

I agree that delete is dangerous, but CLP are here to prevent users from Deleting data.

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

No branches or pull requests

2 participants