From 708148d8a856f05414a9cc64f4dab60cff04f89e Mon Sep 17 00:00:00 2001 From: YariKar Date: Fri, 13 Dec 2024 01:02:09 +0300 Subject: [PATCH] db: fixes --- .../src/gighunt/modules/use_cases/group_use_cases.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gighunt/src/gighunt/modules/use_cases/group_use_cases.py b/gighunt/src/gighunt/modules/use_cases/group_use_cases.py index 828e091..0a8eaa0 100644 --- a/gighunt/src/gighunt/modules/use_cases/group_use_cases.py +++ b/gighunt/src/gighunt/modules/use_cases/group_use_cases.py @@ -133,7 +133,17 @@ def get_groups(self, page: int, page_size: int, filters: FilterGroup) -> Respons star_cursor = star_use_cases.get_all_entities(star_use_cases.edge_collection_names.STARSTOGROUP.value).find( {"_to": str(group["_id"])}) stars = list(star_cursor.batch()) - group_list.append({"group": group, "stars": stars}) + user_group_use_cases = self.edge_use_cases.user_group_use_cases + user_groups = user_group_use_cases.get_all_entities( + user_group_use_cases.edge_collection_names.USERGROUP.value).find( + {"_to": group["_id"]} + ).batch() + users = [] + for user_group_edge in user_groups: + current_user = self.get_another_entity(user_group_edge["_from"], "User") + current_join_date = user_group_edge["join_date"] + users.append({"user": current_user, "join_date": current_join_date}) + group_list.append({"group": group, "stars": stars, "users": users}) return {"group_list": group_list , "count": self.get_all_entities_count()} def get_group(self, group_id: int) -> Response: