"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.listProjects = listProjects; exports.getProject = getProject; exports.createProject = createProject; exports.deleteProject = deleteProject; const index_1 = require("./index"); const uuid_1 = require("uuid"); function listProjects() { return (0, index_1.getDb)() .prepare("SELECT * FROM projects ORDER BY updated_at DESC") .all(); } function getProject(id) { return (0, index_1.getDb)() .prepare("SELECT * FROM projects WHERE id = ?") .get(id); } function createProject(name, projectPath) { const db = (0, index_1.getDb)(); const id = (0, uuid_1.v4)(); const now = Math.floor(Date.now() / 1000); db.prepare("INSERT INTO projects (id, name, path, created_at, updated_at) VALUES (?, ?, ?, ?, ?)").run(id, name, projectPath, now, now); return { id, name, path: projectPath, created_at: now, updated_at: now }; } function deleteProject(id) { (0, index_1.getDb)().prepare("DELETE FROM projects WHERE id = ?").run(id); }