preserve stuff before trying something craz

This commit is contained in:
2020-06-15 23:49:53 -06:00
parent 9ace341ce4
commit 3505b16169
8 changed files with 354 additions and 18 deletions

View File

@ -1,5 +1,9 @@
import * as path from 'path';
import simmer from './simmer-def-example';
const ncp = require('ncp').ncp;
// import defs from './example-def';
import defs from './example-def';
declare var __dirname: any;
function createDatabase(storageDef: StorageDef) {
let tableCreationQueries: string[] = [];
@ -66,7 +70,15 @@ function getTableRelationsCreationString(relationsDef: ManyToManyDef): string {
}
createDatabase(defs.storage);
ncp(path.join(__dirname, 'frame'), path.join(__dirname, 'test'), (err: any) => {
if (err) {
console.log(err);
} else {
console.log('success copying files');
}
});
createDatabase(simmer.storage);
@ -74,6 +86,7 @@ createDatabase(defs.storage);
interface SystemDef {
storage: StorageDef;
views: ViewDef[];
// TODO: add Views, ACLs, Behaviors, UX
}
@ -82,6 +95,28 @@ interface StorageDef {
relations: ManyToManyDef[];
}
interface ViewDef {
component: string;
type: ('list' | 'count' | 'item' | 'distinct')[];
columns: string[];
orderBy?: Order[];
filters?: Filter[];
// if type is 'list' it will always include skip and limit for pagination
}
interface Order {
column: string;
direction: 'asc' | 'desc';
}
interface Filter {
param: string; // the query param used to get the value
column: string;
comparison: '=' | '!=' | '>' | '<' | 'contains';
value?: string;
required?: boolean;
}
interface TableDef {
name: string;
columns: ColumnDef[],