diff options
author | Frederick Muriuki Muriithi | 2023-09-26 03:11:45 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-09-26 03:44:34 +0300 |
commit | d453f607ffa5d3a7c6dde31e16b0f4cbb7cbb069 (patch) | |
tree | e64a8fc599868b602c70c718f6586a8a8d8d5cff /gn_auth | |
parent | 9f4e9db223b4e2c052756208ecf035044db0451d (diff) | |
download | gn-auth-d453f607ffa5d3a7c6dde31e16b0f4cbb7cbb069.tar.gz |
Handle temporary edge cases
Fetching resource data: system and group categories of resources do
not have associated genetic data.
This commit adds some code to temporarily handle that case as an edge
case before I can devote more time to fixing the issue in a much
better way.
Diffstat (limited to 'gn_auth')
-rw-r--r-- | gn_auth/auth/authorisation/resources/groups/views.py | 3 | ||||
-rw-r--r-- | gn_auth/auth/authorisation/resources/models.py | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/gn_auth/auth/authorisation/resources/groups/views.py b/gn_auth/auth/authorisation/resources/groups/views.py index f146ffd..ba34040 100644 --- a/gn_auth/auth/authorisation/resources/groups/views.py +++ b/gn_auth/auth/authorisation/resources/groups/views.py @@ -233,6 +233,9 @@ def unlinked_phenotype_data( @require_oauth("profile group resource") def unlinked_data(resource_type: str) -> Response: """View data linked to the group but not linked to any resource.""" + if resource_type in ("system", "group"): + return jsonify(tuple()) + if resource_type not in ("all", "mrna", "genotype", "phenotype"): raise AuthorisationError(f"Invalid resource type {resource_type}") diff --git a/gn_auth/auth/authorisation/resources/models.py b/gn_auth/auth/authorisation/resources/models.py index 6d8e008..a16ca16 100644 --- a/gn_auth/auth/authorisation/resources/models.py +++ b/gn_auth/auth/authorisation/resources/models.py @@ -181,7 +181,8 @@ def resource_data(conn, resource, offset: int = 0, limit: Optional[int] = None) resource_data_function = { "mrna": mrna_resource_data, "genotype": genotype_resource_data, - "phenotype": phenotype_resource_data + "phenotype": phenotype_resource_data, + "system": lambda *args: tuple() } with db.cursor(conn) as cursor: return tuple( |