moleculerjs / database

Advanced Database Access Service for Moleculer microservices framework
MIT License
32 stars 15 forks source link

Fix opts scope and softDelete #43

Closed brasiqui closed 1 year ago

brasiqui commented 1 year ago

Hi, This params are necessary because we are using scopes and soft delete. If a document is flagged for deletion and I want to permanently remove, then I need to disable the default scope, otherwise the record will not be found.

Please, verify.

Roni Cruz

devalexandre commented 1 year ago

I think this can be done in another way without having to change the core.

brasiqui commented 1 year ago

I think this can be done in another way without having to change the core.

The opts.sofDelete and opts.scope already exists in internal methods, but never called by standard actions. The idea is expose them as params in the standard action. But if this is intentional, then another way is creating a custom remove, update, and replace action.

icebob commented 1 year ago

It's intentional. If you create a public CRUD API with this library, you won't be happy if the client/frontend can change the delete logic from soft to real or can skip the default scopes (e.g. a tenant scope). If you want your use-case, better if you create a new realDelete action with extra permissions...etc and call the internal methods.