strapi
strapi copied to clipboard
filter and where for findOne, update, delete
Bug report
Required System information
- Node.js version: v16.15.1
- NPM version: 8.11.0
- Strapi version: 4.2.2
- Database: mysqld Ver 5.7.33-0ubuntu0.16.04.1 for Linux on x86_64 ((Ubuntu))
- Operating system: ubuntu
Describe the bug
overriding user filter
for findOne
update
delete
https://github.com/strapi/strapi/blob/master/packages/core/strapi/lib/services/entity-service/index.js#L146
https://github.com/strapi/strapi/blob/master/packages/core/strapi/lib/services/entity-service/index.js#L197
https://github.com/strapi/strapi/blob/master/packages/core/strapi/lib/services/entity-service/index.js#L245
const query = transformParamsToQuery(uid, pickSelectionParams(wrappedParams));
return db.query(uid).findOne({ ...query, where: { id: entityId } });
code like above reset user filter state - where
is overrided
Expected behavior
parsed from query filters must be concatenated with where parameter somthing like:
query.where = query.where || {}
query.where.id = entityId
Upgrading to medium as this is becoming fairly popular on Discord.
Hi, If the issue is still open, I want to work on it. :)