backend/app/routing/routers/api/v1/page.routes.js
garrettmills bebdd504dd
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
Noded/frontend#84 - make welcome page redirect to SPA by default
2021-02-15 19:06:51 -06:00

84 lines
2.7 KiB
JavaScript

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',
],
// Get a particular node present on the specified page
'/:PageId/nodes/:NodeId': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'view' }],
'controller::api:v1:Page.get_node',
],
},
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',
],
},
}