backend/app/routing/routers/api/v1/files.routes.js
garrettmills 22611612e5
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
Fix upload routes & PageId reference
2020-11-15 10:59:03 -06:00

47 lines
1.6 KiB
JavaScript

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: {
// Upload the file in the 'uploaded_file' key to the specified file ref node
'/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',
],
},
}