feat: implement dynamic database connection service with MySQL driver and API schema endpoints

This commit is contained in:
Ümit Tunç
2026-04-24 07:21:59 +03:00
parent 1a75c32469
commit ce67df1067
12 changed files with 417 additions and 78 deletions
+16
View File
@@ -1,10 +1,22 @@
import { create } from 'zustand';
interface ConnectionConfig {
host: string;
username: string;
password?: string;
port: number;
database?: string;
}
interface AppState {
darkMode: boolean;
activeDatabase: string | null;
activeTable: string | null;
connection: ConnectionConfig | null;
connected: boolean;
toggleDarkMode: () => void;
setConnection: (config: ConnectionConfig) => void;
clearConnection: () => void;
setActiveDatabase: (db: string | null) => void;
setActiveTable: (table: string | null) => void;
}
@@ -13,7 +25,11 @@ export const useAppStore = create<AppState>((set) => ({
darkMode: true,
activeDatabase: null,
activeTable: null,
connection: null,
connected: false,
toggleDarkMode: () => set((state) => ({ darkMode: !state.darkMode })),
setConnection: (config) => set({ connection: config, connected: true }),
clearConnection: () => set({ connection: null, connected: false, activeDatabase: null, activeTable: null }),
setActiveDatabase: (db) => set({ activeDatabase: db, activeTable: null }),
setActiveTable: (table) => set({ activeTable: table }),
}));