51 lines
1.0 KiB
TypeScript
51 lines
1.0 KiB
TypeScript
interface SystemDef {
|
|
storage: StorageDef;
|
|
views: ViewDef[];
|
|
}
|
|
interface StorageDef {
|
|
tables: TableDef[];
|
|
relations: ManyToManyDef[];
|
|
}
|
|
interface ViewDef {
|
|
component: string;
|
|
type: ('list' | 'count' | 'item' | 'distinct')[];
|
|
columns: string[];
|
|
orderBy?: Order[];
|
|
filters?: Filter[];
|
|
}
|
|
interface Order {
|
|
column: string;
|
|
direction: 'asc' | 'desc';
|
|
}
|
|
interface Filter {
|
|
param: string;
|
|
column: string;
|
|
comparison: '=' | '!=' | '>' | '<' | 'contains';
|
|
value?: string;
|
|
required?: boolean;
|
|
}
|
|
interface TableDef {
|
|
name: string;
|
|
columns: ColumnDef[];
|
|
relations: BelongsToDef[];
|
|
}
|
|
interface ColumnDef {
|
|
name: string;
|
|
type: "blob" | "boolean" | "date" | "dateTIME" | "number" | "string";
|
|
nullable: boolean;
|
|
unique?: boolean;
|
|
autoIncrement?: boolean;
|
|
default?: string;
|
|
}
|
|
interface BelongsToDef {
|
|
type: 'belongs-to';
|
|
table: string;
|
|
}
|
|
interface ManyToManyDef {
|
|
left: string;
|
|
relation: 'many-to-many';
|
|
right: string;
|
|
columns?: ColumnDef[];
|
|
}
|
|
export { SystemDef };
|