mirror of
https://github.com/strapi/strapi.git
synced 2025-09-21 14:31:16 +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',
|
'orderBy',
|
||||||
'limit',
|
'limit',
|
||||||
'offset',
|
'offset',
|
||||||
|
'filters',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// TODO: cleanup code
|
// TODO: cleanup code
|
||||||
@ -123,8 +124,8 @@ const applyPopulate = async (results, populate, ctx) => {
|
|||||||
const targetMeta = db.metadata.get(attribute.target);
|
const targetMeta = db.metadata.get(attribute.target);
|
||||||
|
|
||||||
const populateValue = {
|
const populateValue = {
|
||||||
...pickPopulateParams(populate[key]),
|
|
||||||
filters: qb.state.filters,
|
filters: qb.state.filters,
|
||||||
|
...pickPopulateParams(populate[key]),
|
||||||
};
|
};
|
||||||
|
|
||||||
const isCount = populateValue.count === true;
|
const isCount = populateValue.count === true;
|
||||||
|
@ -60,23 +60,6 @@ module.exports = {
|
|||||||
ctx.body = pm.sanitize(file, { withPrivate: false });
|
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) {
|
async destroy(ctx) {
|
||||||
const { id } = ctx.params;
|
const { id } = ctx.params;
|
||||||
const { userAbility } = ctx.state;
|
const { userAbility } = ctx.state;
|
||||||
|
@ -43,22 +43,6 @@ module.exports = {
|
|||||||
policies: ['admin::isAuthenticatedAdmin'],
|
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',
|
method: 'GET',
|
||||||
path: '/files',
|
path: '/files',
|
||||||
|
@ -310,10 +310,6 @@ module.exports = ({ strapi }) => ({
|
|||||||
return strapi.entityService.findPage('plugin::upload.file', query);
|
return strapi.entityService.findPage('plugin::upload.file', query);
|
||||||
},
|
},
|
||||||
|
|
||||||
count(query) {
|
|
||||||
return strapi.entityService.count('plugin::upload.file', query);
|
|
||||||
},
|
|
||||||
|
|
||||||
async remove(file) {
|
async remove(file) {
|
||||||
const config = strapi.config.get('plugin.upload');
|
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/files/:id => Find one file');
|
||||||
test.todo('GET /upload/search/:id => Search files');
|
test.todo('GET /upload/search/:id => Search files');
|
||||||
test.todo('DELETE /upload/files/:id => Delete a file');
|
test.todo('DELETE /upload/files/:id => Delete a file');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user