@ -70,6 +70,7 @@ class Xsql {
this . metaDb . tables [ tableName ] [ 'foreignKeys' ] = [ ]
this . metaDb . tables [ tableName ] [ 'columns' ] = [ ]
this . metaDb . tables [ tableName ] [ 'indicies' ] = [ ]
this . metaDb . tables [ tableName ] [ 'isView' ] = schemaRow [ 'table_name' ] [ 'isView' ]
}
}
}
@ -520,9 +521,9 @@ class Xsql {
let routes = [ ]
let tableObj = { }
let table = this . metaDb . tables [ tableName ] ;
let isView = this . metaDb . tables [ tableName ] [ 'isView' ] ;
tableObj [ 'resource' ] = tableName ;
routes . push ( this . prepareRoute ( internal , 'get' , apiPrefix , tableName + '/describe' , 'describe' ) )
routes . push ( this . prepareRoute ( internal , 'get' , apiPrefix , tableName + '/count' , 'count' ) )
routes . push ( this . prepareRoute ( internal , 'get' , apiPrefix , tableName + '/groupby' , 'groupby' ) )
@ -530,15 +531,25 @@ class Xsql {
routes . push ( this . prepareRoute ( internal , 'get' , apiPrefix , tableName + '/chart' , 'chart' ) )
routes . push ( this . prepareRoute ( internal , 'get' , apiPrefix , tableName + '/aggregate' , 'aggregate' ) )
routes . push ( this . prepareRoute ( internal , 'get' , apiPrefix , tableName + '/findOne' , 'findOne' ) )
if ( ! isView ) {
routes . push ( this . prepareRoute ( internal , 'post' , apiPrefix , tableName , 'create' ) )
}
routes . push ( this . prepareRoute ( internal , 'get' , apiPrefix , tableName , 'list' ) )
if ( ! isView ) {
routes . push ( this . prepareRoute ( internal , 'post' , apiPrefix , tableName + '/bulk' , 'bulkInsert' ) )
routes . push ( this . prepareRoute ( internal , 'get' , apiPrefix , tableName + '/bulk' , 'bulkRead' ) )
routes . push ( this . prepareRoute ( internal , 'delete' , apiPrefix , tableName + '/bulk' , 'bulkDelete' ) )
}
routes . push ( this . prepareRoute ( internal , 'get' , apiPrefix , tableName + '/bulk' , 'bulkRead' ) )
if ( ! isView ) {
routes . push ( this . prepareRoute ( internal , 'put' , apiPrefix , tableName , 'update' ) )
routes . push ( this . prepareRoute ( internal , 'get' , apiPrefix , tableName + '/:id' , 'read' ) )
routes . push ( this . prepareRoute ( internal , 'patch' , apiPrefix , tableName + '/:id' , 'patch' ) )
routes . push ( this . prepareRoute ( internal , 'delete' , apiPrefix , tableName + '/:id' , 'delete' ) )
}
routes . push ( this . prepareRoute ( internal , 'get' , apiPrefix , tableName + '/:id' , 'read' ) )
routes . push ( this . prepareRoute ( internal , 'get' , apiPrefix , tableName + '/:id/exists' , 'exists' ) )
for ( var j = 0 ; j < table [ 'foreignKeys' ] . length ; ++ j ) {