mirror of
https://github.com/strapi/strapi.git
synced 2025-09-20 14:00:48 +00:00
Merge branch 'releases/v4' of github.com:strapi/strapi into webhooks/add-combobox
This commit is contained in:
commit
6d8b85ecaf
@ -103,6 +103,7 @@ const pickPopulateParams = _.pick([
|
||||
'orderBy',
|
||||
'limit',
|
||||
'offset',
|
||||
'filters',
|
||||
]);
|
||||
|
||||
// TODO: cleanup code
|
||||
@ -123,8 +124,8 @@ const applyPopulate = async (results, populate, ctx) => {
|
||||
const targetMeta = db.metadata.get(attribute.target);
|
||||
|
||||
const populateValue = {
|
||||
...pickPopulateParams(populate[key]),
|
||||
filters: qb.state.filters,
|
||||
...pickPopulateParams(populate[key]),
|
||||
};
|
||||
|
||||
const isCount = populateValue.count === true;
|
||||
|
@ -60,23 +60,6 @@ module.exports = {
|
||||
ctx.body = pm.sanitize(file, { withPrivate: false });
|
||||
},
|
||||
|
||||
async count(ctx) {
|
||||
const pm = strapi.admin.services.permission.createPermissionsManager({
|
||||
ability: ctx.state.userAbility,
|
||||
action: ACTIONS.read,
|
||||
model: fileModel,
|
||||
});
|
||||
|
||||
if (!pm.isAllowed) {
|
||||
return ctx.forbidden();
|
||||
}
|
||||
|
||||
const query = pm.addPermissionsQueryTo(ctx.query);
|
||||
const count = await getService('upload').count(query);
|
||||
|
||||
ctx.body = { count };
|
||||
},
|
||||
|
||||
async destroy(ctx) {
|
||||
const { id } = ctx.params;
|
||||
const { userAbility } = ctx.state;
|
||||
|
@ -43,22 +43,6 @@ module.exports = {
|
||||
policies: ['admin::isAuthenticatedAdmin'],
|
||||
},
|
||||
},
|
||||
{
|
||||
method: 'GET',
|
||||
path: '/files/count',
|
||||
handler: 'admin-api.count',
|
||||
config: {
|
||||
policies: [
|
||||
'admin::isAuthenticatedAdmin',
|
||||
{
|
||||
name: 'admin::hasPermissions',
|
||||
config: {
|
||||
actions: ['plugin::upload.read'],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
method: 'GET',
|
||||
path: '/files',
|
||||
|
@ -310,10 +310,6 @@ module.exports = ({ strapi }) => ({
|
||||
return strapi.entityService.findPage('plugin::upload.file', query);
|
||||
},
|
||||
|
||||
count(query) {
|
||||
return strapi.entityService.count('plugin::upload.file', query);
|
||||
},
|
||||
|
||||
async remove(file) {
|
||||
const config = strapi.config.get('plugin.upload');
|
||||
|
||||
|
@ -162,7 +162,6 @@ describe('Upload plugin end to end tests', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test.todo('GET /upload/files/count => Count available files');
|
||||
test.todo('GET /upload/files/:id => Find one file');
|
||||
test.todo('GET /upload/search/:id => Search files');
|
||||
test.todo('DELETE /upload/files/:id => Delete a file');
|
||||
|
Loading…
x
Reference in New Issue
Block a user