You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.6 KiB

module.exports = exports = {
prefix: '/api/v1/files',
middleware: [],
get: {
// Get the file ref node config for the specified file ref
'/:PageId/:NodeId/get/:FilesId': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'view' }],
'controller::api:v1:File.get_config',
],
// Download the specified file ID from the specified file ref node
'/:PageId/:NodeId/get/:FilesId/:FileId': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'view' }],
'controller::api:v1:File.download',
],
},
post: {
// FIXME - files, not file. Fix in front-end!
// Upload the file in the 'uploaded_file' key to the specified file ref node
'/file/upload/:PageId/:NodeId/:FilesId': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'update' }],
'middleware::upload:UploadFile',
'controller::api:v1:File.save_upload',
],
// Create a new file ref node
'/:PageId/:NodeId/create': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'update' }],
'controller::api:v1:File.create_config',
],
// Delete a file ref node and its files
'/:PageId/:NodeId/delete/:FilesId': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'update' }],
'controller::api:v1:File.delete_group',
],
},
}