refactor: setup project wizards with only three steps

This commit is contained in:
Haileyesus
2026-03-27 22:16:56 +03:00
parent ec70bfe7c7
commit 6cfe617711
19 changed files with 332 additions and 563 deletions

View File

@@ -2,13 +2,18 @@ import { getConnection } from '@/shared/database/connection.js';
import type { WorkspaceOriginalPathRow } from '@/shared/database/types.js';
export const workspaceOriginalPathsDb = {
createWorkspacePath(workspacePath: string): void {
createWorkspacePath(workspacePath: string, customWorkspaceName: string | null = null): void {
const db = getConnection();
db.prepare(`
INSERT INTO workspace_original_paths (workspace_path)
VALUES (?)
ON CONFLICT(workspace_path) DO NOTHING
`).run(workspacePath);
INSERT INTO workspace_original_paths (workspace_path, custom_workspace_name)
VALUES (?, ?)
ON CONFLICT(workspace_path) DO UPDATE SET
custom_workspace_name = CASE
WHEN workspace_original_paths.custom_workspace_name IS NULL OR workspace_original_paths.custom_workspace_name = ''
THEN excluded.custom_workspace_name
ELSE workspace_original_paths.custom_workspace_name
END
`).run(workspacePath, customWorkspaceName);
},
getCustomWorkspaceName(workspacePath: string): string | null {
@@ -30,4 +35,4 @@ export const workspaceOriginalPathsDb = {
ON CONFLICT(workspace_path) DO UPDATE SET custom_workspace_name = excluded.custom_workspace_name
`).run(workspacePath, customWorkspaceName);
},
}
};