Skip to content

Commit

Permalink
db: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
YariKar committed Dec 12, 2024
1 parent aa75d41 commit 708148d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion gighunt/src/gighunt/modules/use_cases/group_use_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 708148d

Please sign in to comment.