mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
Update findOne
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
This commit is contained in:
parent
5f01d9ebe1
commit
44a7e2321d
@ -35,7 +35,7 @@ module.exports = (ability, action, model) => ({
|
||||
queryFrom(query) {
|
||||
return {
|
||||
...query,
|
||||
_where: _.concat(this.query, query._where),
|
||||
_where: _.concat(this.query, query._where || {}),
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
@ -101,21 +101,15 @@ module.exports = {
|
||||
state: { userAbility },
|
||||
params: { model, id },
|
||||
} = ctx;
|
||||
const contentManagerService = strapi.plugins['content-manager'].services.contentmanager;
|
||||
const pm = strapi.admin.services.permission.createPermissionsManager(
|
||||
|
||||
const { pm, entity } = await findEntityAndCheckPermissions(
|
||||
userAbility,
|
||||
ACTIONS.read,
|
||||
model
|
||||
model,
|
||||
id
|
||||
);
|
||||
|
||||
const entry = await contentManagerService.fetch(model, id, { query: pm.query });
|
||||
|
||||
// Entry not found
|
||||
if (!entry) {
|
||||
return ctx.notFound('Entry not found');
|
||||
}
|
||||
|
||||
ctx.body = pm.sanitize(entry);
|
||||
ctx.body = pm.sanitize(entity);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -97,7 +97,7 @@ const hasDeepFilters = (whereClauses = []) => {
|
||||
return value.filter(hasDeepFilters).length > 0;
|
||||
}
|
||||
|
||||
return field.split('.').length > 1;
|
||||
return field.split('.').length > 2;
|
||||
}).length > 0
|
||||
);
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user