From 7e11ddbbdd6ddfa28367c02d0a3a7f3932c369ae Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Mon, 11 Mar 2024 23:58:35 +0300 Subject: Define Group using a frozen dataclass. * gn_auth/auth/authorisation/data/genotypes.py: Import dataclasses.asdict. (link_genotype_data): Replace dictify with asdict. * gn_auth/auth/authorisation/data/mrna.py: Import dataclasses.asdict. (link_mrna_data): Replace dictify with asdict. * gn_auth/auth/authorisation/data/phenotypes.py: Import dataclasses.asdict. (link_phenotype_data): Replace dictify with asdict. * gn_auth/auth/authorisation/resources/groups/models.py: Import dataclass. (Group): Use frozen dataclass. (Group.dictify): Delete. (GroupRole.dictify): Replace dictify with asdict. * gn_auth/auth/authorisation/resources/groups/views.py: Import dataclasses.asdict. Remove dictify import. (list_groups): Replace dictify with asdict. (create_group): Ditto. * gn_auth/auth/authorisation/resources/views.py: (resource_users): Replace dictify with asdict. * gn_auth/auth/authorisation/users/views.py: Import dataclasses.asdict. Remove dictify import. (user_details): Replace dictify with asdict. (user_group): Ditto. Signed-off-by: Munyoki Kilyungi --- gn_auth/auth/authorisation/resources/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gn_auth/auth/authorisation/resources/views.py') diff --git a/gn_auth/auth/authorisation/resources/views.py b/gn_auth/auth/authorisation/resources/views.py index 8976dfa..5d00f8c 100644 --- a/gn_auth/auth/authorisation/resources/views.py +++ b/gn_auth/auth/authorisation/resources/views.py @@ -193,9 +193,9 @@ def resource_users(resource_id: uuid.UUID): "users.") results = ( { - "user_group": dictify(row["user_group"]), "roles": tuple(dictify(role) for role in row["roles"]) "user": asdict(row["user"]), + "user_group": asdict(row["user_group"]), } for row in ( user_row for user_id, user_row in with_db_connection(__the_users__).items())) -- cgit v1.2.3