create diagram dialog, data layer

This commit is contained in:
Guy Ben-Aharon
2024-08-18 10:30:44 +03:00
parent 991bd29dc6
commit c195104a60
31 changed files with 1483 additions and 189 deletions

View File

@@ -7,12 +7,18 @@ import { DBIndex } from '@/lib/domain/db-index';
import { DBRelationship } from '@/lib/domain/db-relationship';
export interface ChartDBContext {
diagramId: string;
diagramName: string;
databaseType: DatabaseType;
tables: DBTable[];
relationships: DBRelationship[];
// General operations
updateDiagramId: (id: string) => void;
updateDiagramName: (name: string) => void;
// Database type operations
setDatabaseType: (databaseType: DatabaseType) => void;
updateDatabaseType: (databaseType: DatabaseType) => void;
// Table operations
createTable: () => DBTable;
@@ -66,11 +72,17 @@ export interface ChartDBContext {
export const chartDBContext = createContext<ChartDBContext>({
databaseType: DatabaseType.GENERIC,
diagramName: 'New Diagram',
diagramId: '',
tables: [],
relationships: [],
// General operations
updateDiagramId: emptyFn,
updateDiagramName: emptyFn,
// Database type operations
setDatabaseType: emptyFn,
updateDatabaseType: emptyFn,
// Table operations
updateTables: emptyFn,