diff --git a/src/backend/app/tasks/tasks_crud.py b/src/backend/app/tasks/tasks_crud.py index fd4066945c..a1cc26c9e3 100644 --- a/src/backend/app/tasks/tasks_crud.py +++ b/src/backend/app/tasks/tasks_crud.py @@ -50,10 +50,18 @@ async def get_task_count_in_project(db: Session, project_id: int): def get_task_lists(db: Session, project_id: int): """Get a list of tasks for a project.""" - query = f"""select id from tasks where project_id = {project_id}""" - result = db.execute(query) - tasks = [task[0] for task in result.fetchall()] - return tasks + query = text(""" + SELECT id + FROM tasks + WHERE project_id = :project_id + """) + + # Then execute the query with the desired parameter + result = db.execute(query, {"project_id": project_id}) + + # Fetch the result + task_ids = [row.id for row in result] + return task_ids def get_tasks(