From f10932709bc5153f5e4bd1ccbeb3e2c27130d096 Mon Sep 17 00:00:00 2001 From: EddieLF <34049565+EddieLF@users.noreply.github.com> Date: Wed, 25 Oct 2023 13:04:52 +1100 Subject: [PATCH] Update sequencing group 'project:' filter to parse names, not ids (#585) * Update sequencing group 'project:' filter to parse project names, not ids * Update sequencing group 'project:' filter to parse names, not ids * Add project filter into test_sg_analyses_query * Update gql schema sample project filter --- api/graphql/schema.py | 12 ++++++------ test/test_graphql.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/graphql/schema.py b/api/graphql/schema.py index c2b458511..7b9a030f8 100644 --- a/api/graphql/schema.py +++ b/api/graphql/schema.py @@ -589,9 +589,9 @@ async def sample( project_name_map: dict[str, int] = {} if project: - project_ids = project.all_values() - projects = await ptable.get_and_check_access_to_projects_for_ids( - user=connection.author, project_ids=project_ids, readonly=True + project_names = project.all_values() + projects = await ptable.get_and_check_access_to_projects_for_names( + user=connection.author, project_names=project_names, readonly=True ) project_name_map = {p.name: p.id for p in projects} @@ -633,9 +633,9 @@ async def sequencing_groups( # we list project names, but internally we want project ids project_id_map = {} if project: - project_ids = project.all_values() - projects = await ptable.get_and_check_access_to_projects_for_ids( - user=connection.author, project_ids=project_ids, readonly=True + project_names = project.all_values() + projects = await ptable.get_and_check_access_to_projects_for_names( + user=connection.author, project_names=project_names, readonly=True ) project_id_map = {p.name: p.id for p in projects} diff --git a/test/test_graphql.py b/test/test_graphql.py index 2078b1184..294e1ad56 100644 --- a/test/test_graphql.py +++ b/test/test_graphql.py @@ -209,7 +209,7 @@ async def test_sg_analyses_query(self): q = """ query MyQuery($sg_id: String!, $project: String!) { - sequencingGroups(id: {in_: [$sg_id]}) { + sequencingGroups(id: {in_: [$sg_id]}, project: {eq: $project}) { analyses(project: {eq: $project}) { id meta