about summary refs log tree commit diff
path: root/gn3/auth/authorisation/resources
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-04-12 11:41:43 +0300
committerFrederick Muriuki Muriithi2023-04-12 11:41:43 +0300
commit7022a3145586a7e5298bf2bf50226eb63a51d563 (patch)
tree8dd48acb5934be72b12ea1044bf3a71e5f935bce /gn3/auth/authorisation/resources
parent54e8769a8cfbf12967c26598b97ce0e88d891e86 (diff)
downloadgenenetwork3-7022a3145586a7e5298bf2bf50226eb63a51d563.tar.gz
auth: Enable listing of unlinked genotype/mRNA group data.
Diffstat (limited to 'gn3/auth/authorisation/resources')
-rw-r--r--gn3/auth/authorisation/resources/models.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/gn3/auth/authorisation/resources/models.py b/gn3/auth/authorisation/resources/models.py
index afda5e8..4c71ade 100644
--- a/gn3/auth/authorisation/resources/models.py
+++ b/gn3/auth/authorisation/resources/models.py
@@ -217,9 +217,8 @@ def mrna_resource_data(
         cursor: db.DbCursor, resource_id: UUID) -> Sequence[sqlite3.Row]:
     """Fetch data linked to a mRNA resource"""
     cursor.execute(
-        "SELECT * FROM mrna_resources AS mr INNER JOIN linked_group_data AS lgd"
-        " ON (mr.dataset_id=lgd.dataset_or_trait_id "
-        "AND mr.dataset_type=lgd.dataset_type) "
+        "SELECT * FROM mrna_resources AS mr INNER JOIN linked_mrna_data AS lmr"
+        " ON mr.data_link_id=lmr.data_link_id "
         "WHERE mr.resource_id=?",
         (str(resource_id),))
     return cursor.fetchall()
@@ -229,9 +228,8 @@ def genotype_resource_data(
     """Fetch data linked to a Genotype resource"""
     cursor.execute(
         "SELECT * FROM genotype_resources AS gr "
-        "INNER JOIN linked_group_data AS lgd "
-        "ON (gr.trait_id=lgd.dataset_or_trait_id "
-        "AND gr.dataset_type=lgd.dataset_type) "
+        "INNER JOIN linked_genotype_data AS lgd "
+        "ON gr.data_link_id=lgd.data_link_id "
         "WHERE gr.resource_id=?",
         (str(resource_id),))
     return cursor.fetchall()
@@ -241,9 +239,9 @@ def phenotype_resource_data(
     """Fetch data linked to a Phenotype resource"""
     cursor.execute(
         "SELECT * FROM phenotype_resources AS pr "
-        "INNER JOIN linked_group_data AS lgd "
-        "ON (pr.trait_id=lgd.dataset_or_trait_id "
-        "AND pr.dataset_type=lgd.dataset_type) "
+        "INNER JOIN linked_phenotype_data AS lpd "
+        "ON (pr.trait_id=lpd.dataset_or_trait_id "
+        "AND pr.dataset_type=lpd.dataset_type) "
         "WHERE pr.resource_id=?",
         (str(resource_id),))
     return cursor.fetchall()