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

softDelete() provider should not inherit from original params #600

Open
rodeyseijkens opened this issue Jul 1, 2020 · 0 comments
Open

Comments

@rodeyseijkens
Copy link
Contributor

rodeyseijkens commented Jul 1, 2020

const result = await service.patch(context.id, data, params);

So in the softDelete function the params.provider is inherited from the original method (remove), but it should be an internal call like it was in previous versions (feathers-plus) of softDelete, this was done by setting the provider inside of softDelete to undefined. This is better for permissions etc, cause for example people are allowed to delete (and so call the remove hook) but aren't allowed to patch.

Now the question is how will this be changed, are we adding that back by default like something:

 const result = await service.patch(context.id, data, { ...params, provider: undefined });

Or are we going to add it with a property option like:

softDelete({
  removeParams: async () => {
    return { provider: undefined };
  },
})

And merge it just like how we do with the query.

I think the removeParams is more flexible in my opinion but it is also a bit double cause we have a deletedQuery, what is technically inside the params.query.

Or maybe we should add an removeProvider function, any thoughts?

Depending whats the outcome of this is I can make a PR for either implementation.

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

1 participant