add mapper builders
still needs all mapper versions but has list, create, and count working
This commit is contained in:
@ -33,7 +33,7 @@ const systemGenService = new SystemGenService();
|
||||
interface SystemDef {
|
||||
name: string;
|
||||
storage: StorageDef;
|
||||
views: ViewDef[];
|
||||
components: ComponentDef[];
|
||||
// TODO: add Views, ACLs, Behaviors, UX
|
||||
}
|
||||
|
||||
@ -42,25 +42,32 @@ interface StorageDef {
|
||||
relations: ManyToManyDef[];
|
||||
}
|
||||
|
||||
interface ViewDef {
|
||||
interface ComponentDef {
|
||||
component: string;
|
||||
type: ('list' | 'count' | 'item' | 'distinct')[];
|
||||
columns: string[];
|
||||
endpoints: EndpointDef[];
|
||||
}
|
||||
|
||||
interface EndpointDef {
|
||||
component: string;
|
||||
table: string;
|
||||
type: ('list' | 'count' | 'item' | 'distinct' | 'update' | 'create' | 'delete');
|
||||
columns: ColumnRef[];
|
||||
values?: ValueDef[];
|
||||
join?: JoinDef[];
|
||||
orderBy?: Order[];
|
||||
filters?: Filter[];
|
||||
// if type is 'list' it will always include skip and limit for pagination
|
||||
}
|
||||
|
||||
interface Order {
|
||||
column: string;
|
||||
column: ColumnRef;
|
||||
direction: 'asc' | 'desc';
|
||||
}
|
||||
|
||||
interface Filter {
|
||||
param: string; // the query param used to get the value
|
||||
column: string;
|
||||
column: ColumnRef;
|
||||
comparison: '=' | '!=' | '>' | '<' | 'contains';
|
||||
value?: string;
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
@ -79,6 +86,26 @@ interface ColumnDef {
|
||||
default?: string;
|
||||
}
|
||||
|
||||
interface ColumnRef {
|
||||
name: string;
|
||||
table: string;
|
||||
param?: string;
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
interface ValueDef {
|
||||
column: string;
|
||||
required: boolean;
|
||||
}
|
||||
|
||||
interface JoinDef {
|
||||
table: string;
|
||||
on: {
|
||||
left: ColumnRef;
|
||||
right: ColumnRef;
|
||||
}
|
||||
}
|
||||
|
||||
interface BelongsToDef {
|
||||
type: 'belongs-to';
|
||||
table: string;
|
||||
@ -92,14 +119,17 @@ interface ManyToManyDef {
|
||||
}
|
||||
|
||||
export {
|
||||
SystemDef,
|
||||
StorageDef,
|
||||
ViewDef,
|
||||
Order,
|
||||
Filter,
|
||||
TableDef,
|
||||
ColumnDef,
|
||||
BelongsToDef,
|
||||
ColumnDef,
|
||||
ColumnRef,
|
||||
ComponentDef,
|
||||
EndpointDef,
|
||||
Filter,
|
||||
JoinDef,
|
||||
ManyToManyDef,
|
||||
Order,
|
||||
StorageDef,
|
||||
SystemDef,
|
||||
TableDef,
|
||||
systemGenService
|
||||
}
|
||||
|
Reference in New Issue
Block a user