feathersjs/feathers

[Suggestion] ability to allow `multi` queries for internal calls only

1valdis opened this issue · 3 comments

Currently by default, a query like

await context.app.service('profiles').remove(null, {
  query: {
    user_id: context.id,
  },
});

won't work unless profiles service has multi option allowing multi delete. Yet, having that allowed, Feathers "authomatically" allows for multi delete external call on profiles, which is suboptimal. I think it could be useful if there were not only "true" and "false" options for multi, but also either a list of providers allowed for multi, or some other option to allow for internal multi call but disallow external one.

One could use feathers-hooks-common disable-multi-item-change conditionally with iff(isProvider(...)), but disable-multi-item-change is deprecated since feathers-hooks-common@5.0.0.

This is about adapters-common

It seems to me that this is already covered by _remove style methods... or am I missing something?

https://stackblitz.com/fork/feathersjs (The default template does not use an adapter... so it doesn't have the concept of multi)

daffl commented

Correct, the multi checks are done at the adapter service method level (e.g. https://github.com/feathersjs/feathers/blob/dove/packages/adapter-commons/src/service.ts#L194). So calling the underscored methods will circumvent that check.

I didn't know that underscored methods allow for multi calls even if a service has them disabled. Is this mentioned somewhere in the docs? I'm pretty sure I read everything there is for multi option but there was no such note. Might be worth adding?