Added commands to remove projects and tasks

This commit is contained in:
Dan
2024-05-04 20:19:17 -04:00
parent 80becf1961
commit e1151f8423
2 changed files with 32 additions and 1 deletions

View File

@@ -69,3 +69,14 @@ async def list_tasks_for_project(project_id):
cursor = await db.execute("SELECT id, description, assignee, deadline, status, priority FROM tasks WHERE project_id = ?", (project_id,))
tasks = await cursor.fetchall()
return tasks
async def remove_task(task_id):
async with aiosqlite.connect(DATABASE) as db:
await db.execute("DELETE FROM tasks WHERE id = ?", (task_id,))
await db.commit()
async def remove_project(project_id):
async with aiosqlite.connect(DATABASE) as db:
await db.execute("DELETE FROM tasks WHERE project_id = ?", (project_id,)) # Remove all tasks under the project
await db.execute("DELETE FROM projects WHERE id = ?", (project_id,))
await db.commit()