feat: Implement task notes functionality with CRUD operations and integrate into project tasks section
This commit is contained in:
@@ -81,7 +81,6 @@ export default function initializeDatabase() {
|
||||
} catch (e) {
|
||||
// Column already exists, ignore error
|
||||
}
|
||||
|
||||
// Migration: Add description column to tasks table
|
||||
try {
|
||||
db.exec(`
|
||||
@@ -90,4 +89,13 @@ export default function initializeDatabase() {
|
||||
} catch (e) {
|
||||
// Column already exists, ignore error
|
||||
}
|
||||
|
||||
// Migration: Add description column to project_tasks table
|
||||
try {
|
||||
db.exec(`
|
||||
ALTER TABLE project_tasks ADD COLUMN custom_description TEXT;
|
||||
`);
|
||||
} catch (e) {
|
||||
// Column already exists, ignore error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,3 +12,20 @@ export function addNoteToProject(project_id, note) {
|
||||
note
|
||||
);
|
||||
}
|
||||
|
||||
export function getNotesByTaskId(task_id) {
|
||||
return db
|
||||
.prepare(`SELECT * FROM notes WHERE task_id = ? ORDER BY note_date DESC`)
|
||||
.all(task_id);
|
||||
}
|
||||
|
||||
export function addNoteToTask(task_id, note) {
|
||||
db.prepare(`INSERT INTO notes (task_id, note) VALUES (?, ?)`).run(
|
||||
task_id,
|
||||
note
|
||||
);
|
||||
}
|
||||
|
||||
export function deleteNote(note_id) {
|
||||
db.prepare(`DELETE FROM notes WHERE note_id = ?`).run(note_id);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ export function getAllProjectTasks() {
|
||||
pt.*,
|
||||
COALESCE(pt.custom_task_name, t.name) as task_name,
|
||||
COALESCE(pt.custom_max_wait_days, t.max_wait_days) as max_wait_days,
|
||||
COALESCE(pt.custom_description, t.description) as description,
|
||||
CASE
|
||||
WHEN pt.task_template_id IS NOT NULL THEN 'template'
|
||||
ELSE 'custom'
|
||||
@@ -42,6 +43,7 @@ export function getProjectTasks(projectId) {
|
||||
pt.*,
|
||||
COALESCE(pt.custom_task_name, t.name) as task_name,
|
||||
COALESCE(pt.custom_max_wait_days, t.max_wait_days) as max_wait_days,
|
||||
COALESCE(pt.custom_description, t.description) as description,
|
||||
CASE
|
||||
WHEN pt.task_template_id IS NOT NULL THEN 'template'
|
||||
ELSE 'custom'
|
||||
@@ -72,13 +74,14 @@ export function createProjectTask(data) {
|
||||
} else {
|
||||
// Creating custom task
|
||||
const stmt = db.prepare(`
|
||||
INSERT INTO project_tasks (project_id, custom_task_name, custom_max_wait_days, status, priority)
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
INSERT INTO project_tasks (project_id, custom_task_name, custom_max_wait_days, custom_description, status, priority)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
`);
|
||||
return stmt.run(
|
||||
data.project_id,
|
||||
data.custom_task_name,
|
||||
data.custom_max_wait_days || 0,
|
||||
data.custom_description || "",
|
||||
data.status || "pending",
|
||||
data.priority || "normal"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user