backend/app/routing/routers/api/v1/db.routes.js
garrettmills 42b7ccad7f
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
Create data injection middleware and start centralizing lookups
2020-11-11 13:54:20 -06:00

67 lines
2.4 KiB
JavaScript

module.exports = exports = {
prefix: '/api/v1/db',
middleware: [],
get: {
// Get the database ref node config for the specified database
'/:PageId/:NodeId/get/:DatabaseId': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'view' }],
'controller::api:v1:FormDatabase.get_config',
],
// Get the column config records for the specified database
'/:PageId/:NodeId/get/:DatabaseId/columns': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'view' }],
'controller::api:v1:FormDatabase.get_columns',
],
// Get the row records for the specified database
'/:PageId/:NodeId/get/:DatabaseId/data': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'view' }],
'controller::api:v1:FormDatabase.get_data',
],
},
post: {
// Create a new database ref config
'/:PageId/:NodeId/create': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'update' }],
'controller::api:v1:FormDatabase.create_new',
],
// Set the column configs for a database ref
'/:PageId/:NodeId/set/:DatabaseId/columns': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'update' }],
'controller::api:v1:FormDatabase.set_columns',
],
// Set the database name
'/:PageId/:NodeId/set/:DatabaseId/Name': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'update' }],
'controller::api:v1:FormDatabase.set_name',
],
// Delete the specified database ref
'/:PageId/:NodeId/drop/:DatabaseId': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'update' }],
'controller::api:v1:FormDatabase.drop_database',
],
// Set the row data for the specified database ref
'/:PageId/:NodeId/set/:DatabaseId/data': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'update' }],
'controller::api:v1:FormDatabase.set_data',
],
},
}