- Implemented user tracking columns in project_tasks and notes tables. - Added created_by and assigned_to fields to project_tasks. - Introduced created_by field and is_system flag in notes. - Updated API endpoints to handle user tracking during task and note creation. - Enhanced database initialization to include new columns and indexes. - Created utility functions to fetch users for task assignment. - Updated front-end components to display user information for tasks and notes. - Added tests for project-tasks API endpoints to verify functionality.
26 lines
660 B
JavaScript
26 lines
660 B
JavaScript
import Database from "better-sqlite3";
|
|
|
|
const db = new Database("./data/database.sqlite");
|
|
|
|
console.log("Project Tasks table structure:");
|
|
const projectTasksSchema = db.prepare("PRAGMA table_info(project_tasks)").all();
|
|
console.table(projectTasksSchema);
|
|
|
|
console.log("\nSample project tasks with user tracking:");
|
|
const tasks = db
|
|
.prepare(
|
|
`
|
|
SELECT pt.*,
|
|
creator.name as created_by_name,
|
|
assignee.name as assigned_to_name
|
|
FROM project_tasks pt
|
|
LEFT JOIN users creator ON pt.created_by = creator.id
|
|
LEFT JOIN users assignee ON pt.assigned_to = assignee.id
|
|
LIMIT 3
|
|
`
|
|
)
|
|
.all();
|
|
console.table(tasks);
|
|
|
|
db.close();
|