feat: Enhance project task management with expandable notes and descriptions, and add date_started column for task tracking
This commit is contained in:
@@ -90,12 +90,35 @@ export function createProjectTask(data) {
|
||||
|
||||
// Update project task status
|
||||
export function updateProjectTaskStatus(taskId, status) {
|
||||
const stmt = db.prepare(`
|
||||
UPDATE project_tasks
|
||||
SET status = ?
|
||||
WHERE id = ?
|
||||
`);
|
||||
return stmt.run(status, taskId);
|
||||
// First get the current status to check if we're transitioning from pending to in_progress
|
||||
const getCurrentStatus = db.prepare(
|
||||
"SELECT status FROM project_tasks WHERE id = ?"
|
||||
);
|
||||
const currentTask = getCurrentStatus.get(taskId);
|
||||
|
||||
let stmt;
|
||||
|
||||
if (
|
||||
currentTask &&
|
||||
currentTask.status === "pending" &&
|
||||
status === "in_progress"
|
||||
) {
|
||||
// Starting a task - set date_started
|
||||
stmt = db.prepare(`
|
||||
UPDATE project_tasks
|
||||
SET status = ?, date_started = CURRENT_TIMESTAMP
|
||||
WHERE id = ?
|
||||
`);
|
||||
return stmt.run(status, taskId);
|
||||
} else {
|
||||
// Just updating status without changing date_started
|
||||
stmt = db.prepare(`
|
||||
UPDATE project_tasks
|
||||
SET status = ?
|
||||
WHERE id = ?
|
||||
`);
|
||||
return stmt.run(status, taskId);
|
||||
}
|
||||
}
|
||||
|
||||
// Delete a project task
|
||||
|
||||
Reference in New Issue
Block a user