Added the list commands for both tasks and projects.
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user