mirror of
https://github.com/strapi/strapi.git
synced 2025-12-28 07:33:17 +00:00
Merge pull request #918 from lucaperret/feat/findOne-upload
Add find one file endpoint
This commit is contained in:
commit
6934661845
@ -40,6 +40,14 @@
|
||||
"policies": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/files/:_id",
|
||||
"handler": "Upload.findOne",
|
||||
"config": {
|
||||
"policies": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/files/count",
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user