feat(plugin-upload): adding findOne endpoint

This commit is contained in:
Luca Perret 2018-04-09 19:31:49 +02:00
parent 648bf52a3c
commit 19f0494650
2 changed files with 17 additions and 0 deletions

View File

@ -40,6 +40,14 @@
"policies": []
}
},
{
"method": "GET",
"path": "/files/:_id",
"handler": "Upload.findOne",
"config": {
"policies": []
}
},
{
"method": "GET",
"path": "/files/count",

View File

@ -123,6 +123,15 @@ module.exports = {
}));
},
findOne: async (ctx) => {
const data = await strapi.plugins['upload'].services.upload.fetch(ctx.params);
data.url = strapi.config.url + data.url;
// Send 200 `ok`
ctx.send(data);
},
count: async (ctx, next) => {
const data = await strapi.plugins['upload'].services.upload.count(ctx.query);