on the admin dashboard create a tab called "Flows" and add the estimate

This commit is contained in:
Leon Serfaty G
2025-07-18 04:51:03 +00:00
parent bf1583ba37
commit 6954cf4364
6 changed files with 388 additions and 1 deletions
+27
View File
@@ -23,6 +23,19 @@ function seed() {
)
`);
// Create flows table
db.exec(`
CREATE TABLE IF NOT EXISTS flows (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
description TEXT,
path TEXT NOT NULL,
createdAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updatedAt DATETIME DEFAULT CURRENT_TIMESTAMP
)
`);
// Check if the hourly_rate setting already exists
const settingStmt = db.prepare('SELECT * FROM settings WHERE key = ?');
const hourlyRateSetting = settingStmt.get('hourly_rate');
@@ -98,6 +111,20 @@ function seed() {
console.log('Default email template updated.');
}
// Seed default flow
const flowStmt = db.prepare('SELECT * FROM flows WHERE id = ?');
const defaultFlow = flowStmt.get(1);
if (!defaultFlow) {
const insertFlow = db.prepare(
"INSERT INTO flows (id, name, description, path) VALUES (?, ?, ?, ?)"
);
insertFlow.run(1, 'Cost Estimator', 'The main cost estimation tool for clients.', '/');
console.log('Default flow created.');
} else {
console.log('Default flow already exists.');
}
console.log('Seeding complete.');
}