Added the list commands for both tasks and projects.

This commit is contained in:
Dan
2024-05-04 17:06:30 -04:00
parent 4599f49e84
commit e8ce8575e8
2 changed files with 55 additions and 2 deletions

View File

@@ -50,4 +50,16 @@ async def update_task(task_id, description, assignee, deadline, status, priority
deadline_date = datetime.strptime(deadline, "%m/%d/%Y").date()
await db.execute("UPDATE tasks SET description=?, assignee=?, deadline=?, status=?, priority=? WHERE id=?",
(description, assignee, deadline_date, status, priority, task_id))
await db.commit()
await db.commit()
async def list_projects():
async with aiosqlite.connect(DATABASE) as db:
cursor = await db.execute("SELECT id, name, description FROM projects")
projects = await cursor.fetchall()
return projects
async def list_tasks_for_project(project_id):
async with aiosqlite.connect(DATABASE) as db:
cursor = await db.execute("SELECT id, description, assignee, deadline, status, priority FROM tasks WHERE project_id = ?", (project_id,))
tasks = await cursor.fetchall()
return tasks