softDelete() provider should not inherit from original params · Issue #600 · feathersjs-ecosystem/feathers-hooks-common · GitHub
Skip to content

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

Closed

Description

@rodeyseijkens

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.

Activity

  1. Aschmider24 commented on Jul 30, 2024

    @Aschmider24

    +1 on this featuree if this is not too late.

    I think the second implementation leaves the user more flexibility.

  2. fratzinger commented on Feb 18, 2025

    @fratzinger
    Collaborator

    Just a quick headsup. I started working on a massive rewrite of the package (#764). It's not released yet and will take a few weeks.

    See https://github.com/feathersjs-ecosystem/feathers-hooks-common/blob/modernize/src/hooks/soft-delete/soft-delete.ts I added an option transformParams where you can change the params however you need to.

  3. fratzinger commented on Sep 8, 2026

    @fratzinger
    Collaborator

    This is supported by the official successor: "feathers-utils". See https://utils.feathersjs.com/hooks/soft-delete.html

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions