backend/app/routing/routers/api/v1/page.routes.js

77 lines
2.5 KiB
JavaScript
Raw Normal View History

module.exports = exports = {
prefix: '/api/v1/page',
middleware: [],
get: {
// Get the data for the specified page
'/:PageId': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'view' }],
'controller::api:v1:Page.get_page',
],
// Get the available versions of the given page
'/:PageId/versions': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'view' }],
'controller::api:v1:Page.get_page_versions',
],
// Get the nodes present on the specified page
'/:PageId/nodes': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'view' }],
'controller::api:v1:Page.get_nodes',
],
},
post: {
// Save the data for the specified page
'/:PageId/save': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'update' }],
'controller::api:v1:Page.save_page',
],
// Revert the page to a previous version
'/:PageId/versions/revert': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'manage' }],
'controller::api:v1:Page.revert_version',
],
// Save the node data for the specified page
'/:PageId/nodes/save': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'update' }],
'controller::api:v1:Page.save_nodes',
],
'/:PageId/nodes/save_one': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'update' }],
'controller::api:v1:Page.save_node_to_page',
],
// Create a new page in the personal root
'/create': [
'middleware::auth:ApiRoute',
'controller::api:v1:Page.create_top_level',
],
// Create a new page as a child of the specified page
'/create-child': [
'middleware::auth:ApiRoute',
'controller::api:v1:Page.create_child',
],
// Delete the specified page
'/delete/:PageId': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'manage' }],
'controller::api:v1:Page.delete_page',
],
},
}