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