aboutsummaryrefslogtreecommitdiffstats
path: root/dist/main/db/projects.js
diff options
context:
space:
mode:
Diffstat (limited to 'dist/main/db/projects.js')
-rw-r--r--dist/main/db/projects.js28
1 files changed, 0 insertions, 28 deletions
diff --git a/dist/main/db/projects.js b/dist/main/db/projects.js
deleted file mode 100644
index af36cc0..0000000
--- a/dist/main/db/projects.js
+++ /dev/null
@@ -1,28 +0,0 @@
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.listProjects = listProjects;
4exports.getProject = getProject;
5exports.createProject = createProject;
6exports.deleteProject = deleteProject;
7const index_1 = require("./index");
8const uuid_1 = require("uuid");
9function listProjects() {
10 return (0, index_1.getDb)()
11 .prepare("SELECT * FROM projects ORDER BY updated_at DESC")
12 .all();
13}
14function getProject(id) {
15 return (0, index_1.getDb)()
16 .prepare("SELECT * FROM projects WHERE id = ?")
17 .get(id);
18}
19function createProject(name, projectPath) {
20 const db = (0, index_1.getDb)();
21 const id = (0, uuid_1.v4)();
22 const now = Math.floor(Date.now() / 1000);
23 db.prepare("INSERT INTO projects (id, name, path, created_at, updated_at) VALUES (?, ?, ?, ?, ?)").run(id, name, projectPath, now, now);
24 return { id, name, path: projectPath, created_at: now, updated_at: now };
25}
26function deleteProject(id) {
27 (0, index_1.getDb)().prepare("DELETE FROM projects WHERE id = ?").run(id);
28}