mirror of
https://github.com/strapi/strapi.git
synced 2025-12-26 06:35:47 +00:00
feat(plugin-upload): adding findOne endpoint
This commit is contained in:
parent
648bf52a3c
commit
19f0494650
@ -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