mirror of
https://github.com/strapi/strapi.git
synced 2026-01-03 10:46:21 +00:00
Route count uploads
This commit is contained in:
parent
9ef00e217d
commit
44ec9e9e02
@ -16,6 +16,14 @@
|
||||
"policies": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/files/count",
|
||||
"handler": "Upload.count",
|
||||
"config": {
|
||||
"policies": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "DELETE",
|
||||
"path": "/files/:_id",
|
||||
|
||||
@ -44,6 +44,15 @@ module.exports = {
|
||||
}));
|
||||
},
|
||||
|
||||
count: async (ctx, next) => {
|
||||
const data = await strapi.plugins['upload'].services.upload.count(ctx.query);
|
||||
|
||||
// Send 200 `ok`
|
||||
ctx.send({
|
||||
count: data
|
||||
});
|
||||
},
|
||||
|
||||
destroy: async (ctx, next) => {
|
||||
const data = await strapi.plugins['upload'].services.upload.remove(ctx.params);
|
||||
|
||||
|
||||
@ -91,6 +91,10 @@ module.exports = {
|
||||
return strapi.query('file', 'upload').find(strapi.utils.models.convertParams('file', params));
|
||||
},
|
||||
|
||||
count: async (params, source) => {
|
||||
return await strapi.query('file', 'upload').count();
|
||||
},
|
||||
|
||||
remove: async params => {
|
||||
const {url} = await strapi.plugins['upload'].services.upload.fetch(params);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user